Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: src/compiler/mips/instruction-selector-mips.cc

Issue 1520503002: MIPS: [turbofan] Optimize Float32 to Int32 rep. changes with Float32 round ops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix typo. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/base/adapters.h" 5 #include "src/base/adapters.h"
6 #include "src/base/bits.h" 6 #include "src/base/bits.h"
7 #include "src/compiler/instruction-selector-impl.h" 7 #include "src/compiler/instruction-selector-impl.h"
8 #include "src/compiler/node-matchers.h" 8 #include "src/compiler/node-matchers.h"
9 #include "src/compiler/node-properties.h" 9 #include "src/compiler/node-properties.h"
10 10
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 return; 528 return;
529 case IrOpcode::kFloat64RoundTiesEven: 529 case IrOpcode::kFloat64RoundTiesEven:
530 Emit(kMipsRoundWD, g.DefineAsRegister(node), 530 Emit(kMipsRoundWD, g.DefineAsRegister(node),
531 g.UseRegister(value->InputAt(0))); 531 g.UseRegister(value->InputAt(0)));
532 return; 532 return;
533 case IrOpcode::kFloat64RoundTruncate: 533 case IrOpcode::kFloat64RoundTruncate:
534 Emit(kMipsTruncWD, g.DefineAsRegister(node), 534 Emit(kMipsTruncWD, g.DefineAsRegister(node),
535 g.UseRegister(value->InputAt(0))); 535 g.UseRegister(value->InputAt(0)));
536 return; 536 return;
537 default: 537 default:
538 VisitRR(this, kMipsTruncWD, node); 538 break;
539 }
540 if (value->opcode() == IrOpcode::kChangeFloat32ToFloat64) {
541 Node* next = value->InputAt(0);
542 if (CanCover(value, next)) {
543 // Match ChangeFloat64ToInt32(ChangeFloat32ToFloat64(Float64Round##OP))
544 switch (next->opcode()) {
545 case IrOpcode::kFloat32RoundDown:
546 Emit(kMipsFloorWS, g.DefineAsRegister(node),
547 g.UseRegister(next->InputAt(0)));
548 return;
549 case IrOpcode::kFloat32RoundUp:
550 Emit(kMipsCeilWS, g.DefineAsRegister(node),
551 g.UseRegister(next->InputAt(0)));
552 return;
553 case IrOpcode::kFloat32RoundTiesEven:
554 Emit(kMipsRoundWS, g.DefineAsRegister(node),
555 g.UseRegister(next->InputAt(0)));
556 return;
557 case IrOpcode::kFloat32RoundTruncate:
558 Emit(kMipsTruncWS, g.DefineAsRegister(node),
559 g.UseRegister(next->InputAt(0)));
560 return;
561 default:
562 Emit(kMipsTruncWS, g.DefineAsRegister(node),
563 g.UseRegister(value->InputAt(0)));
564 return;
565 }
566 } else {
567 // Match float32 -> float64 -> int32 representation change path.
568 Emit(kMipsTruncWS, g.DefineAsRegister(node),
569 g.UseRegister(value->InputAt(0)));
539 return; 570 return;
571 }
540 } 572 }
541 } 573 }
542 VisitRR(this, kMipsTruncWD, node); 574 VisitRR(this, kMipsTruncWD, node);
543 } 575 }
544 576
545 577
546 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { 578 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
547 VisitRR(this, kMipsTruncUwD, node); 579 VisitRR(this, kMipsTruncUwD, node);
548 } 580 }
549 581
550 582
551 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { 583 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
584 MipsOperandGenerator g(this);
585 Node* value = node->InputAt(0);
586 // Match TruncateFloat64ToFloat32(ChangeInt32ToFloat64) to corresponding
587 // instruction.
588 if (CanCover(node, value) &&
589 value->opcode() == IrOpcode::kChangeInt32ToFloat64) {
590 Emit(kMipsCvtSW, g.DefineAsRegister(node),
591 g.UseRegister(value->InputAt(0)));
592 return;
593 }
552 VisitRR(this, kMipsCvtSD, node); 594 VisitRR(this, kMipsCvtSD, node);
553 } 595 }
554 596
555 597
556 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) { 598 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) {
557 switch (TruncationModeOf(node->op())) { 599 switch (TruncationModeOf(node->op())) {
558 case TruncationMode::kJavaScript: 600 case TruncationMode::kJavaScript:
559 return VisitRR(this, kArchTruncateDoubleToI, node); 601 return VisitRR(this, kArchTruncateDoubleToI, node);
560 case TruncationMode::kRoundToZero: 602 case TruncationMode::kRoundToZero:
561 return VisitRR(this, kMipsTruncWD, node); 603 return VisitRR(this, kMipsTruncWD, node);
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 MachineOperatorBuilder::kFloat32Max | 1321 MachineOperatorBuilder::kFloat32Max |
1280 MachineOperatorBuilder::kFloat32RoundDown | 1322 MachineOperatorBuilder::kFloat32RoundDown |
1281 MachineOperatorBuilder::kFloat32RoundUp | 1323 MachineOperatorBuilder::kFloat32RoundUp |
1282 MachineOperatorBuilder::kFloat32RoundTruncate | 1324 MachineOperatorBuilder::kFloat32RoundTruncate |
1283 MachineOperatorBuilder::kFloat32RoundTiesEven; 1325 MachineOperatorBuilder::kFloat32RoundTiesEven;
1284 } 1326 }
1285 1327
1286 } // namespace compiler 1328 } // namespace compiler
1287 } // namespace internal 1329 } // namespace internal
1288 } // namespace v8 1330 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/mips/instruction-codes-mips.h ('k') | src/compiler/mips64/code-generator-mips64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698