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/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 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 | 970 |
971 void InstructionSelector::VisitFloat64Mod(Node* node) { | 971 void InstructionSelector::VisitFloat64Mod(Node* node) { |
972 X87OperandGenerator g(this); | 972 X87OperandGenerator g(this); |
973 InstructionOperand temps[] = {g.TempRegister(eax)}; | 973 InstructionOperand temps[] = {g.TempRegister(eax)}; |
974 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(0))); | 974 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(0))); |
975 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(1))); | 975 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(1))); |
976 Emit(kX87Float64Mod, g.DefineAsFixed(node, stX_0), 1, temps)->MarkAsCall(); | 976 Emit(kX87Float64Mod, g.DefineAsFixed(node, stX_0), 1, temps)->MarkAsCall(); |
977 } | 977 } |
978 | 978 |
979 | 979 |
980 void InstructionSelector::VisitFloat32Max(Node* node) { | |
981 X87OperandGenerator g(this); | |
982 Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(0))); | |
983 Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(1))); | |
984 Emit(kX87Float32Max, g.DefineAsFixed(node, stX_0), 0, nullptr); | |
985 } | |
986 | |
987 | |
988 void InstructionSelector::VisitFloat64Max(Node* node) { | 980 void InstructionSelector::VisitFloat64Max(Node* node) { |
989 X87OperandGenerator g(this); | 981 X87OperandGenerator g(this); |
990 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(0))); | 982 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(0))); |
991 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(1))); | 983 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(1))); |
992 Emit(kX87Float64Max, g.DefineAsFixed(node, stX_0), 0, nullptr); | 984 Emit(kX87Float64Max, g.DefineAsFixed(node, stX_0), 0, nullptr); |
993 } | 985 } |
994 | 986 |
995 | 987 |
996 void InstructionSelector::VisitFloat32Min(Node* node) { | |
997 X87OperandGenerator g(this); | |
998 Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(0))); | |
999 Emit(kX87PushFloat32, g.NoOutput(), g.Use(node->InputAt(1))); | |
1000 Emit(kX87Float32Min, g.DefineAsFixed(node, stX_0), 0, nullptr); | |
1001 } | |
1002 | |
1003 | |
1004 void InstructionSelector::VisitFloat64Min(Node* node) { | 988 void InstructionSelector::VisitFloat64Min(Node* node) { |
1005 X87OperandGenerator g(this); | 989 X87OperandGenerator g(this); |
1006 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(0))); | 990 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(0))); |
1007 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(1))); | 991 Emit(kX87PushFloat64, g.NoOutput(), g.Use(node->InputAt(1))); |
1008 Emit(kX87Float64Min, g.DefineAsFixed(node, stX_0), 0, nullptr); | 992 Emit(kX87Float64Min, g.DefineAsFixed(node, stX_0), 0, nullptr); |
1009 } | 993 } |
1010 | 994 |
1011 | 995 |
1012 void InstructionSelector::VisitFloat32Abs(Node* node) { | 996 void InstructionSelector::VisitFloat32Abs(Node* node) { |
1013 X87OperandGenerator g(this); | 997 X87OperandGenerator g(this); |
(...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1703 } | 1687 } |
1704 inputs[input_count++] = g.UseUniqueRegister(value); | 1688 inputs[input_count++] = g.UseUniqueRegister(value); |
1705 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); | 1689 InstructionCode code = opcode | AddressingModeField::encode(addressing_mode); |
1706 Emit(code, 0, nullptr, input_count, inputs); | 1690 Emit(code, 0, nullptr, input_count, inputs); |
1707 } | 1691 } |
1708 | 1692 |
1709 // static | 1693 // static |
1710 MachineOperatorBuilder::Flags | 1694 MachineOperatorBuilder::Flags |
1711 InstructionSelector::SupportedMachineOperatorFlags() { | 1695 InstructionSelector::SupportedMachineOperatorFlags() { |
1712 MachineOperatorBuilder::Flags flags = | 1696 MachineOperatorBuilder::Flags flags = |
1713 MachineOperatorBuilder::kFloat32Max | | |
1714 MachineOperatorBuilder::kFloat32Min | | |
1715 MachineOperatorBuilder::kFloat64Max | | |
1716 MachineOperatorBuilder::kFloat64Min | | |
1717 MachineOperatorBuilder::kWord32ShiftIsSafe; | 1697 MachineOperatorBuilder::kWord32ShiftIsSafe; |
1718 if (CpuFeatures::IsSupported(POPCNT)) { | 1698 if (CpuFeatures::IsSupported(POPCNT)) { |
1719 flags |= MachineOperatorBuilder::kWord32Popcnt; | 1699 flags |= MachineOperatorBuilder::kWord32Popcnt; |
1720 } | 1700 } |
1721 | 1701 |
1722 flags |= MachineOperatorBuilder::kFloat32RoundDown | | 1702 flags |= MachineOperatorBuilder::kFloat32RoundDown | |
1723 MachineOperatorBuilder::kFloat64RoundDown | | 1703 MachineOperatorBuilder::kFloat64RoundDown | |
1724 MachineOperatorBuilder::kFloat32RoundUp | | 1704 MachineOperatorBuilder::kFloat32RoundUp | |
1725 MachineOperatorBuilder::kFloat64RoundUp | | 1705 MachineOperatorBuilder::kFloat64RoundUp | |
1726 MachineOperatorBuilder::kFloat32RoundTruncate | | 1706 MachineOperatorBuilder::kFloat32RoundTruncate | |
1727 MachineOperatorBuilder::kFloat64RoundTruncate | | 1707 MachineOperatorBuilder::kFloat64RoundTruncate | |
1728 MachineOperatorBuilder::kFloat32RoundTiesEven | | 1708 MachineOperatorBuilder::kFloat32RoundTiesEven | |
1729 MachineOperatorBuilder::kFloat64RoundTiesEven; | 1709 MachineOperatorBuilder::kFloat64RoundTiesEven; |
1730 return flags; | 1710 return flags; |
1731 } | 1711 } |
1732 | 1712 |
1733 // static | 1713 // static |
1734 MachineOperatorBuilder::AlignmentRequirements | 1714 MachineOperatorBuilder::AlignmentRequirements |
1735 InstructionSelector::AlignmentRequirements() { | 1715 InstructionSelector::AlignmentRequirements() { |
1736 return MachineOperatorBuilder::AlignmentRequirements:: | 1716 return MachineOperatorBuilder::AlignmentRequirements:: |
1737 FullUnalignedAccessSupport(); | 1717 FullUnalignedAccessSupport(); |
1738 } | 1718 } |
1739 | 1719 |
1740 } // namespace compiler | 1720 } // namespace compiler |
1741 } // namespace internal | 1721 } // namespace internal |
1742 } // namespace v8 | 1722 } // namespace v8 |
OLD | NEW |