diff options
Diffstat (limited to 'deps/v8/src/compiler/simd-scalar-lowering.cc')
-rw-r--r-- | deps/v8/src/compiler/simd-scalar-lowering.cc | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/deps/v8/src/compiler/simd-scalar-lowering.cc b/deps/v8/src/compiler/simd-scalar-lowering.cc index 980c88a6e6..3316b92c0b 100644 --- a/deps/v8/src/compiler/simd-scalar-lowering.cc +++ b/deps/v8/src/compiler/simd-scalar-lowering.cc @@ -116,6 +116,8 @@ void SimdScalarLowering::LowerGraph() { V(F32x4UConvertI32x4) \ V(F32x4Abs) \ V(F32x4Neg) \ + V(F32x4RecipApprox) \ + V(F32x4RecipSqrtApprox) \ V(F32x4Add) \ V(F32x4AddHoriz) \ V(F32x4Sub) \ @@ -182,7 +184,8 @@ void SimdScalarLowering::LowerGraph() { V(I8x16LtS) \ V(I8x16LeS) \ V(I8x16LtU) \ - V(I8x16LeU) + V(I8x16LeU) \ + V(S8x16Shuffle) MachineType SimdScalarLowering::MachineTypeFrom(SimdType simdType) { switch (simdType) { @@ -661,7 +664,7 @@ void SimdScalarLowering::LowerConvertFromFloat(Node* node, bool is_signed) { void SimdScalarLowering::LowerShiftOp(Node* node, SimdType type) { DCHECK_EQ(1, node->InputCount()); - int32_t shift_amount = OpParameter<int32_t>(node); + int32_t shift_amount = OpParameter<int32_t>(node->op()); Node* shift_node = graph()->NewNode(common()->Int32Constant(shift_amount)); Node** rep = GetReplacementsWithType(node->InputAt(0), type); int num_lanes = NumLanes(type); @@ -784,7 +787,7 @@ void SimdScalarLowering::LowerNode(Node* node) { } case IrOpcode::kUnalignedLoad: { MachineRepresentation rep = - UnalignedLoadRepresentationOf(node->op()).representation(); + LoadRepresentationOf(node->op()).representation(); const Operator* load_op; load_op = machine()->UnalignedLoad(MachineTypeFrom(rep_type)); LowerLoadOp(rep, node, load_op, rep_type); @@ -1024,6 +1027,22 @@ void SimdScalarLowering::LowerNode(Node* node) { F32X4_UNOP_CASE(Abs) F32X4_UNOP_CASE(Neg) #undef F32x4_UNOP_CASE + case IrOpcode::kF32x4RecipApprox: + case IrOpcode::kF32x4RecipSqrtApprox: { + DCHECK_EQ(1, node->InputCount()); + Node** rep = GetReplacementsWithType(node->InputAt(0), rep_type); + Node** rep_node = zone()->NewArray<Node*>(num_lanes); + Node* float_one = graph()->NewNode(common()->Float32Constant(1.0)); + for (int i = 0; i < num_lanes; ++i) { + Node* tmp = rep[i]; + if (node->opcode() == IrOpcode::kF32x4RecipSqrtApprox) { + tmp = graph()->NewNode(machine()->Float32Sqrt(), rep[i]); + } + rep_node[i] = graph()->NewNode(machine()->Float32Div(), float_one, tmp); + } + ReplaceNode(node, rep_node, num_lanes); + break; + } case IrOpcode::kF32x4SConvertI32x4: { LowerUnaryOp(node, SimdType::kInt32x4, machine()->RoundInt32ToFloat32()); break; @@ -1051,7 +1070,7 @@ void SimdScalarLowering::LowerNode(Node* node) { case IrOpcode::kF32x4ExtractLane: case IrOpcode::kI16x8ExtractLane: case IrOpcode::kI8x16ExtractLane: { - int32_t lane = OpParameter<int32_t>(node); + int32_t lane = OpParameter<int32_t>(node->op()); Node** rep_node = zone()->NewArray<Node*>(num_lanes); rep_node[0] = GetReplacementsWithType(node->InputAt(0), rep_type)[lane]; for (int i = 1; i < num_lanes; ++i) { @@ -1066,7 +1085,7 @@ void SimdScalarLowering::LowerNode(Node* node) { case IrOpcode::kI8x16ReplaceLane: { DCHECK_EQ(2, node->InputCount()); Node* repNode = node->InputAt(1); - int32_t lane = OpParameter<int32_t>(node); + int32_t lane = OpParameter<int32_t>(node->op()); Node** old_rep_node = GetReplacementsWithType(node->InputAt(0), rep_type); Node** rep_node = zone()->NewArray<Node*>(num_lanes); for (int i = 0; i < num_lanes; ++i) { @@ -1154,6 +1173,24 @@ void SimdScalarLowering::LowerNode(Node* node) { ReplaceNode(node, rep_node, num_lanes); break; } + case IrOpcode::kS8x16Shuffle: { + DCHECK_EQ(2, node->InputCount()); + const uint8_t* shuffle = OpParameter<uint8_t*>(node->op()); + Node** rep_left = GetReplacementsWithType(node->InputAt(0), rep_type); + Node** rep_right = GetReplacementsWithType(node->InputAt(1), rep_type); + Node** rep_node = zone()->NewArray<Node*>(16); + for (int i = 0; i < 16; i++) { + int lane = shuffle[i]; +#if defined(V8_TARGET_BIG_ENDIAN) + rep_node[15 - i] = + lane < 16 ? rep_left[15 - lane] : rep_right[31 - lane]; +#else + rep_node[i] = lane < 16 ? rep_left[lane] : rep_right[lane - 16]; +#endif + } + ReplaceNode(node, rep_node, 16); + break; + } default: { DefaultLowering(node); } } } |