OLD | NEW |
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/compiler/instruction-selector-impl.h" | 5 #include "src/compiler/instruction-selector-impl.h" |
6 #include "src/compiler/node-matchers.h" | 6 #include "src/compiler/node-matchers.h" |
7 #include "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 std::swap(left, right); | 641 std::swap(left, right); |
642 } | 642 } |
643 Emit(kIA32Imul, g.DefineSameAsFirst(node), g.UseRegister(left), | 643 Emit(kIA32Imul, g.DefineSameAsFirst(node), g.UseRegister(left), |
644 g.Use(right)); | 644 g.Use(right)); |
645 } | 645 } |
646 } | 646 } |
647 | 647 |
648 | 648 |
649 void InstructionSelector::VisitInt32MulHigh(Node* node) { | 649 void InstructionSelector::VisitInt32MulHigh(Node* node) { |
650 IA32OperandGenerator g(this); | 650 IA32OperandGenerator g(this); |
651 InstructionOperand* temps[] = {g.TempRegister(eax)}; | |
652 Emit(kIA32ImulHigh, g.DefineAsFixed(node, edx), | 651 Emit(kIA32ImulHigh, g.DefineAsFixed(node, edx), |
653 g.UseFixed(node->InputAt(0), eax), g.UseUniqueRegister(node->InputAt(1)), | 652 g.UseFixed(node->InputAt(0), eax), |
654 arraysize(temps), temps); | 653 g.UseUniqueRegister(node->InputAt(1))); |
655 } | 654 } |
656 | 655 |
657 | 656 |
658 static inline void VisitDiv(InstructionSelector* selector, Node* node, | 657 static inline void VisitDiv(InstructionSelector* selector, Node* node, |
659 ArchOpcode opcode) { | 658 ArchOpcode opcode) { |
660 IA32OperandGenerator g(selector); | 659 IA32OperandGenerator g(selector); |
661 InstructionOperand* temps[] = {g.TempRegister(edx)}; | 660 InstructionOperand* temps[] = {g.TempRegister(edx)}; |
662 size_t temp_count = arraysize(temps); | 661 size_t temp_count = arraysize(temps); |
663 selector->Emit(opcode, g.DefineAsFixed(node, eax), | 662 selector->Emit(opcode, g.DefineAsFixed(node, eax), |
664 g.UseFixed(node->InputAt(0), eax), | 663 g.UseFixed(node->InputAt(0), eax), |
665 g.UseUnique(node->InputAt(1)), temp_count, temps); | 664 g.UseUnique(node->InputAt(1)), temp_count, temps); |
666 } | 665 } |
667 | 666 |
668 | 667 |
669 void InstructionSelector::VisitInt32Div(Node* node) { | 668 void InstructionSelector::VisitInt32Div(Node* node) { |
670 VisitDiv(this, node, kIA32Idiv); | 669 VisitDiv(this, node, kIA32Idiv); |
671 } | 670 } |
672 | 671 |
673 | 672 |
674 void InstructionSelector::VisitUint32Div(Node* node) { | 673 void InstructionSelector::VisitUint32Div(Node* node) { |
675 VisitDiv(this, node, kIA32Udiv); | 674 VisitDiv(this, node, kIA32Udiv); |
676 } | 675 } |
677 | 676 |
678 | 677 |
679 static inline void VisitMod(InstructionSelector* selector, Node* node, | 678 static inline void VisitMod(InstructionSelector* selector, Node* node, |
680 ArchOpcode opcode) { | 679 ArchOpcode opcode) { |
681 IA32OperandGenerator g(selector); | 680 IA32OperandGenerator g(selector); |
682 InstructionOperand* temps[] = {g.TempRegister(eax), g.TempRegister(edx)}; | |
683 size_t temp_count = arraysize(temps); | |
684 selector->Emit(opcode, g.DefineAsFixed(node, edx), | 681 selector->Emit(opcode, g.DefineAsFixed(node, edx), |
685 g.UseFixed(node->InputAt(0), eax), | 682 g.UseFixed(node->InputAt(0), eax), |
686 g.UseUnique(node->InputAt(1)), temp_count, temps); | 683 g.UseUnique(node->InputAt(1))); |
687 } | 684 } |
688 | 685 |
689 | 686 |
690 void InstructionSelector::VisitInt32Mod(Node* node) { | 687 void InstructionSelector::VisitInt32Mod(Node* node) { |
691 VisitMod(this, node, kIA32Idiv); | 688 VisitMod(this, node, kIA32Idiv); |
692 } | 689 } |
693 | 690 |
694 | 691 |
695 void InstructionSelector::VisitUint32Mod(Node* node) { | 692 void InstructionSelector::VisitUint32Mod(Node* node) { |
696 VisitMod(this, node, kIA32Udiv); | 693 VisitMod(this, node, kIA32Udiv); |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1087 if (CpuFeatures::IsSupported(SSE4_1)) { | 1084 if (CpuFeatures::IsSupported(SSE4_1)) { |
1088 return MachineOperatorBuilder::kFloat64Floor | | 1085 return MachineOperatorBuilder::kFloat64Floor | |
1089 MachineOperatorBuilder::kFloat64Ceil | | 1086 MachineOperatorBuilder::kFloat64Ceil | |
1090 MachineOperatorBuilder::kFloat64RoundTruncate; | 1087 MachineOperatorBuilder::kFloat64RoundTruncate; |
1091 } | 1088 } |
1092 return MachineOperatorBuilder::Flag::kNoFlags; | 1089 return MachineOperatorBuilder::Flag::kNoFlags; |
1093 } | 1090 } |
1094 } // namespace compiler | 1091 } // namespace compiler |
1095 } // namespace internal | 1092 } // namespace internal |
1096 } // namespace v8 | 1093 } // namespace v8 |
OLD | NEW |