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

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

Issue 1225993002: [turbofan] Add TruncationMode for TruncateFloat64ToInt32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 months 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
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/compiler/instruction-selector-impl.h" 6 #include "src/compiler/instruction-selector-impl.h"
7 #include "src/compiler/node-matchers.h" 7 #include "src/compiler/node-matchers.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 9
10 namespace v8 { 10 namespace v8 {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 } 120 }
121 121
122 bool CanBeBetterLeftOperand(Node* node) const { 122 bool CanBeBetterLeftOperand(Node* node) const {
123 return !selector()->IsLive(node); 123 return !selector()->IsLive(node);
124 } 124 }
125 }; 125 };
126 126
127 127
128 namespace { 128 namespace {
129 129
130 void VisitROFloat(InstructionSelector* selector, Node* node, 130 void VisitRO(InstructionSelector* selector, Node* node, ArchOpcode opcode) {
131 ArchOpcode opcode) {
132 IA32OperandGenerator g(selector); 131 IA32OperandGenerator g(selector);
133 selector->Emit(opcode, g.DefineAsRegister(node), g.Use(node->InputAt(0))); 132 selector->Emit(opcode, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
134 } 133 }
135 134
136 135
137 void VisitRRFloat(InstructionSelector* selector, Node* node, 136 void VisitRR(InstructionSelector* selector, Node* node,
138 InstructionCode opcode) { 137 InstructionCode opcode) {
139 IA32OperandGenerator g(selector); 138 IA32OperandGenerator g(selector);
140 selector->Emit(opcode, g.DefineAsRegister(node), 139 selector->Emit(opcode, g.DefineAsRegister(node),
141 g.UseRegister(node->InputAt(0))); 140 g.UseRegister(node->InputAt(0)));
142 } 141 }
143 142
144 143
145 void VisitRROFloat(InstructionSelector* selector, Node* node, 144 void VisitRROFloat(InstructionSelector* selector, Node* node,
146 ArchOpcode avx_opcode, ArchOpcode sse_opcode) { 145 ArchOpcode avx_opcode, ArchOpcode sse_opcode) {
147 IA32OperandGenerator g(selector); 146 IA32OperandGenerator g(selector);
148 InstructionOperand operand0 = g.UseRegister(node->InputAt(0)); 147 InstructionOperand operand0 = g.UseRegister(node->InputAt(0));
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 VisitMod(this, node, kIA32Idiv); 640 VisitMod(this, node, kIA32Idiv);
642 } 641 }
643 642
644 643
645 void InstructionSelector::VisitUint32Mod(Node* node) { 644 void InstructionSelector::VisitUint32Mod(Node* node) {
646 VisitMod(this, node, kIA32Udiv); 645 VisitMod(this, node, kIA32Udiv);
647 } 646 }
648 647
649 648
650 void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) { 649 void InstructionSelector::VisitChangeFloat32ToFloat64(Node* node) {
651 IA32OperandGenerator g(this); 650 VisitRO(this, node, kSSEFloat32ToFloat64);
652 Emit(kSSEFloat32ToFloat64, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
653 } 651 }
654 652
655 653
656 void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) { 654 void InstructionSelector::VisitChangeInt32ToFloat64(Node* node) {
657 IA32OperandGenerator g(this); 655 VisitRO(this, node, kSSEInt32ToFloat64);
658 Emit(kSSEInt32ToFloat64, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
659 } 656 }
660 657
661 658
662 void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) { 659 void InstructionSelector::VisitChangeUint32ToFloat64(Node* node) {
663 IA32OperandGenerator g(this); 660 VisitRO(this, node, kSSEUint32ToFloat64);
664 Emit(kSSEUint32ToFloat64, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
665 } 661 }
666 662
667 663
668 void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) { 664 void InstructionSelector::VisitChangeFloat64ToInt32(Node* node) {
669 IA32OperandGenerator g(this); 665 VisitRO(this, node, kSSEFloat64ToInt32);
670 Emit(kSSEFloat64ToInt32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
671 } 666 }
672 667
673 668
674 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) { 669 void InstructionSelector::VisitChangeFloat64ToUint32(Node* node) {
675 IA32OperandGenerator g(this); 670 VisitRO(this, node, kSSEFloat64ToUint32);
676 Emit(kSSEFloat64ToUint32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
677 } 671 }
678 672
679 673
680 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { 674 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) {
681 IA32OperandGenerator g(this); 675 VisitRO(this, node, kSSEFloat64ToFloat32);
682 Emit(kSSEFloat64ToFloat32, g.DefineAsRegister(node), g.Use(node->InputAt(0)));
683 } 676 }
684 677
685 678
679 void InstructionSelector::VisitTruncateFloat64ToInt32(Node* node) {
680 switch (TruncationModeOf(node->op())) {
681 case TruncationMode::kJavaScript:
682 return VisitRR(this, node, kArchTruncateDoubleToI);
683 case TruncationMode::kRoundToZero:
684 return VisitRO(this, node, kSSEFloat64ToInt32);
685 }
686 UNREACHABLE();
687 }
688
689
686 void InstructionSelector::VisitFloat32Add(Node* node) { 690 void InstructionSelector::VisitFloat32Add(Node* node) {
687 VisitRROFloat(this, node, kAVXFloat32Add, kSSEFloat32Add); 691 VisitRROFloat(this, node, kAVXFloat32Add, kSSEFloat32Add);
688 } 692 }
689 693
690 694
691 void InstructionSelector::VisitFloat64Add(Node* node) { 695 void InstructionSelector::VisitFloat64Add(Node* node) {
692 VisitRROFloat(this, node, kAVXFloat64Add, kSSEFloat64Add); 696 VisitRROFloat(this, node, kAVXFloat64Add, kSSEFloat64Add);
693 } 697 }
694 698
695 699
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
784 } 788 }
785 789
786 790
787 void InstructionSelector::VisitFloat64Abs(Node* node) { 791 void InstructionSelector::VisitFloat64Abs(Node* node) {
788 IA32OperandGenerator g(this); 792 IA32OperandGenerator g(this);
789 VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat64Abs, kSSEFloat64Abs); 793 VisitFloatUnop(this, node, node->InputAt(0), kAVXFloat64Abs, kSSEFloat64Abs);
790 } 794 }
791 795
792 796
793 void InstructionSelector::VisitFloat32Sqrt(Node* node) { 797 void InstructionSelector::VisitFloat32Sqrt(Node* node) {
794 VisitROFloat(this, node, kSSEFloat32Sqrt); 798 VisitRO(this, node, kSSEFloat32Sqrt);
795 } 799 }
796 800
797 801
798 void InstructionSelector::VisitFloat64Sqrt(Node* node) { 802 void InstructionSelector::VisitFloat64Sqrt(Node* node) {
799 VisitROFloat(this, node, kSSEFloat64Sqrt); 803 VisitRO(this, node, kSSEFloat64Sqrt);
800 } 804 }
801 805
802 806
803 void InstructionSelector::VisitFloat64RoundDown(Node* node) { 807 void InstructionSelector::VisitFloat64RoundDown(Node* node) {
804 VisitRRFloat(this, node, kSSEFloat64Round | MiscField::encode(kRoundDown)); 808 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundDown));
805 } 809 }
806 810
807 811
808 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) { 812 void InstructionSelector::VisitFloat64RoundTruncate(Node* node) {
809 VisitRRFloat(this, node, kSSEFloat64Round | MiscField::encode(kRoundToZero)); 813 VisitRR(this, node, kSSEFloat64Round | MiscField::encode(kRoundToZero));
810 } 814 }
811 815
812 816
813 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) { 817 void InstructionSelector::VisitFloat64RoundTiesAway(Node* node) {
814 UNREACHABLE(); 818 UNREACHABLE();
815 } 819 }
816 820
817 821
818 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) { 822 void InstructionSelector::VisitCall(Node* node, BasicBlock* handler) {
819 IA32OperandGenerator g(this); 823 IA32OperandGenerator g(this);
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
1338 if (CpuFeatures::IsSupported(SSE4_1)) { 1342 if (CpuFeatures::IsSupported(SSE4_1)) {
1339 flags |= MachineOperatorBuilder::kFloat64RoundDown | 1343 flags |= MachineOperatorBuilder::kFloat64RoundDown |
1340 MachineOperatorBuilder::kFloat64RoundTruncate; 1344 MachineOperatorBuilder::kFloat64RoundTruncate;
1341 } 1345 }
1342 return flags; 1346 return flags;
1343 } 1347 }
1344 1348
1345 } // namespace compiler 1349 } // namespace compiler
1346 } // namespace internal 1350 } // namespace internal
1347 } // namespace v8 1351 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/instruction-selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698