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

[wasm-simd][scalar-lowering] Set lowered types for S128Select S128AndNot

S128Select and S128AndNot relies on the inputs being lowered to I32x4,
since they use Word32Xor, but it wasn't correctly specified. This means
that by default, their lowered type was set to be the output's lowered
type. If the result of these operations were used by F32x4ExtractLane,
then their lowered type will be set to Float32x4, so the inputs will be
lowered to Float32x4, and we get incorrect type of registers allocated.

Bug: v8:10507
Change-Id: I16dc7f2dcdaf2188997ff345a6b0fd22e10b7b36
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2536953Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#71214}
parent 639783de
......@@ -159,6 +159,8 @@ void SimdScalarLowering::LowerGraph() {
V(S128Or) \
V(S128Xor) \
V(S128Not) \
V(S128AndNot) \
V(S128Select) \
V(V32x4AnyTrue) \
V(V32x4AllTrue) \
V(V16x8AnyTrue) \
......
......@@ -288,6 +288,26 @@ WASM_SIMD_TEST(I8x16WidenS_I16x8NarrowU) {
}
}
WASM_SIMD_TEST(S128SelectWithF32x4) {
WasmRunner<float, int32_t, float, int32_t> r(execution_tier, lower_simd);
BUILD(r, WASM_GET_LOCAL(0), WASM_SIMD_OP(kExprI32x4Splat), WASM_GET_LOCAL(1),
WASM_SIMD_OP(kExprF32x4Splat), WASM_GET_LOCAL(2),
WASM_SIMD_OP(kExprI32x4Splat), WASM_SIMD_OP(kExprS128Select),
WASM_SIMD_OP(kExprF32x4ExtractLane), 0);
// Selection mask is all 0, so always select 2.0.
CHECK_EQ(2.0, r.Call(1, 2.0, 0));
}
WASM_SIMD_TEST(S128AndNotWithF32x4) {
WasmRunner<float, int32_t, float> r(execution_tier, lower_simd);
BUILD(r, WASM_GET_LOCAL(0), WASM_SIMD_OP(kExprI32x4Splat), WASM_GET_LOCAL(1),
WASM_SIMD_OP(kExprF32x4Splat), WASM_SIMD_OP(kExprS128AndNot),
WASM_SIMD_OP(kExprF32x4ExtractLane), 0);
// 0x00700000 & !0x40800000 = 0x00700000
CHECK_EQ(bit_cast<float>(0x700000),
r.Call(0x00700000, bit_cast<float>(0x40800000)));
}
} // namespace test_run_wasm_simd
} // namespace wasm
} // namespace internal
......
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