OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/assembler-inl.h" | 5 #include "src/assembler-inl.h" |
6 #include "test/cctest/cctest.h" | 6 #include "test/cctest/cctest.h" |
7 #include "test/cctest/compiler/value-helper.h" | 7 #include "test/cctest/compiler/value-helper.h" |
8 #include "test/cctest/wasm/wasm-run-utils.h" | 8 #include "test/cctest/wasm/wasm-run-utils.h" |
9 #include "test/common/wasm/wasm-macro-gen.h" | 9 #include "test/common/wasm/wasm-macro-gen.h" |
10 | 10 |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 WASM_SET_LOCAL(simd, | 734 WASM_SET_LOCAL(simd, |
735 WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd), | 735 WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd), |
736 WASM_GET_LOCAL(new_val))), | 736 WASM_GET_LOCAL(new_val))), |
737 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val), WASM_ONE); | 737 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val), WASM_ONE); |
738 | 738 |
739 CHECK_EQ(1, r.Call(1, 2)); | 739 CHECK_EQ(1, r.Call(1, 2)); |
740 } | 740 } |
741 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || | 741 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || |
742 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 742 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
743 | 743 |
744 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 | 744 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || \ |
| 745 V8_TARGET_ARCH_MIPS64 |
745 WASM_EXEC_COMPILED_TEST(I8x16Splat) { | 746 WASM_EXEC_COMPILED_TEST(I8x16Splat) { |
746 FLAG_wasm_simd_prototype = true; | 747 FLAG_wasm_simd_prototype = true; |
747 | 748 |
748 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); | 749 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
749 byte lane_val = 0; | 750 byte lane_val = 0; |
750 byte simd = r.AllocateLocal(kWasmS128); | 751 byte simd = r.AllocateLocal(kWasmS128); |
751 BUILD(r, | 752 BUILD(r, |
752 WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))), | 753 WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))), |
753 WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE); | 754 WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE); |
754 | 755 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, | 853 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val, |
853 new_val, new_val, new_val, new_val, new_val, new_val, | 854 new_val, new_val, new_val, new_val, new_val, new_val, |
854 new_val, new_val, new_val, new_val, new_val, old_val), | 855 new_val, new_val, new_val, new_val, new_val, old_val), |
855 WASM_SET_LOCAL(simd, | 856 WASM_SET_LOCAL(simd, |
856 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd), | 857 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd), |
857 WASM_GET_LOCAL(new_val))), | 858 WASM_GET_LOCAL(new_val))), |
858 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE); | 859 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE); |
859 | 860 |
860 CHECK_EQ(1, r.Call(1, 2)); | 861 CHECK_EQ(1, r.Call(1, 2)); |
861 } | 862 } |
862 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 | 863 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || |
| 864 // V8_TARGET_ARCH_MIPS64 |
863 | 865 |
864 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ | 866 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ |
865 V8_TARGET_ARCH_MIPS64 | 867 V8_TARGET_ARCH_MIPS64 |
866 // Determines if conversion from float to int will be valid. | 868 // Determines if conversion from float to int will be valid. |
867 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { | 869 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { |
868 const double max_uint = static_cast<double>(0xffffffffu); | 870 const double max_uint = static_cast<double>(0xffffffffu); |
869 const double max_int = static_cast<double>(kMaxInt); | 871 const double max_int = static_cast<double>(kMaxInt); |
870 const double min_int = static_cast<double>(kMinInt); | 872 const double min_int = static_cast<double>(kMinInt); |
871 | 873 |
872 // Check for NaN. | 874 // Check for NaN. |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1235 } | 1237 } |
1236 | 1238 |
1237 WASM_EXEC_COMPILED_TEST(I16x8Sub) { RunI16x8BinOpTest(kExprI16x8Sub, Sub); } | 1239 WASM_EXEC_COMPILED_TEST(I16x8Sub) { RunI16x8BinOpTest(kExprI16x8Sub, Sub); } |
1238 | 1240 |
1239 WASM_EXEC_COMPILED_TEST(I16x8SubSaturateS) { | 1241 WASM_EXEC_COMPILED_TEST(I16x8SubSaturateS) { |
1240 RunI16x8BinOpTest(kExprI16x8SubSaturateS, SubSaturate); | 1242 RunI16x8BinOpTest(kExprI16x8SubSaturateS, SubSaturate); |
1241 } | 1243 } |
1242 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || | 1244 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || |
1243 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 1245 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1244 | 1246 |
1245 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET | 1247 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || \ |
| 1248 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1246 WASM_EXEC_COMPILED_TEST(I16x8Mul) { RunI16x8BinOpTest(kExprI16x8Mul, Mul); } | 1249 WASM_EXEC_COMPILED_TEST(I16x8Mul) { RunI16x8BinOpTest(kExprI16x8Mul, Mul); } |
1247 | 1250 |
1248 WASM_EXEC_COMPILED_TEST(I16x8MinS) { | 1251 WASM_EXEC_COMPILED_TEST(I16x8MinS) { |
1249 RunI16x8BinOpTest(kExprI16x8MinS, Minimum); | 1252 RunI16x8BinOpTest(kExprI16x8MinS, Minimum); |
1250 } | 1253 } |
1251 | 1254 |
1252 WASM_EXEC_COMPILED_TEST(I16x8MaxS) { | 1255 WASM_EXEC_COMPILED_TEST(I16x8MaxS) { |
1253 RunI16x8BinOpTest(kExprI16x8MaxS, Maximum); | 1256 RunI16x8BinOpTest(kExprI16x8MaxS, Maximum); |
1254 } | 1257 } |
1255 | 1258 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 FOR_INT16_INPUTS(i) { | 1291 FOR_INT16_INPUTS(i) { |
1289 FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } | 1292 FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } |
1290 } | 1293 } |
1291 } | 1294 } |
1292 | 1295 |
1293 WASM_EXEC_COMPILED_TEST(I16x8Eq) { RunI16x8CompareOpTest(kExprI16x8Eq, Equal); } | 1296 WASM_EXEC_COMPILED_TEST(I16x8Eq) { RunI16x8CompareOpTest(kExprI16x8Eq, Equal); } |
1294 | 1297 |
1295 WASM_EXEC_COMPILED_TEST(I16x8Ne) { | 1298 WASM_EXEC_COMPILED_TEST(I16x8Ne) { |
1296 RunI16x8CompareOpTest(kExprI16x8Ne, NotEqual); | 1299 RunI16x8CompareOpTest(kExprI16x8Ne, NotEqual); |
1297 } | 1300 } |
1298 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET | 1301 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || |
| 1302 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1299 | 1303 |
1300 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 1304 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ |
| 1305 V8_TARGET_ARCH_MIPS64 |
1301 WASM_EXEC_COMPILED_TEST(I16x8LtS) { | 1306 WASM_EXEC_COMPILED_TEST(I16x8LtS) { |
1302 RunI16x8CompareOpTest(kExprI16x8LtS, Less); | 1307 RunI16x8CompareOpTest(kExprI16x8LtS, Less); |
1303 } | 1308 } |
1304 | 1309 |
1305 WASM_EXEC_COMPILED_TEST(I16x8LeS) { | 1310 WASM_EXEC_COMPILED_TEST(I16x8LeS) { |
1306 RunI16x8CompareOpTest(kExprI16x8LeS, LessEqual); | 1311 RunI16x8CompareOpTest(kExprI16x8LeS, LessEqual); |
1307 } | 1312 } |
1308 | 1313 |
1309 WASM_EXEC_COMPILED_TEST(I16x8GtS) { | 1314 WASM_EXEC_COMPILED_TEST(I16x8GtS) { |
1310 RunI16x8CompareOpTest(kExprI16x8GtS, Greater); | 1315 RunI16x8CompareOpTest(kExprI16x8GtS, Greater); |
(...skipping 11 matching lines...) Expand all Loading... |
1322 RunI16x8CompareOpTest(kExprI16x8GeU, UnsignedGreaterEqual); | 1327 RunI16x8CompareOpTest(kExprI16x8GeU, UnsignedGreaterEqual); |
1323 } | 1328 } |
1324 | 1329 |
1325 WASM_EXEC_COMPILED_TEST(I16x8LtU) { | 1330 WASM_EXEC_COMPILED_TEST(I16x8LtU) { |
1326 RunI16x8CompareOpTest(kExprI16x8LtU, UnsignedLess); | 1331 RunI16x8CompareOpTest(kExprI16x8LtU, UnsignedLess); |
1327 } | 1332 } |
1328 | 1333 |
1329 WASM_EXEC_COMPILED_TEST(I16x8LeU) { | 1334 WASM_EXEC_COMPILED_TEST(I16x8LeU) { |
1330 RunI16x8CompareOpTest(kExprI16x8LeU, UnsignedLessEqual); | 1335 RunI16x8CompareOpTest(kExprI16x8LeU, UnsignedLessEqual); |
1331 } | 1336 } |
1332 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 1337 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || |
| 1338 // V8_TARGET_ARCH_MIPS64 |
1333 | 1339 |
1334 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || \ | 1340 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || \ |
1335 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 1341 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1336 void RunI16x8ShiftOpTest(WasmOpcode simd_op, Int16ShiftOp expected_op, | 1342 void RunI16x8ShiftOpTest(WasmOpcode simd_op, Int16ShiftOp expected_op, |
1337 int shift) { | 1343 int shift) { |
1338 FLAG_wasm_simd_prototype = true; | 1344 FLAG_wasm_simd_prototype = true; |
1339 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 1345 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); |
1340 byte a = 0; | 1346 byte a = 0; |
1341 byte expected = 1; | 1347 byte expected = 1; |
1342 byte simd = r.AllocateLocal(kWasmS128); | 1348 byte simd = r.AllocateLocal(kWasmS128); |
(...skipping 12 matching lines...) Expand all Loading... |
1355 WASM_EXEC_COMPILED_TEST(I16x8ShrS) { | 1361 WASM_EXEC_COMPILED_TEST(I16x8ShrS) { |
1356 RunI16x8ShiftOpTest(kExprI16x8ShrS, ArithmeticShiftRight, 1); | 1362 RunI16x8ShiftOpTest(kExprI16x8ShrS, ArithmeticShiftRight, 1); |
1357 } | 1363 } |
1358 | 1364 |
1359 WASM_EXEC_COMPILED_TEST(I16x8ShrU) { | 1365 WASM_EXEC_COMPILED_TEST(I16x8ShrU) { |
1360 RunI16x8ShiftOpTest(kExprI16x8ShrU, LogicalShiftRight, 1); | 1366 RunI16x8ShiftOpTest(kExprI16x8ShrU, LogicalShiftRight, 1); |
1361 } | 1367 } |
1362 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || | 1368 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || |
1363 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 1369 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1364 | 1370 |
1365 #if V8_TARGET_ARCH_ARM | 1371 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1366 void RunI8x16UnOpTest(WasmOpcode simd_op, Int8UnOp expected_op) { | 1372 void RunI8x16UnOpTest(WasmOpcode simd_op, Int8UnOp expected_op) { |
1367 FLAG_wasm_simd_prototype = true; | 1373 FLAG_wasm_simd_prototype = true; |
1368 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 1374 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); |
1369 byte a = 0; | 1375 byte a = 0; |
1370 byte expected = 1; | 1376 byte expected = 1; |
1371 byte simd = r.AllocateLocal(kWasmS128); | 1377 byte simd = r.AllocateLocal(kWasmS128); |
1372 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), | 1378 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), |
1373 WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), | 1379 WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), |
1374 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE); | 1380 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE); |
1375 | 1381 |
1376 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } | 1382 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } |
1377 } | 1383 } |
1378 | 1384 |
1379 WASM_EXEC_COMPILED_TEST(I8x16Neg) { RunI8x16UnOpTest(kExprI8x16Neg, Negate); } | 1385 WASM_EXEC_COMPILED_TEST(I8x16Neg) { RunI8x16UnOpTest(kExprI8x16Neg, Negate); } |
| 1386 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1380 | 1387 |
| 1388 #if V8_TARGET_ARCH_ARM |
1381 // Tests both signed and unsigned conversion from I16x8 (packing). | 1389 // Tests both signed and unsigned conversion from I16x8 (packing). |
1382 WASM_EXEC_COMPILED_TEST(I8x16ConvertI16x8) { | 1390 WASM_EXEC_COMPILED_TEST(I8x16ConvertI16x8) { |
1383 FLAG_wasm_simd_prototype = true; | 1391 FLAG_wasm_simd_prototype = true; |
1384 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); | 1392 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); |
1385 byte a = 0; | 1393 byte a = 0; |
1386 byte packed_signed = 1; | 1394 byte packed_signed = 1; |
1387 byte packed_unsigned = 2; | 1395 byte packed_unsigned = 2; |
1388 byte simd0 = r.AllocateLocal(kWasmS128); | 1396 byte simd0 = r.AllocateLocal(kWasmS128); |
1389 byte simd1 = r.AllocateLocal(kWasmS128); | 1397 byte simd1 = r.AllocateLocal(kWasmS128); |
1390 byte simd2 = r.AllocateLocal(kWasmS128); | 1398 byte simd2 = r.AllocateLocal(kWasmS128); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 RunI8x16CompareOpTest(kExprI8x16GeU, UnsignedGreaterEqual); | 1527 RunI8x16CompareOpTest(kExprI8x16GeU, UnsignedGreaterEqual); |
1520 } | 1528 } |
1521 | 1529 |
1522 WASM_EXEC_COMPILED_TEST(I8x16LtU) { | 1530 WASM_EXEC_COMPILED_TEST(I8x16LtU) { |
1523 RunI8x16CompareOpTest(kExprI8x16LtU, UnsignedLess); | 1531 RunI8x16CompareOpTest(kExprI8x16LtU, UnsignedLess); |
1524 } | 1532 } |
1525 | 1533 |
1526 WASM_EXEC_COMPILED_TEST(I8x16LeU) { | 1534 WASM_EXEC_COMPILED_TEST(I8x16LeU) { |
1527 RunI8x16CompareOpTest(kExprI8x16LeU, UnsignedLessEqual); | 1535 RunI8x16CompareOpTest(kExprI8x16LeU, UnsignedLessEqual); |
1528 } | 1536 } |
| 1537 #endif // V8_TARGET_ARCH_ARM |
1529 | 1538 |
1530 void RunI8x16ShiftOpTest(WasmOpcode simd_op, Int8ShiftOp expected_op, | 1539 void RunI8x16ShiftOpTest(WasmOpcode simd_op, Int8ShiftOp expected_op, |
1531 int shift) { | 1540 int shift) { |
1532 FLAG_wasm_simd_prototype = true; | 1541 FLAG_wasm_simd_prototype = true; |
1533 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 1542 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); |
1534 byte a = 0; | 1543 byte a = 0; |
1535 byte expected = 1; | 1544 byte expected = 1; |
1536 byte simd = r.AllocateLocal(kWasmS128); | 1545 byte simd = r.AllocateLocal(kWasmS128); |
1537 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), | 1546 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), |
1538 WASM_SET_LOCAL( | 1547 WASM_SET_LOCAL( |
1539 simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), | 1548 simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), |
1540 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE); | 1549 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE); |
1541 | 1550 |
1542 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); } | 1551 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); } |
1543 } | 1552 } |
1544 | 1553 |
| 1554 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1545 WASM_EXEC_COMPILED_TEST(I8x16Shl) { | 1555 WASM_EXEC_COMPILED_TEST(I8x16Shl) { |
1546 RunI8x16ShiftOpTest(kExprI8x16Shl, LogicalShiftLeft, 1); | 1556 RunI8x16ShiftOpTest(kExprI8x16Shl, LogicalShiftLeft, 1); |
1547 } | 1557 } |
1548 | 1558 |
1549 WASM_EXEC_COMPILED_TEST(I8x16ShrS) { | 1559 WASM_EXEC_COMPILED_TEST(I8x16ShrS) { |
1550 RunI8x16ShiftOpTest(kExprI8x16ShrS, ArithmeticShiftRight, 1); | 1560 RunI8x16ShiftOpTest(kExprI8x16ShrS, ArithmeticShiftRight, 1); |
1551 } | 1561 } |
| 1562 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1552 | 1563 |
| 1564 #if V8_TARGET_ARCH_ARM |
1553 WASM_EXEC_COMPILED_TEST(I8x16ShrU) { | 1565 WASM_EXEC_COMPILED_TEST(I8x16ShrU) { |
1554 RunI8x16ShiftOpTest(kExprI8x16ShrU, LogicalShiftRight, 1); | 1566 RunI8x16ShiftOpTest(kExprI8x16ShrU, LogicalShiftRight, 1); |
1555 } | 1567 } |
1556 #endif // V8_TARGET_ARCH_ARM | 1568 #endif // V8_TARGET_ARCH_ARM |
1557 | 1569 |
1558 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || \ | 1570 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || \ |
1559 V8_TARGET_ARCH_MIPS64 | 1571 V8_TARGET_ARCH_MIPS64 |
1560 // Test Select by making a mask where the first two lanes are true and the rest | 1572 // Test Select by making a mask where the first two lanes are true and the rest |
1561 // false, and comparing for non-equality with zero to materialize a bool vector. | 1573 // false, and comparing for non-equality with zero to materialize a bool vector. |
1562 #define WASM_SIMD_SELECT_TEST(format) \ | 1574 #define WASM_SIMD_SELECT_TEST(format) \ |
(...skipping 26 matching lines...) Expand all Loading... |
1589 WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 2), \ | 1601 WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 2), \ |
1590 WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE); \ | 1602 WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE); \ |
1591 \ | 1603 \ |
1592 CHECK_EQ(1, r.Call(0x12, 0x34)); \ | 1604 CHECK_EQ(1, r.Call(0x12, 0x34)); \ |
1593 } | 1605 } |
1594 | 1606 |
1595 WASM_SIMD_SELECT_TEST(32x4) | 1607 WASM_SIMD_SELECT_TEST(32x4) |
1596 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || | 1608 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || |
1597 // V8_TARGET_ARCH_MIPS64 | 1609 // V8_TARGET_ARCH_MIPS64 |
1598 | 1610 |
| 1611 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || \ |
| 1612 V8_TARGET_ARCH_MIPS64 |
| 1613 WASM_SIMD_SELECT_TEST(16x8) |
| 1614 |
| 1615 WASM_SIMD_SELECT_TEST(8x16) |
| 1616 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_MIPS || |
| 1617 // V8_TARGET_ARCH_MIPS64 |
| 1618 |
1599 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 | 1619 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 |
1600 WASM_SIMD_SELECT_TEST(16x8) | |
1601 | |
1602 WASM_SIMD_SELECT_TEST(8x16) | |
1603 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 | |
1604 | |
1605 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 | |
1606 // Test binary ops with two lane test patterns, all lanes distinct. | 1620 // Test binary ops with two lane test patterns, all lanes distinct. |
1607 template <typename T> | 1621 template <typename T> |
1608 void RunBinaryLaneOpTest( | 1622 void RunBinaryLaneOpTest( |
1609 WasmOpcode simd_op, | 1623 WasmOpcode simd_op, |
1610 const std::array<T, kSimd128Size / sizeof(T)>& expected) { | 1624 const std::array<T, kSimd128Size / sizeof(T)>& expected) { |
1611 FLAG_wasm_simd_prototype = true; | 1625 FLAG_wasm_simd_prototype = true; |
1612 WasmRunner<int32_t> r(kExecuteCompiled); | 1626 WasmRunner<int32_t> r(kExecuteCompiled); |
1613 // Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7]. | 1627 // Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7]. |
1614 T* src0 = r.module().AddGlobal<T>(kWasmS128); | 1628 T* src0 = r.module().AddGlobal<T>(kWasmS128); |
1615 T* src1 = r.module().AddGlobal<T>(kWasmS128); | 1629 T* src1 = r.module().AddGlobal<T>(kWasmS128); |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2278 WASM_SIMD_I32x4_EXTRACT_LANE( | 2292 WASM_SIMD_I32x4_EXTRACT_LANE( |
2279 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); | 2293 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); |
2280 | 2294 |
2281 FOR_INT32_INPUTS(i) { | 2295 FOR_INT32_INPUTS(i) { |
2282 int32_t expected = *i; | 2296 int32_t expected = *i; |
2283 r.module().WriteMemory(&memory[0], expected); | 2297 r.module().WriteMemory(&memory[0], expected); |
2284 CHECK_EQ(expected, r.Call()); | 2298 CHECK_EQ(expected, r.Call()); |
2285 } | 2299 } |
2286 } | 2300 } |
2287 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 | 2301 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
OLD | NEW |