diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/src/compiler/simd-scalar-lowering.cc | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/src/compiler/simd-scalar-lowering.cc')
-rw-r--r-- | chromium/v8/src/compiler/simd-scalar-lowering.cc | 95 |
1 files changed, 74 insertions, 21 deletions
diff --git a/chromium/v8/src/compiler/simd-scalar-lowering.cc b/chromium/v8/src/compiler/simd-scalar-lowering.cc index 21d34b21d25..82ccc463261 100644 --- a/chromium/v8/src/compiler/simd-scalar-lowering.cc +++ b/chromium/v8/src/compiler/simd-scalar-lowering.cc @@ -142,12 +142,13 @@ void SimdScalarLowering::LowerGraph() { V(S128Or) \ V(S128Xor) \ V(S128Not) \ - V(S1x4AnyTrue) \ - V(S1x4AllTrue) \ - V(S1x8AnyTrue) \ - V(S1x8AllTrue) \ - V(S1x16AnyTrue) \ - V(S1x16AllTrue) + V(V32x4AnyTrue) \ + V(V32x4AllTrue) \ + V(V16x8AnyTrue) \ + V(V16x8AllTrue) \ + V(V8x16AnyTrue) \ + V(V8x16AllTrue) \ + V(I32x4BitMask) #define FOREACH_FLOAT64X2_OPCODE(V) V(F64x2Splat) @@ -212,7 +213,8 @@ void SimdScalarLowering::LowerGraph() { V(I16x8LtU) \ V(I16x8LeU) \ V(I16x8RoundingAverageU) \ - V(I16x8Abs) + V(I16x8Abs) \ + V(I16x8BitMask) #define FOREACH_INT8X16_OPCODE(V) \ V(I8x16Splat) \ @@ -245,7 +247,8 @@ void SimdScalarLowering::LowerGraph() { V(S8x16Swizzle) \ V(S8x16Shuffle) \ V(I8x16RoundingAverageU) \ - V(I8x16Abs) + V(I8x16Abs) \ + V(I8x16BitMask) MachineType SimdScalarLowering::MachineTypeFrom(SimdType simdType) { switch (simdType) { @@ -1025,6 +1028,44 @@ void SimdScalarLowering::LowerNotEqual(Node* node, SimdType input_rep_type, ReplaceNode(node, rep_node, num_lanes); } +void SimdScalarLowering::LowerBitMaskOp(Node* node, SimdType rep_type, + int msb_index) { + Node** reps = GetReplacementsWithType(node->InputAt(0), rep_type); + int num_lanes = NumLanes(rep_type); + Node** rep_node = zone()->NewArray<Node*>(1); + Node* result = mcgraph_->Int32Constant(0); + uint32_t mask = 1 << msb_index; + + for (int i = 0; i < num_lanes; ++i) { + // Lane i should end up at bit i in the final result. + // +-----------------------------------------------------------------+ + // | | msb_index | (i < msb_index) | (i > msb_index) | + // +-------+-----------+----------------------+----------------------+ + // | i8x16 | 7 | msb >> (msb_index-i) | msb << (i-msb_index) | + // | i16x8 | 15 | msb >> (msb_index-i) | n/a | + // | i32x4 | 31 | msb >> (msb_index-i) | n/a | + // +-------+-----------+----------------------+----------------------+ + Node* msb = Mask(reps[i], mask); + + if (i < msb_index) { + int shift = msb_index - i; + Node* shifted = graph()->NewNode(machine()->Word32Shr(), msb, + mcgraph_->Int32Constant(shift)); + result = graph()->NewNode(machine()->Word32Or(), shifted, result); + } else if (i > msb_index) { + int shift = i - msb_index; + Node* shifted = graph()->NewNode(machine()->Word32Shl(), msb, + mcgraph_->Int32Constant(shift)); + result = graph()->NewNode(machine()->Word32Or(), shifted, result); + } else { + result = graph()->NewNode(machine()->Word32Or(), msb, result); + } + } + + rep_node[0] = result; + ReplaceNode(node, rep_node, 1); +} + void SimdScalarLowering::LowerNode(Node* node) { SimdType rep_type = ReplacementType(node); int num_lanes = NumLanes(rep_type); @@ -1627,12 +1668,12 @@ void SimdScalarLowering::LowerNode(Node* node) { ReplaceNode(node, rep_node, 16); break; } - case IrOpcode::kS1x4AnyTrue: - case IrOpcode::kS1x4AllTrue: - case IrOpcode::kS1x8AnyTrue: - case IrOpcode::kS1x8AllTrue: - case IrOpcode::kS1x16AnyTrue: - case IrOpcode::kS1x16AllTrue: { + case IrOpcode::kV32x4AnyTrue: + case IrOpcode::kV32x4AllTrue: + case IrOpcode::kV16x8AnyTrue: + case IrOpcode::kV16x8AllTrue: + case IrOpcode::kV8x16AnyTrue: + case IrOpcode::kV8x16AllTrue: { DCHECK_EQ(1, node->InputCount()); SimdType input_rep_type = ReplacementType(node->InputAt(0)); Node** rep; @@ -1649,18 +1690,18 @@ void SimdScalarLowering::LowerNode(Node* node) { Node* true_node = mcgraph_->Int32Constant(1); Node* false_node = mcgraph_->Int32Constant(0); Node* tmp_result = false_node; - if (node->opcode() == IrOpcode::kS1x4AllTrue || - node->opcode() == IrOpcode::kS1x8AllTrue || - node->opcode() == IrOpcode::kS1x16AllTrue) { + if (node->opcode() == IrOpcode::kV32x4AllTrue || + node->opcode() == IrOpcode::kV16x8AllTrue || + node->opcode() == IrOpcode::kV8x16AllTrue) { tmp_result = true_node; } for (int i = 0; i < input_num_lanes; ++i) { Diamond is_false( graph(), common(), graph()->NewNode(machine()->Word32Equal(), rep[i], false_node)); - if (node->opcode() == IrOpcode::kS1x4AllTrue || - node->opcode() == IrOpcode::kS1x8AllTrue || - node->opcode() == IrOpcode::kS1x16AllTrue) { + if (node->opcode() == IrOpcode::kV32x4AllTrue || + node->opcode() == IrOpcode::kV16x8AllTrue || + node->opcode() == IrOpcode::kV8x16AllTrue) { tmp_result = is_false.Phi(MachineRepresentation::kWord32, false_node, tmp_result); } else { @@ -1675,6 +1716,18 @@ void SimdScalarLowering::LowerNode(Node* node) { ReplaceNode(node, rep_node, num_lanes); break; } + case IrOpcode::kI8x16BitMask: { + LowerBitMaskOp(node, rep_type, 7); + break; + } + case IrOpcode::kI16x8BitMask: { + LowerBitMaskOp(node, rep_type, 15); + break; + } + case IrOpcode::kI32x4BitMask: { + LowerBitMaskOp(node, rep_type, 31); + break; + } case IrOpcode::kI8x16RoundingAverageU: case IrOpcode::kI16x8RoundingAverageU: { DCHECK_EQ(2, node->InputCount()); @@ -1707,7 +1760,7 @@ bool SimdScalarLowering::DefaultLowering(Node* node) { something_changed = true; node->ReplaceInput(i, GetReplacements(input)[0]); } - if (HasReplacement(1, input)) { + if (ReplacementCount(input) > 1 && HasReplacement(1, input)) { something_changed = true; for (int j = 1; j < ReplacementCount(input); ++j) { node->InsertInput(zone(), i + j, GetReplacements(input)[j]); |