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 <algorithm> | 5 #include <algorithm> |
6 | 6 |
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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 default: | 825 default: |
826 break; | 826 break; |
827 } | 827 } |
828 } | 828 } |
829 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value)); | 829 Emit(kX64Movl, g.DefineAsRegister(node), g.Use(value)); |
830 } | 830 } |
831 | 831 |
832 | 832 |
833 void InstructionSelector::VisitFloat64Add(Node* node) { | 833 void InstructionSelector::VisitFloat64Add(Node* node) { |
834 X64OperandGenerator g(this); | 834 X64OperandGenerator g(this); |
| 835 Node* left = node->InputAt(0); |
| 836 Node* right = node->InputAt(1); |
| 837 if (g.CanBeBetterLeftOperand(right)) std::swap(left, right); |
835 if (IsSupported(AVX)) { | 838 if (IsSupported(AVX)) { |
836 Emit(kAVXFloat64Add, g.DefineAsRegister(node), | 839 Emit(kAVXFloat64Add, g.DefineAsRegister(node), g.UseRegister(left), |
837 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 840 g.Use(right)); |
838 } else { | 841 } else { |
839 Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), | 842 Emit(kSSEFloat64Add, g.DefineSameAsFirst(node), g.UseRegister(left), |
840 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 843 g.Use(right)); |
841 } | 844 } |
842 } | 845 } |
843 | 846 |
844 | 847 |
845 void InstructionSelector::VisitFloat64Sub(Node* node) { | 848 void InstructionSelector::VisitFloat64Sub(Node* node) { |
846 X64OperandGenerator g(this); | 849 X64OperandGenerator g(this); |
847 if (IsSupported(AVX)) { | 850 if (IsSupported(AVX)) { |
848 Emit(kAVXFloat64Sub, g.DefineAsRegister(node), | 851 Emit(kAVXFloat64Sub, g.DefineAsRegister(node), |
849 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 852 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
850 } else { | 853 } else { |
851 Emit(kSSEFloat64Sub, g.DefineSameAsFirst(node), | 854 Emit(kSSEFloat64Sub, g.DefineSameAsFirst(node), |
852 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 855 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
853 } | 856 } |
854 } | 857 } |
855 | 858 |
856 | 859 |
857 void InstructionSelector::VisitFloat64Mul(Node* node) { | 860 void InstructionSelector::VisitFloat64Mul(Node* node) { |
858 X64OperandGenerator g(this); | 861 X64OperandGenerator g(this); |
| 862 Node* left = node->InputAt(0); |
| 863 Node* right = node->InputAt(1); |
| 864 if (g.CanBeBetterLeftOperand(right)) std::swap(left, right); |
859 if (IsSupported(AVX)) { | 865 if (IsSupported(AVX)) { |
860 Emit(kAVXFloat64Mul, g.DefineAsRegister(node), | 866 Emit(kAVXFloat64Mul, g.DefineAsRegister(node), g.UseRegister(left), |
861 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 867 g.Use(right)); |
862 } else { | 868 } else { |
863 Emit(kSSEFloat64Mul, g.DefineSameAsFirst(node), | 869 Emit(kSSEFloat64Mul, g.DefineSameAsFirst(node), g.UseRegister(left), |
864 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 870 g.Use(right)); |
865 } | 871 } |
866 } | 872 } |
867 | 873 |
868 | 874 |
869 void InstructionSelector::VisitFloat64Div(Node* node) { | 875 void InstructionSelector::VisitFloat64Div(Node* node) { |
870 X64OperandGenerator g(this); | 876 X64OperandGenerator g(this); |
871 if (IsSupported(AVX)) { | 877 if (IsSupported(AVX)) { |
872 Emit(kAVXFloat64Div, g.DefineAsRegister(node), | 878 Emit(kAVXFloat64Div, g.DefineAsRegister(node), |
873 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); | 879 g.UseRegister(node->InputAt(0)), g.Use(node->InputAt(1))); |
874 } else { | 880 } else { |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 MachineOperatorBuilder::kFloat64Ceil | | 1398 MachineOperatorBuilder::kFloat64Ceil | |
1393 MachineOperatorBuilder::kFloat64RoundTruncate | | 1399 MachineOperatorBuilder::kFloat64RoundTruncate | |
1394 MachineOperatorBuilder::kWord32ShiftIsSafe; | 1400 MachineOperatorBuilder::kWord32ShiftIsSafe; |
1395 } | 1401 } |
1396 return MachineOperatorBuilder::kNoFlags; | 1402 return MachineOperatorBuilder::kNoFlags; |
1397 } | 1403 } |
1398 | 1404 |
1399 } // namespace compiler | 1405 } // namespace compiler |
1400 } // namespace internal | 1406 } // namespace internal |
1401 } // namespace v8 | 1407 } // namespace v8 |
OLD | NEW |