Commit 8fc10b5a authored by Aseem Garg's avatar Aseem Garg Committed by Commit Bot

[wasm] Re-enable Simd lowering tests for wasm

This adds a new simd lowering execution mode for
simd and re-enables the lowering tests

R=titzer@chromium.org,gdeepti@chromium.org,bbudge@chromium.org,mtrofin@chromium.org
BUG=v8:6020

Change-Id: Ice6b7ff2f5973804d379c88241d49b811429a965
Reviewed-on: https://chromium-review.googlesource.com/698928
Commit-Queue: Aseem Garg <aseemgarg@chromium.org>
Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Reviewed-by: 's avatarBill Budge <bbudge@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48322}
parent ca81e114
......@@ -4619,7 +4619,8 @@ SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction(
builder.LowerInt64();
if (builder.has_simd() && !CpuFeatures::SupportsWasmSimd128()) {
if (builder.has_simd() &&
(!CpuFeatures::SupportsWasmSimd128() || lower_simd_)) {
SimdScalarLowering(jsgraph_, func_body_.sig).LowerGraph();
}
......@@ -4656,7 +4657,8 @@ Vector<const char> GetDebugName(Zone* zone, wasm::WasmName name, int index) {
WasmCompilationUnit::WasmCompilationUnit(
Isolate* isolate, ModuleEnv* env, wasm::FunctionBody body,
wasm::WasmName name, int index, Handle<Code> centry_stub,
Counters* counters, RuntimeExceptionSupport exception_support)
Counters* counters, RuntimeExceptionSupport exception_support,
bool lower_simd)
: isolate_(isolate),
env_(env),
func_body_(body),
......@@ -4664,7 +4666,8 @@ WasmCompilationUnit::WasmCompilationUnit(
counters_(counters ? counters : isolate->counters()),
centry_stub_(centry_stub),
func_index_(index),
runtime_exception_support_(exception_support) {}
runtime_exception_support_(exception_support),
lower_simd_(lower_simd) {}
void WasmCompilationUnit::ExecuteCompilation() {
auto timed_histogram = env_->module->is_wasm()
......
......@@ -88,7 +88,8 @@ class WasmCompilationUnit final {
// only allowed to happen on the foreground thread.
WasmCompilationUnit(Isolate*, ModuleEnv*, wasm::FunctionBody, wasm::WasmName,
int index, Handle<Code> centry_stub, Counters* = nullptr,
RuntimeExceptionSupport = kRuntimeExceptionSupport);
RuntimeExceptionSupport = kRuntimeExceptionSupport,
bool lower_simd = false);
int func_index() const { return func_index_; }
......@@ -105,6 +106,7 @@ class WasmCompilationUnit final {
private:
SourcePositionTable* BuildGraphForWasmFunction(double* decode_ms);
Counters* counters() { return counters_; }
Isolate* isolate_;
ModuleEnv* env_;
......@@ -127,8 +129,7 @@ class WasmCompilationUnit final {
RuntimeExceptionSupport runtime_exception_support_;
bool ok_ = true;
size_t memory_cost_ = 0;
Counters* counters() { return counters_; }
bool lower_simd_;
DISALLOW_COPY_AND_ASSIGN(WasmCompilationUnit);
};
......
This diff is collapsed.
......@@ -22,7 +22,8 @@ TestingModuleBuilder::TestingModuleBuilder(
mem_start_(nullptr),
mem_size_(0),
interpreter_(nullptr),
runtime_exception_support_(exception_support) {
runtime_exception_support_(exception_support),
lower_simd_(mode == kExecuteSimdLowered) {
WasmJs::Install(isolate_, true);
test_module_.globals_size = kMaxGlobalsSize;
memset(globals_data_, 0, sizeof(globals_data_));
......@@ -429,7 +430,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
compiler::WasmCompilationUnit unit(
isolate(), &module_env, func_body, func_name, function_->func_index,
CEntryStub(isolate(), 1).GetCode(), isolate()->counters(),
builder_->runtime_exception_support());
builder_->runtime_exception_support(), builder_->lower_simd());
unit.ExecuteCompilation();
Handle<Code> code = unit.FinishCompilation(&thrower).ToHandleChecked();
CHECK(!thrower.error());
......
......@@ -47,7 +47,11 @@ namespace wasm {
constexpr uint32_t kMaxFunctions = 10;
constexpr uint32_t kMaxGlobalsSize = 128;
enum WasmExecutionMode { kExecuteInterpreted, kExecuteCompiled };
enum WasmExecutionMode {
kExecuteInterpreted,
kExecuteCompiled,
kExecuteSimdLowered
};
using compiler::CallDescriptor;
using compiler::MachineTypeForC;
......@@ -187,6 +191,7 @@ class TestingModuleBuilder {
WasmInterpreter* interpreter() { return interpreter_; }
bool interpret() { return interpreter_ != nullptr; }
bool lower_simd() { return lower_simd_; }
Isolate* isolate() { return isolate_; }
Handle<WasmInstanceObject> instance_object() { return instance_object_; }
Handle<Code> GetFunctionCode(int index) { return function_code_[index]; }
......@@ -215,6 +220,7 @@ class TestingModuleBuilder {
WasmInterpreter* interpreter_;
Handle<WasmInstanceObject> instance_object_;
compiler::RuntimeExceptionSupport runtime_exception_support_;
bool lower_simd_;
const WasmGlobal* AddGlobal(ValueType type);
......
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