Index: src/compiler/wasm-compiler.cc |
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc |
index 619e639e1509a2a73e2e0908bd397869838c08f4..bdaad494603465ec0680aeebddd82b04404e887f 100644 |
--- a/src/compiler/wasm-compiler.cc |
+++ b/src/compiler/wasm-compiler.cc |
@@ -23,6 +23,7 @@ |
#include "src/compiler/machine-operator.h" |
#include "src/compiler/node-matchers.h" |
#include "src/compiler/pipeline.h" |
+#include "src/compiler/simd-lowering.h" |
#include "src/compiler/source-position.h" |
#include "src/compiler/zone-pool.h" |
@@ -610,6 +611,9 @@ Node* WasmGraphBuilder::Binop(wasm::WasmOpcode opcode, Node* left, Node* right, |
return BuildF64Atan2(left, right); |
case wasm::kExprF64Mod: |
return BuildF64Mod(left, right); |
+ case wasm::kExprInt32x4ExtractLane: |
+ return graph()->NewNode(jsgraph()->machine()->Int32x4ExtractLane(), left, |
+ right); |
case wasm::kExprI32AsmjsDivS: |
return BuildI32AsmjsDivS(left, right); |
case wasm::kExprI32AsmjsDivU: |
@@ -865,6 +869,9 @@ Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input, |
return BuildI64UConvertF32(input, position); |
case wasm::kExprI64UConvertF64: |
return BuildI64UConvertF64(input, position); |
+ case wasm::kExprInt32x4Splat: |
+ return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), input, |
+ input, input, input); |
case wasm::kExprI32AsmjsLoadMem8S: |
return BuildAsmjsLoadMem(MachineType::Int8(), input); |
case wasm::kExprI32AsmjsLoadMem8U: |
@@ -2123,6 +2130,12 @@ Node* WasmGraphBuilder::ToJS(Node* node, Node* context, wasm::LocalType type) { |
} |
} |
+Node* WasmGraphBuilder::BuildChangeTaggedToInt32(Node* value) { |
+ value = BuildChangeTaggedToFloat64(value); |
+ value = graph()->NewNode(jsgraph()->machine()->ChangeFloat64ToInt32(), value); |
+ return value; |
+} |
+ |
Node* WasmGraphBuilder::BuildJavaScriptToNumber(Node* node, Node* context, |
Node* effect, Node* control) { |
Callable callable = CodeFactory::ToNumber(jsgraph()->isolate()); |
@@ -2544,6 +2557,12 @@ Node* WasmGraphBuilder::MemSize(uint32_t offset) { |
} |
} |
+Node* WasmGraphBuilder::DefaultS128Value() { |
+ Node* zero = jsgraph()->Int32Constant(0); |
+ return graph()->NewNode(jsgraph()->machine()->CreateInt32x4(), zero, zero, |
+ zero, zero); |
+} |
+ |
Node* WasmGraphBuilder::FunctionTable() { |
DCHECK(module_ && module_->instance && |
!module_->instance->function_table.is_null()); |
@@ -2929,6 +2948,21 @@ std::pair<JSGraph*, SourcePositionTable*> BuildGraphForWasmFunction( |
thrower->Failed(buffer.start(), result); |
return std::make_pair(nullptr, nullptr); |
} |
+ |
+ // Run lowering pass if SIMD ops are present in the function |
+ if (builder.is_simd_function()) { |
+ SimdLowering simd(jsgraph, &builder, module_env->instance->context); |
+ GraphReducer graph_reducer(jsgraph->zone(), jsgraph->graph()); |
+ graph_reducer.AddReducer(&simd); |
+ graph_reducer.ReduceGraph(); |
+ |
+ if (FLAG_trace_turbo_graph) { // Simple textual RPO. |
+ OFStream os(stdout); |
+ os << "-- Graph after simd lowering -- " << std::endl; |
+ os << AsRPO(*graph); |
+ } |
+ } |
+ |
int index = static_cast<int>(function->func_index); |
if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) { |
PrintAst(isolate->allocator(), body); |