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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 V(Float64RoundTiesEven, kSSEFloat64Round | MiscField::encode(kRoundToNearest)) | 881 V(Float64RoundTiesEven, kSSEFloat64Round | MiscField::encode(kRoundToNearest)) |
882 | 882 |
883 #define RRO_FLOAT_OP_LIST(V) \ | 883 #define RRO_FLOAT_OP_LIST(V) \ |
884 V(Float32Add, kAVXFloat32Add, kSSEFloat32Add) \ | 884 V(Float32Add, kAVXFloat32Add, kSSEFloat32Add) \ |
885 V(Float64Add, kAVXFloat64Add, kSSEFloat64Add) \ | 885 V(Float64Add, kAVXFloat64Add, kSSEFloat64Add) \ |
886 V(Float32Sub, kAVXFloat32Sub, kSSEFloat32Sub) \ | 886 V(Float32Sub, kAVXFloat32Sub, kSSEFloat32Sub) \ |
887 V(Float64Sub, kAVXFloat64Sub, kSSEFloat64Sub) \ | 887 V(Float64Sub, kAVXFloat64Sub, kSSEFloat64Sub) \ |
888 V(Float32Mul, kAVXFloat32Mul, kSSEFloat32Mul) \ | 888 V(Float32Mul, kAVXFloat32Mul, kSSEFloat32Mul) \ |
889 V(Float64Mul, kAVXFloat64Mul, kSSEFloat64Mul) \ | 889 V(Float64Mul, kAVXFloat64Mul, kSSEFloat64Mul) \ |
890 V(Float32Div, kAVXFloat32Div, kSSEFloat32Div) \ | 890 V(Float32Div, kAVXFloat32Div, kSSEFloat32Div) \ |
891 V(Float64Div, kAVXFloat64Div, kSSEFloat64Div) \ | 891 V(Float64Div, kAVXFloat64Div, kSSEFloat64Div) |
892 V(I32x4Add, kAVXI32x4Add, kSSEI32x4Add) \ | |
893 V(I32x4Sub, kAVXI32x4Sub, kSSEI32x4Sub) | |
894 | 892 |
895 #define FLOAT_UNOP_LIST(V) \ | 893 #define FLOAT_UNOP_LIST(V) \ |
896 V(Float32Abs, kAVXFloat32Abs, kSSEFloat32Abs) \ | 894 V(Float32Abs, kAVXFloat32Abs, kSSEFloat32Abs) \ |
897 V(Float64Abs, kAVXFloat64Abs, kSSEFloat64Abs) \ | 895 V(Float64Abs, kAVXFloat64Abs, kSSEFloat64Abs) \ |
898 V(Float32Neg, kAVXFloat32Neg, kSSEFloat32Neg) \ | 896 V(Float32Neg, kAVXFloat32Neg, kSSEFloat32Neg) \ |
899 V(Float64Neg, kAVXFloat64Neg, kSSEFloat64Neg) | 897 V(Float64Neg, kAVXFloat64Neg, kSSEFloat64Neg) |
900 | 898 |
901 #define RO_VISITOR(Name, opcode) \ | 899 #define RO_VISITOR(Name, opcode) \ |
902 void InstructionSelector::Visit##Name(Node* node) { \ | 900 void InstructionSelector::Visit##Name(Node* node) { \ |
903 VisitRO(this, node, opcode); \ | 901 VisitRO(this, node, opcode); \ |
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 kAtomic##op##Int16, kAtomic##op##Uint16, \ | 1884 kAtomic##op##Int16, kAtomic##op##Uint16, \ |
1887 kAtomic##op##Word32); \ | 1885 kAtomic##op##Word32); \ |
1888 } | 1886 } |
1889 VISIT_ATOMIC_BINOP(Add) | 1887 VISIT_ATOMIC_BINOP(Add) |
1890 VISIT_ATOMIC_BINOP(Sub) | 1888 VISIT_ATOMIC_BINOP(Sub) |
1891 VISIT_ATOMIC_BINOP(And) | 1889 VISIT_ATOMIC_BINOP(And) |
1892 VISIT_ATOMIC_BINOP(Or) | 1890 VISIT_ATOMIC_BINOP(Or) |
1893 VISIT_ATOMIC_BINOP(Xor) | 1891 VISIT_ATOMIC_BINOP(Xor) |
1894 #undef VISIT_ATOMIC_BINOP | 1892 #undef VISIT_ATOMIC_BINOP |
1895 | 1893 |
1896 void InstructionSelector::VisitI32x4Splat(Node* node) { | 1894 #define SIMD_TYPES(V) \ |
1897 VisitRO(this, node, kIA32I32x4Splat); | 1895 V(I32x4) \ |
1898 } | 1896 V(I16x8) \ |
| 1897 V(I8x16) |
1899 | 1898 |
1900 void InstructionSelector::VisitI32x4ExtractLane(Node* node) { | 1899 #define SIMD_BINOP_LIST(V) \ |
1901 IA32OperandGenerator g(this); | 1900 V(I32x4Add) \ |
1902 int32_t lane = OpParameter<int32_t>(node); | 1901 V(I32x4Sub) |
1903 Emit(kIA32I32x4ExtractLane, g.DefineAsRegister(node), | |
1904 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane)); | |
1905 } | |
1906 | 1902 |
1907 void InstructionSelector::VisitI32x4ReplaceLane(Node* node) { | 1903 #define VISIT_SIMD_SPLAT(Type) \ |
1908 IA32OperandGenerator g(this); | 1904 void InstructionSelector::Visit##Type##Splat(Node* node) { \ |
1909 InstructionOperand operand0 = g.UseRegister(node->InputAt(0)); | 1905 VisitRO(this, node, kIA32##Type##Splat); \ |
1910 InstructionOperand operand1 = g.UseImmediate(OpParameter<int32_t>(node)); | |
1911 InstructionOperand operand2 = g.Use(node->InputAt(1)); | |
1912 if (IsSupported(AVX)) { | |
1913 Emit(kAVXI32x4ReplaceLane, g.DefineAsRegister(node), operand0, operand1, | |
1914 operand2); | |
1915 } else { | |
1916 Emit(kSSEI32x4ReplaceLane, g.DefineSameAsFirst(node), operand0, operand1, | |
1917 operand2); | |
1918 } | 1906 } |
1919 } | 1907 SIMD_TYPES(VISIT_SIMD_SPLAT) |
| 1908 #undef VISIT_SIMD_SPLAT |
| 1909 |
| 1910 #define VISIT_SIMD_EXTRACT_LANE(Type) \ |
| 1911 void InstructionSelector::Visit##Type##ExtractLane(Node* node) { \ |
| 1912 IA32OperandGenerator g(this); \ |
| 1913 int32_t lane = OpParameter<int32_t>(node); \ |
| 1914 Emit(kIA32##Type##ExtractLane, g.DefineAsRegister(node), \ |
| 1915 g.UseRegister(node->InputAt(0)), g.UseImmediate(lane)); \ |
| 1916 } |
| 1917 SIMD_TYPES(VISIT_SIMD_EXTRACT_LANE) |
| 1918 #undef VISIT_SIMD_EXTRACT_LANE |
| 1919 |
| 1920 #define VISIT_SIMD_REPLACE_LANE(Type) \ |
| 1921 void InstructionSelector::Visit##Type##ReplaceLane(Node* node) { \ |
| 1922 IA32OperandGenerator g(this); \ |
| 1923 InstructionOperand operand0 = g.UseRegister(node->InputAt(0)); \ |
| 1924 InstructionOperand operand1 = g.UseImmediate(OpParameter<int32_t>(node)); \ |
| 1925 InstructionOperand operand2 = g.Use(node->InputAt(1)); \ |
| 1926 if (IsSupported(AVX)) { \ |
| 1927 Emit(kAVX##Type##ReplaceLane, g.DefineAsRegister(node), operand0, \ |
| 1928 operand1, operand2); \ |
| 1929 } else { \ |
| 1930 Emit(kSSE##Type##ReplaceLane, g.DefineSameAsFirst(node), operand0, \ |
| 1931 operand1, operand2); \ |
| 1932 } \ |
| 1933 } |
| 1934 SIMD_TYPES(VISIT_SIMD_REPLACE_LANE) |
| 1935 #undef VISIT_SIMD_REPLACE_LANE |
| 1936 |
| 1937 #define VISIT_SIMD_BINOP(Opcode) \ |
| 1938 void InstructionSelector::Visit##Opcode(Node* node) { \ |
| 1939 VisitRROFloat(this, node, kAVX##Opcode, kSSE##Opcode); \ |
| 1940 } |
| 1941 SIMD_BINOP_LIST(VISIT_SIMD_BINOP) |
| 1942 #undef VISIT_SIMD_BINOP |
1920 | 1943 |
1921 void InstructionSelector::VisitInt32AbsWithOverflow(Node* node) { | 1944 void InstructionSelector::VisitInt32AbsWithOverflow(Node* node) { |
1922 UNREACHABLE(); | 1945 UNREACHABLE(); |
1923 } | 1946 } |
1924 | 1947 |
1925 void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) { | 1948 void InstructionSelector::VisitInt64AbsWithOverflow(Node* node) { |
1926 UNREACHABLE(); | 1949 UNREACHABLE(); |
1927 } | 1950 } |
1928 | 1951 |
1929 // static | 1952 // static |
(...skipping 21 matching lines...) Expand all Loading... |
1951 // static | 1974 // static |
1952 MachineOperatorBuilder::AlignmentRequirements | 1975 MachineOperatorBuilder::AlignmentRequirements |
1953 InstructionSelector::AlignmentRequirements() { | 1976 InstructionSelector::AlignmentRequirements() { |
1954 return MachineOperatorBuilder::AlignmentRequirements:: | 1977 return MachineOperatorBuilder::AlignmentRequirements:: |
1955 FullUnalignedAccessSupport(); | 1978 FullUnalignedAccessSupport(); |
1956 } | 1979 } |
1957 | 1980 |
1958 } // namespace compiler | 1981 } // namespace compiler |
1959 } // namespace internal | 1982 } // namespace internal |
1960 } // namespace v8 | 1983 } // namespace v8 |
OLD | NEW |