[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/+/2429807
Reviewed-by: Bill Budge <bbudge@chromium.org>
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70128}
This commit is contained in:
Ng Zhi An 2020-09-24 14:10:59 -07:00 committed by Commit Bot
parent 1474e595cf
commit 4157728312
3 changed files with 32 additions and 4 deletions

View File

@ -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();
}

View File

@ -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

View File

@ -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],