[wasm] Fix detection of Simd128 globals in compiler.
This makes sure that the {WasmGraphBuilder} properly detects the presence of Simd128 global.get and global.set opcodes and triggers scalar lowering on architectures without Simd128 support. R=clemensb@chromium.org TEST=cctest/test-run-wasm-simd/RunWasm_S128Globals BUG=v8:9973 Change-Id: I1538bd1d3fea40cc78e82b125d4f113842faf68a Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1917148 Reviewed-by: Clemens Backes <clemensb@chromium.org> Reviewed-by: Deepti Gandluri <gdeepti@chromium.org> Commit-Queue: Michael Starzinger <mstarzinger@chromium.org> Cr-Commit-Position: refs/heads/master@{#65002}
This commit is contained in:
parent
37e6217599
commit
880ca11900
@ -3322,6 +3322,9 @@ Node* WasmGraphBuilder::GlobalGet(uint32_t index) {
|
||||
|
||||
MachineType mem_type =
|
||||
wasm::ValueTypes::MachineTypeFor(env_->module->globals[index].type);
|
||||
if (mem_type.representation() == MachineRepresentation::kSimd128) {
|
||||
has_simd_ = true;
|
||||
}
|
||||
Node* base = nullptr;
|
||||
Node* offset = nullptr;
|
||||
GetGlobalBaseAndOffset(mem_type, env_->module->globals[index], &base,
|
||||
@ -3354,6 +3357,9 @@ Node* WasmGraphBuilder::GlobalSet(uint32_t index, Node* val) {
|
||||
|
||||
MachineType mem_type =
|
||||
wasm::ValueTypes::MachineTypeFor(env_->module->globals[index].type);
|
||||
if (mem_type.representation() == MachineRepresentation::kSimd128) {
|
||||
has_simd_ = true;
|
||||
}
|
||||
Node* base = nullptr;
|
||||
Node* offset = nullptr;
|
||||
GetGlobalBaseAndOffset(mem_type, env_->module->globals[index], &base,
|
||||
|
@ -526,6 +526,26 @@ bool IsExtreme(float x) {
|
||||
(abs_x < kSmallFloatThreshold || abs_x > kLargeFloatThreshold);
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST(S128Globals) {
|
||||
WasmRunner<int32_t> r(execution_tier, lower_simd);
|
||||
// Set up a global to hold input and output vectors.
|
||||
int32_t* g0 = r.builder().AddGlobal<int32_t>(kWasmS128);
|
||||
int32_t* g1 = r.builder().AddGlobal<int32_t>(kWasmS128);
|
||||
BUILD(r, WASM_SET_GLOBAL(1, WASM_GET_GLOBAL(0)), WASM_ONE);
|
||||
|
||||
FOR_INT32_INPUTS(x) {
|
||||
for (int i = 0; i < 4; i++) {
|
||||
WriteLittleEndianValue<int32_t>(&g0[i], x);
|
||||
}
|
||||
r.Call();
|
||||
int32_t expected = x;
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int32_t actual = ReadLittleEndianValue<int32_t>(&g1[i]);
|
||||
CHECK_EQ(actual, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WASM_SIMD_TEST(F32x4Splat) {
|
||||
WasmRunner<int32_t, float> r(execution_tier, lower_simd);
|
||||
// Set up a global to hold output vector.
|
||||
|
Loading…
Reference in New Issue
Block a user