Commit d16003da authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

[wasm-simd][scalar-lowering] Fix anytrue lowering

The lowering for anytrue was assuming that the input nodes are all
integers. The regression test added in https://crrev.com/c/2194471 calls
anytrue with float operands, this was causing the lowering to generate
cmpl instructions with a float register and an immediate, which is
wrong.

The fix is to use GetReplacementsWithType on the input nodes, but
only if the input were floats, since we use Word32Equal.

Drive-by clean up of comments in the aforementioned regression test.

Bug: v8:10535
Change-Id: I4de89516c178e9003a4c745808d831be87918381
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2203400
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#67878}
parent 671c2fda
......@@ -1635,8 +1635,16 @@ void SimdScalarLowering::LowerNode(Node* node) {
case IrOpcode::kS1x16AllTrue: {
DCHECK_EQ(1, node->InputCount());
SimdType input_rep_type = ReplacementType(node->InputAt(0));
Node** rep;
// If the input is a SIMD float, bitcast it to a SIMD int of the same
// shape, because the comparisons below use Word32.
if (input_rep_type == SimdType::kFloat32x4) {
// TODO(v8:9418): f64x2 lowering is not implemented yet.
rep = GetReplacementsWithType(node->InputAt(0), SimdType::kInt32x4);
} else {
rep = GetReplacements(node->InputAt(0));
}
int input_num_lanes = NumLanes(input_rep_type);
Node** rep = GetReplacements(node->InputAt(0));
Node** rep_node = zone()->NewArray<Node*>(num_lanes);
Node* true_node = mcgraph_->Int32Constant(1);
Node* false_node = mcgraph_->Int32Constant(0);
......
......@@ -13,9 +13,9 @@ builder.addFunction(undefined, 0 /* sig */).addBodyWithEnd([
// signature: i_iii
// body:
kExprF32Const, 0xf8, 0xf8, 0xf8, 0xf8,
kSimdPrefix, kExprF32x4Splat, // i8x16.splat
kSimdPrefix, kExprF32x4Splat, // f32x4.splat
kExprF32Const, 0xf8, 0xf8, 0xf8, 0xf8,
kSimdPrefix, kExprF32x4Splat, // i8x16.splat
kSimdPrefix, kExprF32x4Splat, // f32x4.splat
kSimdPrefix, kExprF32x4Min, 0x01, // f32x4.min
kSimdPrefix, kExprS1x4AnyTrue, 0x01, // s1x4.any_true
kExprEnd, // end @16
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment