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.h" | 7 #include "src/compiler/node-properties.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 | 627 |
628 | 628 |
629 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { | 629 void InstructionSelector::VisitTruncateFloat64ToFloat32(Node* node) { |
630 IA32OperandGenerator g(this); | 630 IA32OperandGenerator g(this); |
631 Emit(kSSECvtsd2ss, g.DefineAsRegister(node), g.Use(node->InputAt(0))); | 631 Emit(kSSECvtsd2ss, g.DefineAsRegister(node), g.Use(node->InputAt(0))); |
632 } | 632 } |
633 | 633 |
634 | 634 |
635 void InstructionSelector::VisitFloat64Add(Node* node) { | 635 void InstructionSelector::VisitFloat64Add(Node* node) { |
636 IA32OperandGenerator g(this); | 636 IA32OperandGenerator g(this); |
| 637 Node* left = node->InputAt(0); |
| 638 Node* right = node->InputAt(1); |
| 639 if (g.CanBeBetterLeftOperand(right)) std::swap(left, right); |
637 if (IsSupported(AVX)) { | 640 if (IsSupported(AVX)) { |
638 Emit(kAVXFloat64Add, g.DefineAsRegister(node), | 641 Emit(kAVXFloat64Add, g.DefineAsRegister(node), g.UseRegister(left), |
639 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 642 g.Use(right)); |
640 } else { | 643 } else { |
641 Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), | 644 Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), g.UseRegister(left), |
642 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 645 g.Use(right)); |
643 } | 646 } |
644 } | 647 } |
645 | 648 |
646 | 649 |
647 void InstructionSelector::VisitFloat64Sub(Node* node) { | 650 void InstructionSelector::VisitFloat64Sub(Node* node) { |
648 IA32OperandGenerator g(this); | 651 IA32OperandGenerator g(this); |
649 if (IsSupported(AVX)) { | 652 if (IsSupported(AVX)) { |
650 Emit(kAVXFloat64Sub, g.DefineAsRegister(node), | 653 Emit(kAVXFloat64Sub, g.DefineAsRegister(node), |
651 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 654 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
652 } else { | 655 } else { |
653 Emit(kSSEFloat64Sub, g.DefineSameAsFirst(node), | 656 Emit(kSSEFloat64Sub, g.DefineSameAsFirst(node), |
654 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 657 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
655 } | 658 } |
656 } | 659 } |
657 | 660 |
658 | 661 |
659 void InstructionSelector::VisitFloat64Mul(Node* node) { | 662 void InstructionSelector::VisitFloat64Mul(Node* node) { |
660 IA32OperandGenerator g(this); | 663 IA32OperandGenerator g(this); |
| 664 Node* left = node->InputAt(0); |
| 665 Node* right = node->InputAt(1); |
| 666 if (g.CanBeBetterLeftOperand(right)) std::swap(left, right); |
661 if (IsSupported(AVX)) { | 667 if (IsSupported(AVX)) { |
662 Emit(kAVXFloat64Mul, g.DefineAsRegister(node), | 668 Emit(kAVXFloat64Mul, g.DefineAsRegister(node), g.UseRegister(left), |
663 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 669 g.Use(right)); |
664 } else { | 670 } else { |
665 Emit(kSSEFloat64Mul, g.DefineSameAsFirst(node), | 671 Emit(kSSEFloat64Mul, g.DefineSameAsFirst(node), g.UseRegister(left), |
666 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 672 g.Use(right)); |
667 } | 673 } |
668 } | 674 } |
669 | 675 |
670 | 676 |
671 void InstructionSelector::VisitFloat64Div(Node* node) { | 677 void InstructionSelector::VisitFloat64Div(Node* node) { |
672 IA32OperandGenerator g(this); | 678 IA32OperandGenerator g(this); |
673 if (IsSupported(AVX)) { | 679 if (IsSupported(AVX)) { |
674 Emit(kAVXFloat64Div, g.DefineAsRegister(node), | 680 Emit(kAVXFloat64Div, g.DefineAsRegister(node), |
675 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 681 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
676 } else { | 682 } else { |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 MachineOperatorBuilder::kFloat64Ceil | | 1082 MachineOperatorBuilder::kFloat64Ceil | |
1077 MachineOperatorBuilder::kFloat64RoundTruncate | | 1083 MachineOperatorBuilder::kFloat64RoundTruncate | |
1078 MachineOperatorBuilder::kWord32ShiftIsSafe; | 1084 MachineOperatorBuilder::kWord32ShiftIsSafe; |
1079 } | 1085 } |
1080 return MachineOperatorBuilder::Flag::kNoFlags; | 1086 return MachineOperatorBuilder::Flag::kNoFlags; |
1081 } | 1087 } |
1082 | 1088 |
1083 } // namespace compiler | 1089 } // namespace compiler |
1084 } // namespace internal | 1090 } // namespace internal |
1085 } // namespace v8 | 1091 } // namespace v8 |
OLD | NEW |