Index: test/cctest/wasm/test-run-wasm-simd-lowering.cc |
diff --git a/test/cctest/wasm/test-run-wasm-simd-lowering.cc b/test/cctest/wasm/test-run-wasm-simd-lowering.cc |
index 4372c3ea02323e5eae3cc8cfa8b6fd617d95bdcf..4d49f5aee1b97f66f802027c264fc5e3e8791c40 100644 |
--- a/test/cctest/wasm/test-run-wasm-simd-lowering.cc |
+++ b/test/cctest/wasm/test-run-wasm-simd-lowering.cc |
@@ -17,7 +17,7 @@ |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Splat) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
BUILD(r, |
WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(5)))); |
FOR_INT32_INPUTS(i) { CHECK_EQ(5, r.Call()); } |
@@ -25,7 +25,7 @@ |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Add) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
BUILD(r, WASM_SIMD_I32x4_EXTRACT_LANE( |
0, WASM_SIMD_I32x4_ADD(WASM_SIMD_I32x4_SPLAT(WASM_I32V(5)), |
WASM_SIMD_I32x4_SPLAT(WASM_I32V(6))))); |
@@ -34,7 +34,7 @@ |
WASM_EXEC_COMPILED_TEST(Simd_F32x4_Splat) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
BUILD(r, |
WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( |
0, WASM_SIMD_F32x4_SPLAT(WASM_F32(9.5))), |
@@ -45,7 +45,7 @@ |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Extract_With_F32x4) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
BUILD(r, |
WASM_IF_ELSE(WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE( |
0, WASM_SIMD_F32x4_SPLAT(WASM_F32(30.5))), |
@@ -56,7 +56,7 @@ |
WASM_EXEC_COMPILED_TEST(Simd_F32x4_Extract_With_I32x4) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
BUILD(r, |
WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( |
0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(15))), |
@@ -67,7 +67,7 @@ |
WASM_EXEC_COMPILED_TEST(Simd_F32x4_Add_With_I32x4) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
BUILD(r, |
WASM_IF_ELSE( |
WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( |
@@ -82,7 +82,7 @@ |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Add_With_F32x4) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
BUILD(r, |
WASM_IF_ELSE( |
WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE( |
@@ -97,39 +97,39 @@ |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Local) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
- r.AllocateLocal(kAstS128); |
- BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
+ r.AllocateLocal(kAstS128); |
+ BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
WASM_RETURN1( |
- WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(0))))); |
+ WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(1))))); |
FOR_INT32_INPUTS(i) { CHECK_EQ(31, r.Call()); } |
} |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Replace_Lane) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
r.AllocateLocal(kAstS128); |
BUILD(r, |
WASM_BLOCK( |
- WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
- WASM_SET_LOCAL(0, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(0), |
+ WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
+ WASM_SET_LOCAL(1, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(1), |
WASM_I32V(53))), |
- WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(0))))); |
+ WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(1))))); |
FOR_INT32_INPUTS(i) { CHECK_EQ(53, r.Call()); } |
} |
WASM_EXEC_COMPILED_TEST(Simd_F32x4_Replace_Lane) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
r.AllocateLocal(kAstF32); |
r.AllocateLocal(kAstS128); |
BUILD(r, WASM_BLOCK( |
- WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(23.5))), |
- WASM_SET_LOCAL(1, WASM_SIMD_F32x4_REPLACE_LANE( |
- 3, WASM_GET_LOCAL(1), WASM_F32(65.25))), |
+ WASM_SET_LOCAL(2, WASM_SIMD_F32x4_SPLAT(WASM_F32(23.5))), |
+ WASM_SET_LOCAL(2, WASM_SIMD_F32x4_REPLACE_LANE( |
+ 3, WASM_GET_LOCAL(2), WASM_F32(65.25))), |
WASM_SET_LOCAL( |
- 0, WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1))), |
- WASM_IF(WASM_F32_EQ(WASM_GET_LOCAL(0), WASM_F32(65.25)), |
+ 1, WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(2))), |
+ WASM_IF(WASM_F32_EQ(WASM_GET_LOCAL(1), WASM_F32(65.25)), |
WASM_RETURN1(WASM_I32V(1))), |
WASM_RETURN1(WASM_I32V(0)))); |
FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } |
@@ -137,26 +137,27 @@ |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Splat_From_Extract) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
r.AllocateLocal(kAstI32); |
r.AllocateLocal(kAstS128); |
BUILD(r, |
WASM_BLOCK( |
- WASM_SET_LOCAL(0, WASM_SIMD_I32x4_EXTRACT_LANE( |
+ WASM_SET_LOCAL(1, WASM_SIMD_I32x4_EXTRACT_LANE( |
0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(76)))), |
- WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0))), |
- WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_LOCAL(1))))); |
+ WASM_SET_LOCAL(2, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(1))), |
+ WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_LOCAL(2))))); |
FOR_INT32_INPUTS(i) { CHECK_EQ(76, r.Call()); } |
} |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Get_Global) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
- int32_t* global = r.module().AddGlobal<int32_t>(kAstS128); |
+ TestingModule module(kExecuteCompiled); |
+ int32_t* global = module.AddGlobal<int32_t>(kAstS128); |
*(global) = 0; |
*(global + 1) = 1; |
*(global + 2) = 2; |
*(global + 3) = 3; |
+ WasmRunner<int32_t> r(&module, MachineType::Int32()); |
r.AllocateLocal(kAstI32); |
BUILD(r, WASM_BLOCK( |
WASM_SET_LOCAL(1, WASM_I32V(1)), |
@@ -178,8 +179,9 @@ |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_Set_Global) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
- int32_t* global = r.module().AddGlobal<int32_t>(kAstS128); |
+ TestingModule module(kExecuteCompiled); |
+ int32_t* global = module.AddGlobal<int32_t>(kAstS128); |
+ WasmRunner<int32_t> r(&module, MachineType::Int32()); |
BUILD(r, WASM_BLOCK( |
WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(23))), |
WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE( |
@@ -198,12 +200,13 @@ |
WASM_EXEC_COMPILED_TEST(Simd_F32x4_Get_Global) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
- float* global = r.module().AddGlobal<float>(kAstS128); |
+ TestingModule module(kExecuteCompiled); |
+ float* global = module.AddGlobal<float>(kAstS128); |
*(global) = 0.0; |
*(global + 1) = 1.5; |
*(global + 2) = 2.25; |
*(global + 3) = 3.5; |
+ WasmRunner<int32_t> r(&module, MachineType::Int32()); |
r.AllocateLocal(kAstI32); |
BUILD(r, WASM_BLOCK( |
WASM_SET_LOCAL(1, WASM_I32V(1)), |
@@ -225,8 +228,9 @@ |
WASM_EXEC_COMPILED_TEST(Simd_F32x4_Set_Global) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
- float* global = r.module().AddGlobal<float>(kAstS128); |
+ TestingModule module(kExecuteCompiled); |
+ float* global = module.AddGlobal<float>(kAstS128); |
+ WasmRunner<int32_t> r(&module, MachineType::Int32()); |
BUILD(r, WASM_BLOCK( |
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))), |
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE( |
@@ -245,69 +249,69 @@ |
WASM_EXEC_COMPILED_TEST(Simd_I32x4_For) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
r.AllocateLocal(kAstI32); |
r.AllocateLocal(kAstS128); |
BUILD( |
r, |
WASM_BLOCK( |
- WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
- WASM_SET_LOCAL(1, WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GET_LOCAL(1), |
+ WASM_SET_LOCAL(2, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
+ WASM_SET_LOCAL(2, WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GET_LOCAL(2), |
WASM_I32V(53))), |
- WASM_SET_LOCAL(1, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(1), |
+ WASM_SET_LOCAL(2, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(2), |
WASM_I32V(23))), |
- WASM_SET_LOCAL(0, WASM_I32V(0)), |
- WASM_LOOP(WASM_SET_LOCAL(1, WASM_SIMD_I32x4_ADD( |
- WASM_GET_LOCAL(1), |
+ WASM_SET_LOCAL(1, WASM_I32V(0)), |
+ WASM_LOOP(WASM_SET_LOCAL(2, WASM_SIMD_I32x4_ADD( |
+ WASM_GET_LOCAL(2), |
WASM_SIMD_I32x4_SPLAT(WASM_I32V(1)))), |
- WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(0), WASM_I32V(5)), |
+ WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(1), WASM_I32V(5)), |
WASM_BR(1))), |
- WASM_SET_LOCAL(0, WASM_I32V(1)), |
+ WASM_SET_LOCAL(1, WASM_I32V(1)), |
WASM_IF( |
- WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(1)), |
+ WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(2)), |
WASM_I32V(36)), |
- WASM_SET_LOCAL(0, WASM_I32V(0))), |
+ WASM_SET_LOCAL(1, WASM_I32V(0))), |
WASM_IF( |
- WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_LOCAL(1)), |
+ WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_LOCAL(2)), |
WASM_I32V(58)), |
- WASM_SET_LOCAL(0, WASM_I32V(0))), |
+ WASM_SET_LOCAL(1, WASM_I32V(0))), |
WASM_IF( |
- WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(1)), |
+ WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(2)), |
WASM_I32V(28)), |
- WASM_SET_LOCAL(0, WASM_I32V(0))), |
+ WASM_SET_LOCAL(1, WASM_I32V(0))), |
WASM_IF( |
- WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), |
+ WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(2)), |
WASM_I32V(36)), |
- WASM_SET_LOCAL(0, WASM_I32V(0))), |
- WASM_RETURN1(WASM_GET_LOCAL(0)))); |
+ WASM_SET_LOCAL(1, WASM_I32V(0))), |
+ WASM_RETURN1(WASM_GET_LOCAL(1)))); |
FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } |
} |
WASM_EXEC_COMPILED_TEST(Simd_F32x4_For) { |
FLAG_wasm_simd_prototype = true; |
- WasmRunner<int32_t> r(kExecuteCompiled); |
- r.AllocateLocal(kAstI32); |
- r.AllocateLocal(kAstS128); |
- BUILD(r, WASM_BLOCK( |
- WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))), |
- WASM_SET_LOCAL(1, WASM_SIMD_F32x4_REPLACE_LANE( |
- 3, WASM_GET_LOCAL(1), WASM_F32(19.5))), |
- WASM_SET_LOCAL(0, WASM_I32V(0)), |
+ WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
+ r.AllocateLocal(kAstI32); |
+ r.AllocateLocal(kAstS128); |
+ BUILD(r, WASM_BLOCK( |
+ WASM_SET_LOCAL(2, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))), |
+ WASM_SET_LOCAL(2, WASM_SIMD_F32x4_REPLACE_LANE( |
+ 3, WASM_GET_LOCAL(2), WASM_F32(19.5))), |
+ WASM_SET_LOCAL(1, WASM_I32V(0)), |
WASM_LOOP( |
- WASM_SET_LOCAL(1, WASM_SIMD_F32x4_ADD( |
- WASM_GET_LOCAL(1), |
+ WASM_SET_LOCAL(2, WASM_SIMD_F32x4_ADD( |
+ WASM_GET_LOCAL(2), |
WASM_SIMD_F32x4_SPLAT(WASM_F32(2.0)))), |
- WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(0), WASM_I32V(3)), |
+ WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(1), WASM_I32V(3)), |
WASM_BR(1))), |
- WASM_SET_LOCAL(0, WASM_I32V(1)), |
+ WASM_SET_LOCAL(1, WASM_I32V(1)), |
WASM_IF(WASM_F32_NE( |
- WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(1)), |
+ WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(2)), |
WASM_F32(27.25)), |
- WASM_SET_LOCAL(0, WASM_I32V(0))), |
+ WASM_SET_LOCAL(1, WASM_I32V(0))), |
WASM_IF(WASM_F32_NE( |
- WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), |
+ WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(2)), |
WASM_F32(25.5)), |
- WASM_SET_LOCAL(0, WASM_I32V(0))), |
- WASM_RETURN1(WASM_GET_LOCAL(0)))); |
- FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } |
-} |
+ WASM_SET_LOCAL(1, WASM_I32V(0))), |
+ WASM_RETURN1(WASM_GET_LOCAL(1)))); |
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } |
+} |