Commit 4454b8fe authored by Deepti Gandluri's avatar Deepti Gandluri Committed by Commit Bot

[wasm-simd] Add a decode failure if hardware does not support SIMD

 - Add a no-simd-sse flag to skip SIMD tests on bots with no
hardware support.

Change-Id: I4efdbb5ee39c2e10ea8776a1f1e536ac96823efe
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2629465
Commit-Queue: Deepti Gandluri <gdeepti@chromium.org>
Reviewed-by: 's avatarZhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72682}
parent db22042e
......@@ -3233,6 +3233,10 @@ class WasmFullDecoder : public WasmDecoder<validate> {
DECODE(Simd) {
CHECK_PROTOTYPE_OPCODE(simd);
if (!CheckHardwareSupportsSimd()) {
this->DecodeError("Wasm SIMD unsupported");
return 0;
}
uint32_t opcode_length = 0;
WasmOpcode full_opcode = this->template read_prefixed_opcode<validate>(
this->pc_, &opcode_length);
......
......@@ -4,6 +4,7 @@
#include "src/wasm/function-body-decoder.h"
#include "src/codegen/assembler-inl.h"
#include "src/flags/flags.h"
#include "src/handles/handles.h"
#include "src/objects/objects-inl.h"
......@@ -71,6 +72,8 @@ unsigned OpcodeLength(const byte* pc, const byte* end) {
return WasmDecoder<Decoder::kNoValidation>::OpcodeLength(&decoder, pc);
}
bool CheckHardwareSupportsSimd() { return CpuFeatures::SupportsWasmSimd128(); }
std::pair<uint32_t, uint32_t> StackEffect(const WasmModule* module,
const FunctionSig* sig,
const byte* pc, const byte* end) {
......
......@@ -86,6 +86,9 @@ V8_EXPORT_PRIVATE std::pair<uint32_t, uint32_t> StackEffect(
const WasmModule* module, const FunctionSig* sig, const byte* pc,
const byte* end);
// Checks if the underlying hardware supports the Wasm SIMD proposal.
V8_EXPORT_PRIVATE bool CheckHardwareSupportsSimd();
// A simple forward iterator for bytecodes.
class V8_EXPORT_PRIVATE BytecodeIterator : public NON_EXPORTED_BASE(Decoder) {
// Base class for both iterators defined below.
......
......@@ -679,4 +679,11 @@
'*': [SKIP], # only relevant for mjsunit tests.
}],
##############################################################################
['no_simd_sse == True', {
'test-run-wasm-simd/*': [SKIP],
'test-run-wasm-simd-liftoff/*': [SKIP],
'test-run-wasm-simd-scalar-lowering/*': [SKIP],
}], # no_simd_sse == True
]
......@@ -4,6 +4,7 @@
// Flags: --no-stress-opt --trace-wasm-memory --no-liftoff
// Flags: --experimental-wasm-simd
// Flags: --enable-sse3 --enable-sse4-1
load("test/mjsunit/wasm/wasm-module-builder.js");
......
......@@ -1422,4 +1422,26 @@
'wasm/shared-memory-worker-stress': [PASS, SLOW, ['tsan', SKIP]],
}], # variant == stress_incremental_marking
##############################################################################
['no_simd_sse == True', {
'wasm/exceptions-simd': [SKIP],
'wasm/liftoff-simd-params': [SKIP],
'wasm/multi-value-simd': [SKIP],
'wasm/simd-*': [SKIP],
'regress/wasm/regress-10309': [SKIP],
'regress/wasm/regress-10831': [SKIP],
'regress/wasm/regress-1054466': [SKIP],
'regress/wasm/regress-1065599': [SKIP],
'regress/wasm/regress-1070078': [SKIP],
'regress/wasm/regress-1081030': [SKIP],
'regress/wasm/regress-1111522': [SKIP],
'regress/wasm/regress-1112124': [SKIP],
'regress/wasm/regress-1116019': [SKIP],
'regress/wasm/regress-1124885': [SKIP],
'regress/wasm/regress-1132461': [SKIP],
'regress/wasm/regress-1161555': [SKIP],
'regress/wasm/regress-1161954': [SKIP],
'regress/wasm/regress-1165966': [SKIP],
}], # no_simd_sse == True
]
......@@ -208,4 +208,9 @@
'*': [SKIP], # only relevant for mjsunit tests.
}],
##############################################################################
['no_simd_sse == True', {
'proposals/simd/*': [SKIP],
}], # no_simd_sse == True
]
......@@ -632,6 +632,14 @@ class BaseTestRunner(object):
self.build_config.arch in ['mipsel', 'mips', 'mips64', 'mips64el'] and
self.build_config.mips_arch_variant)
no_simd_sse = any(
i in options.extra_flags for i in ['--noenable-sse3',
'--no-enable-sse3'
'--noenable-ssse3',
'--no-enable-ssse3',
'--noenable-sse4-1',
'--no-enable-sse4_1'])
return {
"arch": self.build_config.arch,
"asan": self.build_config.asan,
......@@ -652,6 +660,7 @@ class BaseTestRunner(object):
"msan": self.build_config.msan,
"no_harness": options.no_harness,
"no_i18n": self.build_config.no_i18n,
"no_simd_sse": no_simd_sse,
"novfp3": False,
"optimize_for_size": "--optimize-for-size" in options.extra_flags,
"predictable": self.build_config.predictable,
......
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