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 53211ce340fbe8ca88a7f9f6448f3b264df629f5..0809e3216f6e744603a86185261850ff964de60c 100644 |
--- a/test/cctest/wasm/test-run-wasm-simd.cc |
+++ b/test/cctest/wasm/test-run-wasm-simd.cc |
@@ -850,9 +850,9 @@ WASM_EXEC_COMPILED_TEST(I32x4Add) { RunI32x4BinOpTest(kExprI32x4Add, Add); } |
WASM_EXEC_COMPILED_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); } |
-#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
WASM_EXEC_COMPILED_TEST(I32x4Mul) { RunI32x4BinOpTest(kExprI32x4Mul, Mul); } |
+#if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
WASM_EXEC_COMPILED_TEST(S128And) { RunI32x4BinOpTest(kExprS128And, And); } |
WASM_EXEC_COMPILED_TEST(S128Or) { RunI32x4BinOpTest(kExprS128Or, Or); } |
@@ -860,7 +860,7 @@ WASM_EXEC_COMPILED_TEST(S128Or) { RunI32x4BinOpTest(kExprS128Or, Or); } |
WASM_EXEC_COMPILED_TEST(S128Xor) { RunI32x4BinOpTest(kExprS128Xor, Xor); } |
#endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
-#if V8_TARGET_ARCH_ARM |
+#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 |
WASM_EXEC_COMPILED_TEST(I32x4Min) { |
RunI32x4BinOpTest(kExprI32x4MinS, Minimum); |
} |
@@ -877,8 +877,6 @@ WASM_EXEC_COMPILED_TEST(Ui32x4Max) { |
RunI32x4BinOpTest(kExprI32x4MaxU, UnsignedMaximum); |
} |
- |
- |
void RunI32x4CompareOpTest(WasmOpcode simd_op, Int32BinOp expected_op) { |
FLAG_wasm_simd_prototype = true; |
WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); |
@@ -908,6 +906,45 @@ WASM_EXEC_COMPILED_TEST(I32x4NotEqual) { |
RunI32x4CompareOpTest(kExprI32x4Ne, NotEqual); |
} |
+// Test Select by making a mask where the first two lanes are true and the rest |
+// false, and comparing for non-equality with zero to materialize a bool vector. |
+#define WASM_SIMD_SELECT_TEST(format) \ |
+ WASM_EXEC_COMPILED_TEST(S##format##Select) { \ |
+ FLAG_wasm_simd_prototype = true; \ |
+ WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); \ |
+ byte val1 = 0; \ |
+ byte val2 = 1; \ |
+ byte src1 = r.AllocateLocal(kWasmS128); \ |
+ byte src2 = r.AllocateLocal(kWasmS128); \ |
+ byte zero = r.AllocateLocal(kWasmS128); \ |
+ byte mask = r.AllocateLocal(kWasmS128); \ |
+ BUILD(r, WASM_SET_LOCAL( \ |
+ src1, WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val1))), \ |
+ WASM_SET_LOCAL(src2, \ |
+ WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val2))), \ |
+ WASM_SET_LOCAL(zero, WASM_SIMD_I##format##_SPLAT(WASM_ZERO)), \ |
+ WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE( \ |
+ 1, WASM_GET_LOCAL(zero), WASM_I32V(-1))), \ |
+ WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE( \ |
+ 2, WASM_GET_LOCAL(mask), WASM_I32V(-1))), \ |
+ WASM_SET_LOCAL( \ |
+ mask, \ |
+ WASM_SIMD_SELECT(format, WASM_SIMD_BINOP(kExprI##format##Ne, \ |
+ WASM_GET_LOCAL(mask), \ |
+ WASM_GET_LOCAL(zero)), \ |
+ WASM_GET_LOCAL(src1), WASM_GET_LOCAL(src2))), \ |
+ WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 0), \ |
+ WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 1), \ |
+ WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 2), \ |
+ WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE); \ |
+ \ |
+ CHECK_EQ(1, r.Call(0x12, 0x34)); \ |
+ } |
+ |
+WASM_SIMD_SELECT_TEST(32x4) |
+#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 |
+ |
+#if V8_TARGET_ARCH_ARM |
WASM_EXEC_COMPILED_TEST(I32x4Greater) { |
RunI32x4CompareOpTest(kExprI32x4GtS, Greater); |
} |
@@ -1287,42 +1324,6 @@ WASM_EXEC_COMPILED_TEST(I8x16ShrU) { |
RunI8x16ShiftOpTest(kExprI8x16ShrU, LogicalShiftRight, 1); |
} |
-// Test Select by making a mask where the first two lanes are true and the rest |
-// false, and comparing for non-equality with zero to materialize a bool vector. |
-#define WASM_SIMD_SELECT_TEST(format) \ |
- WASM_EXEC_COMPILED_TEST(S##format##Select) { \ |
- FLAG_wasm_simd_prototype = true; \ |
- WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); \ |
- byte val1 = 0; \ |
- byte val2 = 1; \ |
- byte src1 = r.AllocateLocal(kWasmS128); \ |
- byte src2 = r.AllocateLocal(kWasmS128); \ |
- byte zero = r.AllocateLocal(kWasmS128); \ |
- byte mask = r.AllocateLocal(kWasmS128); \ |
- BUILD(r, WASM_SET_LOCAL( \ |
- src1, WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val1))), \ |
- WASM_SET_LOCAL(src2, \ |
- WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val2))), \ |
- WASM_SET_LOCAL(zero, WASM_SIMD_I##format##_SPLAT(WASM_ZERO)), \ |
- WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE( \ |
- 1, WASM_GET_LOCAL(zero), WASM_I32V(-1))), \ |
- WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE( \ |
- 2, WASM_GET_LOCAL(mask), WASM_I32V(-1))), \ |
- WASM_SET_LOCAL( \ |
- mask, \ |
- WASM_SIMD_SELECT(format, WASM_SIMD_BINOP(kExprI##format##Ne, \ |
- WASM_GET_LOCAL(mask), \ |
- WASM_GET_LOCAL(zero)), \ |
- WASM_GET_LOCAL(src1), WASM_GET_LOCAL(src2))), \ |
- WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 0), \ |
- WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 1), \ |
- WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 2), \ |
- WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE); \ |
- \ |
- CHECK_EQ(1, r.Call(0x12, 0x34)); \ |
- } |
- |
-WASM_SIMD_SELECT_TEST(32x4) |
WASM_SIMD_SELECT_TEST(16x8) |
WASM_SIMD_SELECT_TEST(8x16) |
#endif // V8_TARGET_ARCH_ARM |