[wasm-simd] Add overflowing value tests for splats
For I16x8Splat and I8x16Splat, the arguments takes I32, which can hold a value larger than what should be splatted. We add tests to check that the splatted values is the truncated I32 value (top bits masked off). See https://github.com/WebAssembly/simd/pull/151 for the updated to proposal text. Change-Id: Ib32770872e70c7cde2028130d2b44b416594610e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1986200 Reviewed-by: Deepti Gandluri <gdeepti@chromium.org> Commit-Queue: Zhi An Ng <zhin@chromium.org> Cr-Commit-Position: refs/heads/master@{#65642}
This commit is contained in:
parent
c2fcb6d9df
commit
30b4820125
@ -1611,6 +1611,16 @@ WASM_SIMD_TEST(I16x8Splat) {
|
||||
CHECK_EQ(actual, expected);
|
||||
}
|
||||
}
|
||||
|
||||
// Test values that do not fit in a int16.
|
||||
FOR_INT32_INPUTS(x) {
|
||||
r.Call(x);
|
||||
int16_t expected = truncate_to_int16(x);
|
||||
for (int i = 0; i < 8; i++) {
|
||||
int16_t actual = ReadLittleEndianValue<int16_t>(&g[i]);
|
||||
CHECK_EQ(actual, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST(I16x8ReplaceLane) {
|
||||
@ -1660,6 +1670,16 @@ WASM_SIMD_TEST(I8x16Splat) {
|
||||
CHECK_EQ(actual, expected);
|
||||
}
|
||||
}
|
||||
|
||||
// Test values that do not fit in a int16.
|
||||
FOR_INT16_INPUTS(x) {
|
||||
r.Call(x);
|
||||
int8_t expected = truncate_to_int8(x);
|
||||
for (int i = 0; i < 16; i++) {
|
||||
int8_t actual = ReadLittleEndianValue<int8_t>(&g[i]);
|
||||
CHECK_EQ(actual, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST(I8x16ReplaceLane) {
|
||||
|
Loading…
Reference in New Issue
Block a user