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