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

[wasm-simd][scalar-lowering] Implement more replacement conversions

f32x4->16x8, 64x2->8x16, and 16x8->8x16.
This allows us to pass more spec tests.

Bug: v8:10507
Change-Id: I1810ce2d17f93529b2e69cf5c767cb7b480b4b49
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2429807Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70128}
parent 1474e595
......@@ -2338,13 +2338,23 @@ Node** SimdScalarLowering::GetReplacementsWithType(Node* node, SimdType type) {
if (ReplacementType(node) == SimdType::kInt32x4) {
Int32ToSmallerInt<int16_t>(replacements, result);
} else if (ReplacementType(node) == SimdType::kFloat32x4) {
UNIMPLEMENTED();
Node** float32_to_int32 = zone()->NewArray<Node*>(kNumLanes32);
Float32ToInt32(replacements, float32_to_int32);
Int32ToSmallerInt<int16_t>(float32_to_int32, result);
} else {
UNREACHABLE();
}
} else if (type == SimdType::kInt8x16) {
if (ReplacementType(node) == SimdType::kInt32x4) {
if (ReplacementType(node) == SimdType::kInt64x2) {
Node** int64_to_int32 = zone()->NewArray<Node*>(kNumLanes32);
Int64ToInt32(replacements, int64_to_int32);
Int32ToSmallerInt<int8_t>(int64_to_int32, result);
} else if (ReplacementType(node) == SimdType::kInt32x4) {
Int32ToSmallerInt<int8_t>(replacements, result);
} else if (ReplacementType(node) == SimdType::kInt16x8) {
Node** int16_to_int32 = zone()->NewArray<Node*>(kNumLanes32);
SmallerIntToInt32<int16_t>(replacements, int16_to_int32);
Int32ToSmallerInt<int8_t>(int16_to_int32, result);
} else {
UNIMPLEMENTED();
}
......
......@@ -206,6 +206,16 @@ WASM_SIMD_TEST(AllTrue_DifferentShapes) {
CHECK_EQ(0, r.Call(0x000000FF));
}
// Check float input to all_true.
{
WasmRunner<int32_t, float> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(0)),
WASM_SIMD_OP(kExprV16x8AllTrue));
CHECK_EQ(1, r.Call(0x000F000F));
}
}
WASM_SIMD_TEST(AnyTrue_DifferentShapes) {
......@@ -227,6 +237,16 @@ WASM_SIMD_TEST(AnyTrue_DifferentShapes) {
CHECK_EQ(1, r.Call(0x000000FF));
}
// Check float input to any_true.
{
WasmRunner<int32_t, float> r(execution_tier, lower_simd);
BUILD(r, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(0)),
WASM_SIMD_OP(kExprV8x16AnyTrue));
CHECK_EQ(0, r.Call(0x00000000));
}
}
} // namespace test_run_wasm_simd
......
......@@ -40,10 +40,8 @@
# SIMD test cases
# Scalar lowering is incomplete, we skip these and selectively enable as
# we finish the implementation, see v8:10507.
'proposals/simd/simd_bit_shift' : [PASS, FAIL],
'proposals/simd/simd_conversions' : [PASS, FAIL],
'proposals/simd/simd_lane' : [PASS, FAIL],
'proposals/simd/simd_load_extend' : [PASS, FAIL],
'proposals/simd/simd_load_splat' : [PASS, FAIL],
'proposals/simd/simd_splat' : [PASS, FAIL],
......
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