Index: test/cctest/wasm/test-run-wasm-simd.cc |
diff --git a/test/cctest/wasm/test-run-wasm-simd.cc b/test/cctest/wasm/test-run-wasm-simd.cc |
index 75786d4982ec051b84b1a9dc409c56f01e39ae81..65c8078c0dfddc6f0b903556fbae08f49473af7d 100644 |
--- a/test/cctest/wasm/test-run-wasm-simd.cc |
+++ b/test/cctest/wasm/test-run-wasm-simd.cc |
@@ -587,6 +587,42 @@ WASM_EXEC_COMPILED_TEST(F32x4RecipSqrtRefine) { |
} |
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
+#if V8_TARGET_ARCH_ARM |
+void RunF32x4HorizOpTest(WasmOpcode simd_op, FloatBinOp expected_op) { |
+ FLAG_wasm_simd_prototype = true; |
+ WasmRunner<int32_t, float, float, float, float> r(kExecuteCompiled); |
+ byte a = 0; |
+ byte b = 1; |
+ byte expected1 = 2; |
+ byte expected2 = 3; |
+ byte simd0 = r.AllocateLocal(kWasmS128); |
+ byte simd1 = r.AllocateLocal(kWasmS128); |
+ BUILD( |
+ r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), |
+ WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), |
+ WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), |
+ WASM_GET_LOCAL(simd1))), |
+ WASM_SIMD_CHECK_F32x4(simd1, expected1, expected1, expected2, expected2), |
+ WASM_RETURN1(WASM_ONE)); |
+ |
+ FOR_FLOAT32_INPUTS(i) { |
+ if (SkipFPValue(*i)) continue; |
+ FOR_FLOAT32_INPUTS(j) { |
+ if (SkipFPValue(*j)) continue; |
+ float expected1 = expected_op(*i, *i); |
+ float expected2 = expected_op(*j, *j); |
+ if (SkipFPExpectedValue(expected1) || SkipFPExpectedValue(expected2)) |
+ continue; |
+ CHECK_EQ(1, r.Call(*i, *j, expected1, expected2)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_COMPILED_TEST(F32x4AddHoriz) { |
+ RunF32x4HorizOpTest(kExprF32x4AddHoriz, Add); |
+} |
+#endif // V8_TARGET_ARCH_ARM |
+ |
#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ |
V8_TARGET_ARCH_MIPS64 |
void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) { |
@@ -1042,6 +1078,38 @@ WASM_EXEC_COMPILED_TEST(I32x4MaxU) { |
RunI32x4BinOpTest(kExprI32x4MaxU, UnsignedMaximum); |
} |
+#if V8_TARGET_ARCH_ARM |
+void RunI32x4HorizOpTest(WasmOpcode simd_op, Int32BinOp expected_op) { |
+ FLAG_wasm_simd_prototype = true; |
+ WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); |
+ byte a = 0; |
+ byte b = 1; |
+ byte expected1 = 2; |
+ byte expected2 = 3; |
+ byte simd0 = r.AllocateLocal(kWasmS128); |
+ byte simd1 = r.AllocateLocal(kWasmS128); |
+ BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), |
+ WASM_SET_LOCAL(simd1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(b))), |
+ WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), |
+ WASM_GET_LOCAL(simd1))), |
+ WASM_SIMD_CHECK4(I32x4, simd1, I32, expected1, expected1, expected2, |
+ expected2), |
+ WASM_RETURN1(WASM_ONE)); |
+ |
+ FOR_INT32_INPUTS(i) { |
+ FOR_INT32_INPUTS(j) { |
+ int32_t expected1 = expected_op(*i, *i); |
+ int32_t expected2 = expected_op(*j, *j); |
+ CHECK_EQ(1, r.Call(*i, *j, expected1, expected2)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_COMPILED_TEST(I32x4AddHoriz) { |
+ RunI32x4HorizOpTest(kExprI32x4AddHoriz, Add); |
+} |
+#endif // V8_TARGET_ARCH_ARM |
+ |
void RunI32x4CompareOpTest(WasmOpcode simd_op, Int32CompareOp expected_op) { |
FLAG_wasm_simd_prototype = true; |
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); |
@@ -1265,6 +1333,38 @@ WASM_EXEC_COMPILED_TEST(I16x8MaxU) { |
RunI16x8BinOpTest(kExprI16x8MaxU, UnsignedMaximum); |
} |
+#if V8_TARGET_ARCH_ARM |
+void RunI16x8HorizOpTest(WasmOpcode simd_op, Int16BinOp expected_op) { |
+ FLAG_wasm_simd_prototype = true; |
+ WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); |
+ byte a = 0; |
+ byte b = 1; |
+ byte expected1 = 2; |
+ byte expected2 = 3; |
+ byte simd0 = r.AllocateLocal(kWasmS128); |
+ byte simd1 = r.AllocateLocal(kWasmS128); |
+ BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), |
+ WASM_SET_LOCAL(simd1, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(b))), |
+ WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), |
+ WASM_GET_LOCAL(simd1))), |
+ WASM_SIMD_CHECK8(I16x8, simd1, I32, expected1, expected1, expected1, |
+ expected1, expected2, expected2, expected2, expected2), |
+ WASM_RETURN1(WASM_ONE)); |
+ |
+ FOR_INT16_INPUTS(i) { |
+ FOR_INT16_INPUTS(j) { |
+ int32_t expected1 = expected_op(*i, *i); |
+ int32_t expected2 = expected_op(*j, *j); |
+ CHECK_EQ(1, r.Call(*i, *j, expected1, expected2)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_COMPILED_TEST(I16x8AddHoriz) { |
+ RunI16x8HorizOpTest(kExprI16x8AddHoriz, Add); |
+} |
+#endif // V8_TARGET_ARCH_ARM |
+ |
void RunI16x8CompareOpTest(WasmOpcode simd_op, Int16CompareOp expected_op) { |
FLAG_wasm_simd_prototype = true; |
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); |
@@ -1458,6 +1558,40 @@ WASM_EXEC_COMPILED_TEST(I8x16MaxU) { |
RunI8x16BinOpTest(kExprI8x16MaxU, UnsignedMaximum); |
} |
+#if V8_TARGET_ARCH_ARM |
+void RunI8x16HorizOpTest(WasmOpcode simd_op, Int8BinOp expected_op) { |
+ FLAG_wasm_simd_prototype = true; |
+ WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); |
+ byte a = 0; |
+ byte b = 1; |
+ byte expected1 = 2; |
+ byte expected2 = 3; |
+ byte simd0 = r.AllocateLocal(kWasmS128); |
+ byte simd1 = r.AllocateLocal(kWasmS128); |
+ BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), |
+ WASM_SET_LOCAL(simd1, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(b))), |
+ WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), |
+ WASM_GET_LOCAL(simd1))), |
+ WASM_SIMD_CHECK16(I8x16, simd1, I32, expected1, expected1, expected1, |
+ expected1, expected1, expected1, expected1, expected1, |
+ expected2, expected2, expected2, expected2, expected2, |
+ expected2, expected2, expected2), |
+ WASM_RETURN1(WASM_ONE)); |
+ |
+ FOR_INT8_INPUTS(i) { |
+ FOR_INT8_INPUTS(j) { |
+ int32_t expected1 = expected_op(*i, *i); |
+ int32_t expected2 = expected_op(*j, *j); |
+ CHECK_EQ(1, r.Call(*i, *j, expected1, expected2)); |
+ } |
+ } |
+} |
+ |
+WASM_EXEC_COMPILED_TEST(I8x16AddHoriz) { |
+ RunI8x16HorizOpTest(kExprI8x16AddHoriz, Add); |
+} |
+#endif // V8_TARGET_ARCH_ARM |
+ |
void RunI8x16CompareOpTest(WasmOpcode simd_op, Int8CompareOp expected_op) { |
FLAG_wasm_simd_prototype = true; |
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); |