Commit 908274fc authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Fix detection of Simd128 loads/stores in compiler.

This makes sure that the {WasmGraphBuilder} properly detects the
presence of Simd128 loads and store opcodes and triggers then scalar
lowering of the graph on architectures that don't support Simd128.

R=clemensb@chromium.org
TEST=mjsunit/wasm/exceptions-simd
BUG=v8:9973

Change-Id: I118f72135ddc9011efa3f75aaf120bb67e708d8a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1916605Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64964}
parent 6a4bd4c1
......@@ -3724,6 +3724,10 @@ Node* WasmGraphBuilder::LoadTransform(MachineType memtype,
Node* index, uint32_t offset,
uint32_t alignment,
wasm::WasmCodePosition position) {
if (memtype.representation() == MachineRepresentation::kSimd128) {
has_simd_ = true;
}
// Wasm semantics throw on OOB. Introduce explicit bounds check and
// conditioning when not using the trap handler.
index = BoundsCheckMem(wasm::ValueTypes::MemSize(memtype), index, offset,
......@@ -3757,6 +3761,10 @@ Node* WasmGraphBuilder::LoadMem(wasm::ValueType type, MachineType memtype,
wasm::WasmCodePosition position) {
Node* load;
if (memtype.representation() == MachineRepresentation::kSimd128) {
has_simd_ = true;
}
// Wasm semantics throw on OOB. Introduce explicit bounds check and
// conditioning when not using the trap handler.
index = BoundsCheckMem(wasm::ValueTypes::MemSize(memtype), index, offset,
......@@ -3812,6 +3820,10 @@ Node* WasmGraphBuilder::StoreMem(MachineRepresentation mem_rep, Node* index,
wasm::ValueType type) {
Node* store;
if (mem_rep == MachineRepresentation::kSimd128) {
has_simd_ = true;
}
index = BoundsCheckMem(i::ElementSizeInBytes(mem_rep), index, offset,
position, kCanOmitBoundsCheck);
......
......@@ -1392,15 +1392,6 @@ RUNTIME_FUNCTION(Runtime_IsLiftoffFunction) {
return isolate->heap()->ToBoolean(code && code->is_liftoff());
}
// TODO(9973): Replace this runtime function with a true feature testing
// function in "wasm-module-builder.js" that can be used by "mjsunit" to
// determine whether Simd128 is supported on the running architecture.
RUNTIME_FUNCTION(Runtime_WasmSupportsSimd128) {
SealHandleScope shs(isolate);
DCHECK_EQ(0, args.length());
return isolate->heap()->ToBoolean(CpuFeatures::SupportsWasmSimd128());
}
RUNTIME_FUNCTION(Runtime_CompleteInobjectSlackTracking) {
HandleScope scope(isolate);
DCHECK_EQ(1, args.length());
......
......@@ -534,7 +534,6 @@ namespace internal {
F(WasmGetNumberOfInstances, 1, 1) \
F(WasmNumInterpretedCalls, 1, 1) \
F(WasmNumCodeSpaces, 1, 1) \
F(WasmSupportsSimd128, 0, 1) \
F(WasmTierUpFunction, 2, 1) \
F(WasmTraceMemory, 1, 1) \
I(DeoptimizeNow, 0, 1)
......
......@@ -26,7 +26,6 @@ load("test/mjsunit/wasm/exceptions-utils.js");
})();
(function TestThrowCatchS128Default() {
if (!%WasmSupportsSimd128()) return;
print(arguments.callee.name);
var builder = new WasmModuleBuilder();
var kSig_v_s = makeSig([kWasmS128], []);
......@@ -52,7 +51,6 @@ load("test/mjsunit/wasm/exceptions-utils.js");
})();
(function TestThrowCatchS128WithValue() {
if (!%WasmSupportsSimd128()) return;
print(arguments.callee.name);
var builder = new WasmModuleBuilder();
var kSig_v_s = makeSig([kWasmS128], []);
......
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