| 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/wasm/wasm-macro-gen.h" | 5 #include "src/wasm/wasm-macro-gen.h" | 
| 6 | 6 | 
| 7 #include "test/cctest/cctest.h" | 7 #include "test/cctest/cctest.h" | 
| 8 #include "test/cctest/compiler/value-helper.h" | 8 #include "test/cctest/compiler/value-helper.h" | 
| 9 #include "test/cctest/wasm/wasm-run-utils.h" | 9 #include "test/cctest/wasm/wasm-run-utils.h" | 
| 10 | 10 | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 22 typedef int32_t (*Int32BinOp)(int32_t, int32_t); | 22 typedef int32_t (*Int32BinOp)(int32_t, int32_t); | 
| 23 typedef int32_t (*Int32ShiftOp)(int32_t, int); | 23 typedef int32_t (*Int32ShiftOp)(int32_t, int); | 
| 24 typedef int16_t (*Int16UnOp)(int16_t); | 24 typedef int16_t (*Int16UnOp)(int16_t); | 
| 25 typedef int16_t (*Int16BinOp)(int16_t, int16_t); | 25 typedef int16_t (*Int16BinOp)(int16_t, int16_t); | 
| 26 typedef int16_t (*Int16ShiftOp)(int16_t, int); | 26 typedef int16_t (*Int16ShiftOp)(int16_t, int); | 
| 27 typedef int8_t (*Int8UnOp)(int8_t); | 27 typedef int8_t (*Int8UnOp)(int8_t); | 
| 28 typedef int8_t (*Int8BinOp)(int8_t, int8_t); | 28 typedef int8_t (*Int8BinOp)(int8_t, int8_t); | 
| 29 typedef int8_t (*Int8ShiftOp)(int8_t, int); | 29 typedef int8_t (*Int8ShiftOp)(int8_t, int); | 
| 30 | 30 | 
| 31 #if V8_TARGET_ARCH_ARM | 31 #if V8_TARGET_ARCH_ARM | 
| 32 // Floating point specific value functions. | 32 // Floating point specific value functions, only used by ARM so far. | 
| 33 int32_t Equal(float a, float b) { return a == b ? -1 : 0; } | 33 int32_t Equal(float a, float b) { return a == b ? 1 : 0; } | 
| 34 | 34 | 
| 35 int32_t NotEqual(float a, float b) { return a != b ? -1 : 0; } | 35 int32_t NotEqual(float a, float b) { return a != b ? 1 : 0; } | 
| 36 #endif  // V8_TARGET_ARCH_ARM | 36 #endif  // V8_TARGET_ARCH_ARM | 
| 37 | 37 | 
| 38 // Generic expected value functions. | 38 // Generic expected value functions. | 
| 39 template <typename T> | 39 template <typename T> | 
| 40 T Negate(T a) { | 40 T Negate(T a) { | 
| 41   return -a; | 41   return -a; | 
| 42 } | 42 } | 
| 43 | 43 | 
| 44 template <typename T> | 44 template <typename T> | 
| 45 T Add(T a, T b) { | 45 T Add(T a, T b) { | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
| 73 } | 73 } | 
| 74 | 74 | 
| 75 template <typename T> | 75 template <typename T> | 
| 76 T UnsignedMaximum(T a, T b) { | 76 T UnsignedMaximum(T a, T b) { | 
| 77   using UnsignedT = typename std::make_unsigned<T>::type; | 77   using UnsignedT = typename std::make_unsigned<T>::type; | 
| 78   return static_cast<UnsignedT>(a) >= static_cast<UnsignedT>(b) ? a : b; | 78   return static_cast<UnsignedT>(a) >= static_cast<UnsignedT>(b) ? a : b; | 
| 79 } | 79 } | 
| 80 | 80 | 
| 81 template <typename T> | 81 template <typename T> | 
| 82 T Equal(T a, T b) { | 82 T Equal(T a, T b) { | 
| 83   return a == b ? -1 : 0; | 83   return a == b ? 1 : 0; | 
| 84 } | 84 } | 
| 85 | 85 | 
| 86 template <typename T> | 86 template <typename T> | 
| 87 T NotEqual(T a, T b) { | 87 T NotEqual(T a, T b) { | 
| 88   return a != b ? -1 : 0; | 88   return a != b ? 1 : 0; | 
| 89 } | 89 } | 
| 90 | 90 | 
| 91 template <typename T> | 91 template <typename T> | 
| 92 T Greater(T a, T b) { | 92 T Greater(T a, T b) { | 
| 93   return a > b ? -1 : 0; | 93   return a > b ? 1 : 0; | 
| 94 } | 94 } | 
| 95 | 95 | 
| 96 template <typename T> | 96 template <typename T> | 
| 97 T GreaterEqual(T a, T b) { | 97 T GreaterEqual(T a, T b) { | 
| 98   return a >= b ? -1 : 0; | 98   return a >= b ? 1 : 0; | 
| 99 } | 99 } | 
| 100 | 100 | 
| 101 template <typename T> | 101 template <typename T> | 
| 102 T Less(T a, T b) { | 102 T Less(T a, T b) { | 
| 103   return a < b ? -1 : 0; | 103   return a < b ? 1 : 0; | 
| 104 } | 104 } | 
| 105 | 105 | 
| 106 template <typename T> | 106 template <typename T> | 
| 107 T LessEqual(T a, T b) { | 107 T LessEqual(T a, T b) { | 
| 108   return a <= b ? -1 : 0; | 108   return a <= b ? 1 : 0; | 
| 109 } | 109 } | 
| 110 | 110 | 
| 111 template <typename T> | 111 template <typename T> | 
| 112 T UnsignedGreater(T a, T b) { | 112 T UnsignedGreater(T a, T b) { | 
| 113   using UnsignedT = typename std::make_unsigned<T>::type; | 113   using UnsignedT = typename std::make_unsigned<T>::type; | 
| 114   return static_cast<UnsignedT>(a) > static_cast<UnsignedT>(b) ? -1 : 0; | 114   return static_cast<UnsignedT>(a) > static_cast<UnsignedT>(b) ? 1 : 0; | 
| 115 } | 115 } | 
| 116 | 116 | 
| 117 template <typename T> | 117 template <typename T> | 
| 118 T UnsignedGreaterEqual(T a, T b) { | 118 T UnsignedGreaterEqual(T a, T b) { | 
| 119   using UnsignedT = typename std::make_unsigned<T>::type; | 119   using UnsignedT = typename std::make_unsigned<T>::type; | 
| 120   return static_cast<UnsignedT>(a) >= static_cast<UnsignedT>(b) ? -1 : 0; | 120   return static_cast<UnsignedT>(a) >= static_cast<UnsignedT>(b) ? 1 : 0; | 
| 121 } | 121 } | 
| 122 | 122 | 
| 123 template <typename T> | 123 template <typename T> | 
| 124 T UnsignedLess(T a, T b) { | 124 T UnsignedLess(T a, T b) { | 
| 125   using UnsignedT = typename std::make_unsigned<T>::type; | 125   using UnsignedT = typename std::make_unsigned<T>::type; | 
| 126   return static_cast<UnsignedT>(a) < static_cast<UnsignedT>(b) ? -1 : 0; | 126   return static_cast<UnsignedT>(a) < static_cast<UnsignedT>(b) ? 1 : 0; | 
| 127 } | 127 } | 
| 128 | 128 | 
| 129 template <typename T> | 129 template <typename T> | 
| 130 T UnsignedLessEqual(T a, T b) { | 130 T UnsignedLessEqual(T a, T b) { | 
| 131   using UnsignedT = typename std::make_unsigned<T>::type; | 131   using UnsignedT = typename std::make_unsigned<T>::type; | 
| 132   return static_cast<UnsignedT>(a) <= static_cast<UnsignedT>(b) ? -1 : 0; | 132   return static_cast<UnsignedT>(a) <= static_cast<UnsignedT>(b) ? 1 : 0; | 
| 133 } | 133 } | 
| 134 | 134 | 
| 135 template <typename T> | 135 template <typename T> | 
| 136 T LogicalShiftLeft(T a, int shift) { | 136 T LogicalShiftLeft(T a, int shift) { | 
| 137   return a << shift; | 137   return a << shift; | 
| 138 } | 138 } | 
| 139 | 139 | 
| 140 template <typename T> | 140 template <typename T> | 
| 141 T LogicalShiftRight(T a, int shift) { | 141 T LogicalShiftRight(T a, int shift) { | 
| 142   using UnsignedT = typename std::make_unsigned<T>::type; | 142   using UnsignedT = typename std::make_unsigned<T>::type; | 
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 279   WASM_SIMD_CHECK_F32_LANE(TYPE, value, lv0, 0)               \ | 279   WASM_SIMD_CHECK_F32_LANE(TYPE, value, lv0, 0)               \ | 
| 280   , WASM_SIMD_CHECK_F32_LANE(TYPE, value, lv1, 1),            \ | 280   , WASM_SIMD_CHECK_F32_LANE(TYPE, value, lv1, 1),            \ | 
| 281       WASM_SIMD_CHECK_F32_LANE(TYPE, value, lv2, 2),          \ | 281       WASM_SIMD_CHECK_F32_LANE(TYPE, value, lv2, 2),          \ | 
| 282       WASM_SIMD_CHECK_F32_LANE(TYPE, value, lv3, 3) | 282       WASM_SIMD_CHECK_F32_LANE(TYPE, value, lv3, 3) | 
| 283 | 283 | 
| 284 #define WASM_SIMD_CHECK_SPLAT4_F32(TYPE, value, lv) \ | 284 #define WASM_SIMD_CHECK_SPLAT4_F32(TYPE, value, lv) \ | 
| 285   WASM_SIMD_CHECK4_F32(TYPE, value, lv, lv, lv, lv) | 285   WASM_SIMD_CHECK4_F32(TYPE, value, lv, lv, lv, lv) | 
| 286 | 286 | 
| 287 #define TO_BYTE(val) static_cast<byte>(val) | 287 #define TO_BYTE(val) static_cast<byte>(val) | 
| 288 #define WASM_SIMD_OP(op) kSimdPrefix, TO_BYTE(op) | 288 #define WASM_SIMD_OP(op) kSimdPrefix, TO_BYTE(op) | 
|  | 289 #define WASM_SIMD_SPLAT(Type, x) x, WASM_SIMD_OP(kExpr##Type##Splat) | 
| 289 #define WASM_SIMD_UNOP(op, x) x, WASM_SIMD_OP(op) | 290 #define WASM_SIMD_UNOP(op, x) x, WASM_SIMD_OP(op) | 
| 290 #define WASM_SIMD_BINOP(op, x, y) x, y, WASM_SIMD_OP(op) | 291 #define WASM_SIMD_BINOP(op, x, y) x, y, WASM_SIMD_OP(op) | 
| 291 #define WASM_SIMD_SHIFT_OP(op, shift, x) x, WASM_SIMD_OP(op), TO_BYTE(shift) | 292 #define WASM_SIMD_SHIFT_OP(op, shift, x) x, WASM_SIMD_OP(op), TO_BYTE(shift) | 
| 292 #define WASM_SIMD_SELECT(format, x, y, z) \ | 293 #define WASM_SIMD_SELECT(format, x, y, z) \ | 
| 293   x, y, z, WASM_SIMD_OP(kExprS##format##Select) | 294   x, y, z, WASM_SIMD_OP(kExprS##format##Select) | 
|  | 295 // Since boolean vectors can't be checked directly, materialize them into | 
|  | 296 // integer vectors using a Select operation. | 
|  | 297 #define WASM_SIMD_MATERIALIZE_BOOLS(format, x) \ | 
|  | 298   x, WASM_SIMD_I##format##_SPLAT(WASM_ONE),    \ | 
|  | 299       WASM_SIMD_I##format##_SPLAT(WASM_ZERO),  \ | 
|  | 300       WASM_SIMD_OP(kExprS##format##Select) | 
| 294 | 301 | 
| 295 #define WASM_SIMD_I16x8_SPLAT(x) x, WASM_SIMD_OP(kExprI16x8Splat) | 302 #define WASM_SIMD_I16x8_SPLAT(x) x, WASM_SIMD_OP(kExprI16x8Splat) | 
| 296 #define WASM_SIMD_I16x8_EXTRACT_LANE(lane, x) \ | 303 #define WASM_SIMD_I16x8_EXTRACT_LANE(lane, x) \ | 
| 297   x, WASM_SIMD_OP(kExprI16x8ExtractLane), TO_BYTE(lane) | 304   x, WASM_SIMD_OP(kExprI16x8ExtractLane), TO_BYTE(lane) | 
| 298 #define WASM_SIMD_I16x8_REPLACE_LANE(lane, x, y) \ | 305 #define WASM_SIMD_I16x8_REPLACE_LANE(lane, x, y) \ | 
| 299   x, y, WASM_SIMD_OP(kExprI16x8ReplaceLane), TO_BYTE(lane) | 306   x, y, WASM_SIMD_OP(kExprI16x8ReplaceLane), TO_BYTE(lane) | 
| 300 #define WASM_SIMD_I8x16_SPLAT(x) x, WASM_SIMD_OP(kExprI8x16Splat) | 307 #define WASM_SIMD_I8x16_SPLAT(x) x, WASM_SIMD_OP(kExprI8x16Splat) | 
| 301 #define WASM_SIMD_I8x16_EXTRACT_LANE(lane, x) \ | 308 #define WASM_SIMD_I8x16_EXTRACT_LANE(lane, x) \ | 
| 302   x, WASM_SIMD_OP(kExprI8x16ExtractLane), TO_BYTE(lane) | 309   x, WASM_SIMD_OP(kExprI8x16ExtractLane), TO_BYTE(lane) | 
| 303 #define WASM_SIMD_I8x16_REPLACE_LANE(lane, x, y) \ | 310 #define WASM_SIMD_I8x16_REPLACE_LANE(lane, x, y) \ | 
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 425 void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) { | 432 void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) { | 
| 426   FLAG_wasm_simd_prototype = true; | 433   FLAG_wasm_simd_prototype = true; | 
| 427   WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled); | 434   WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled); | 
| 428   byte a = 0; | 435   byte a = 0; | 
| 429   byte b = 1; | 436   byte b = 1; | 
| 430   byte expected = 2; | 437   byte expected = 2; | 
| 431   byte simd0 = r.AllocateLocal(kWasmS128); | 438   byte simd0 = r.AllocateLocal(kWasmS128); | 
| 432   byte simd1 = r.AllocateLocal(kWasmS128); | 439   byte simd1 = r.AllocateLocal(kWasmS128); | 
| 433   BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), | 440   BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), | 
| 434         WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), | 441         WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), | 
| 435         WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), | 442         WASM_SET_LOCAL(simd1, | 
| 436                                               WASM_GET_LOCAL(simd1))), | 443                        WASM_SIMD_MATERIALIZE_BOOLS( | 
|  | 444                            32x4, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), | 
|  | 445                                                  WASM_GET_LOCAL(simd1)))), | 
| 437         WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE); | 446         WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE); | 
| 438 | 447 | 
| 439   FOR_FLOAT32_INPUTS(i) { | 448   FOR_FLOAT32_INPUTS(i) { | 
| 440     if (std::isnan(*i)) continue; | 449     if (std::isnan(*i)) continue; | 
| 441     FOR_FLOAT32_INPUTS(j) { | 450     FOR_FLOAT32_INPUTS(j) { | 
| 442       if (std::isnan(*j)) continue; | 451       if (std::isnan(*j)) continue; | 
| 443       // SIMD on some platforms may handle denormalized numbers differently. | 452       // SIMD on some platforms may handle denormalized numbers differently. | 
| 444       // Check for number pairs that are very close together. | 453       // Check for number pairs that are very close together. | 
| 445       if (std::fpclassify(*i - *j) == FP_SUBNORMAL) continue; | 454       if (std::fpclassify(*i - *j) == FP_SUBNORMAL) continue; | 
| 446       CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); | 455       CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); | 
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 790 | 799 | 
| 791 WASM_EXEC_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); } | 800 WASM_EXEC_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); } | 
| 792 | 801 | 
| 793 #if V8_TARGET_ARCH_ARM | 802 #if V8_TARGET_ARCH_ARM | 
| 794 WASM_EXEC_TEST(I32x4Mul) { RunI32x4BinOpTest(kExprI32x4Mul, Mul); } | 803 WASM_EXEC_TEST(I32x4Mul) { RunI32x4BinOpTest(kExprI32x4Mul, Mul); } | 
| 795 | 804 | 
| 796 WASM_EXEC_TEST(I32x4Min) { RunI32x4BinOpTest(kExprI32x4MinS, Minimum); } | 805 WASM_EXEC_TEST(I32x4Min) { RunI32x4BinOpTest(kExprI32x4MinS, Minimum); } | 
| 797 | 806 | 
| 798 WASM_EXEC_TEST(I32x4Max) { RunI32x4BinOpTest(kExprI32x4MaxS, Maximum); } | 807 WASM_EXEC_TEST(I32x4Max) { RunI32x4BinOpTest(kExprI32x4MaxS, Maximum); } | 
| 799 | 808 | 
| 800 WASM_EXEC_TEST(I32x4Equal) { RunI32x4BinOpTest(kExprI32x4Eq, Equal); } |  | 
| 801 |  | 
| 802 WASM_EXEC_TEST(I32x4NotEqual) { RunI32x4BinOpTest(kExprI32x4Ne, NotEqual); } |  | 
| 803 |  | 
| 804 WASM_EXEC_TEST(I32x4Greater) { RunI32x4BinOpTest(kExprI32x4GtS, Greater); } |  | 
| 805 |  | 
| 806 WASM_EXEC_TEST(I32x4GreaterEqual) { |  | 
| 807   RunI32x4BinOpTest(kExprI32x4GeS, GreaterEqual); |  | 
| 808 } |  | 
| 809 |  | 
| 810 WASM_EXEC_TEST(I32x4Less) { RunI32x4BinOpTest(kExprI32x4LtS, Less); } |  | 
| 811 |  | 
| 812 WASM_EXEC_TEST(I32x4LessEqual) { RunI32x4BinOpTest(kExprI32x4LeS, LessEqual); } |  | 
| 813 |  | 
| 814 WASM_EXEC_TEST(Ui32x4Min) { | 809 WASM_EXEC_TEST(Ui32x4Min) { | 
| 815   RunI32x4BinOpTest(kExprI32x4MinU, UnsignedMinimum); | 810   RunI32x4BinOpTest(kExprI32x4MinU, UnsignedMinimum); | 
| 816 } | 811 } | 
| 817 | 812 | 
| 818 WASM_EXEC_TEST(Ui32x4Max) { | 813 WASM_EXEC_TEST(Ui32x4Max) { | 
| 819   RunI32x4BinOpTest(kExprI32x4MaxU, UnsignedMaximum); | 814   RunI32x4BinOpTest(kExprI32x4MaxU, UnsignedMaximum); | 
| 820 } | 815 } | 
| 821 | 816 | 
| 822 WASM_EXEC_TEST(Ui32x4Greater) { |  | 
| 823   RunI32x4BinOpTest(kExprI32x4GtU, UnsignedGreater); |  | 
| 824 } |  | 
| 825 |  | 
| 826 WASM_EXEC_TEST(Ui32x4GreaterEqual) { |  | 
| 827   RunI32x4BinOpTest(kExprI32x4GeU, UnsignedGreaterEqual); |  | 
| 828 } |  | 
| 829 |  | 
| 830 WASM_EXEC_TEST(Ui32x4Less) { RunI32x4BinOpTest(kExprI32x4LtU, UnsignedLess); } |  | 
| 831 |  | 
| 832 WASM_EXEC_TEST(Ui32x4LessEqual) { |  | 
| 833   RunI32x4BinOpTest(kExprI32x4LeU, UnsignedLessEqual); |  | 
| 834 } |  | 
| 835 |  | 
| 836 WASM_EXEC_TEST(S128And) { RunI32x4BinOpTest(kExprS128And, And); } | 817 WASM_EXEC_TEST(S128And) { RunI32x4BinOpTest(kExprS128And, And); } | 
| 837 | 818 | 
| 838 WASM_EXEC_TEST(S128Or) { RunI32x4BinOpTest(kExprS128Or, Or); } | 819 WASM_EXEC_TEST(S128Or) { RunI32x4BinOpTest(kExprS128Or, Or); } | 
| 839 | 820 | 
| 840 WASM_EXEC_TEST(S128Xor) { RunI32x4BinOpTest(kExprS128Xor, Xor); } | 821 WASM_EXEC_TEST(S128Xor) { RunI32x4BinOpTest(kExprS128Xor, Xor); } | 
| 841 | 822 | 
|  | 823 void RunI32x4CompareOpTest(WasmOpcode simd_op, Int32BinOp expected_op) { | 
|  | 824   FLAG_wasm_simd_prototype = true; | 
|  | 825   WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); | 
|  | 826   byte a = 0; | 
|  | 827   byte b = 1; | 
|  | 828   byte expected = 2; | 
|  | 829   byte simd0 = r.AllocateLocal(kWasmS128); | 
|  | 830   byte simd1 = r.AllocateLocal(kWasmS128); | 
|  | 831   BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), | 
|  | 832         WASM_SET_LOCAL(simd1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(b))), | 
|  | 833         WASM_SET_LOCAL(simd1, | 
|  | 834                        WASM_SIMD_MATERIALIZE_BOOLS( | 
|  | 835                            32x4, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), | 
|  | 836                                                  WASM_GET_LOCAL(simd1)))), | 
|  | 837         WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE); | 
|  | 838 | 
|  | 839   FOR_INT32_INPUTS(i) { | 
|  | 840     FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } | 
|  | 841   } | 
|  | 842 } | 
|  | 843 | 
|  | 844 WASM_EXEC_TEST(I32x4Equal) { RunI32x4CompareOpTest(kExprI32x4Eq, Equal); } | 
|  | 845 | 
|  | 846 WASM_EXEC_TEST(I32x4NotEqual) { RunI32x4CompareOpTest(kExprI32x4Ne, NotEqual); } | 
|  | 847 | 
|  | 848 WASM_EXEC_TEST(I32x4Greater) { RunI32x4CompareOpTest(kExprI32x4GtS, Greater); } | 
|  | 849 | 
|  | 850 WASM_EXEC_TEST(I32x4GreaterEqual) { | 
|  | 851   RunI32x4CompareOpTest(kExprI32x4GeS, GreaterEqual); | 
|  | 852 } | 
|  | 853 | 
|  | 854 WASM_EXEC_TEST(I32x4Less) { RunI32x4CompareOpTest(kExprI32x4LtS, Less); } | 
|  | 855 | 
|  | 856 WASM_EXEC_TEST(I32x4LessEqual) { | 
|  | 857   RunI32x4CompareOpTest(kExprI32x4LeS, LessEqual); | 
|  | 858 } | 
|  | 859 | 
|  | 860 WASM_EXEC_TEST(Ui32x4Greater) { | 
|  | 861   RunI32x4CompareOpTest(kExprI32x4GtU, UnsignedGreater); | 
|  | 862 } | 
|  | 863 | 
|  | 864 WASM_EXEC_TEST(Ui32x4GreaterEqual) { | 
|  | 865   RunI32x4CompareOpTest(kExprI32x4GeU, UnsignedGreaterEqual); | 
|  | 866 } | 
|  | 867 | 
|  | 868 WASM_EXEC_TEST(Ui32x4Less) { | 
|  | 869   RunI32x4CompareOpTest(kExprI32x4LtU, UnsignedLess); | 
|  | 870 } | 
|  | 871 | 
|  | 872 WASM_EXEC_TEST(Ui32x4LessEqual) { | 
|  | 873   RunI32x4CompareOpTest(kExprI32x4LeU, UnsignedLessEqual); | 
|  | 874 } | 
|  | 875 | 
| 842 void RunI32x4ShiftOpTest(WasmOpcode simd_op, Int32ShiftOp expected_op, | 876 void RunI32x4ShiftOpTest(WasmOpcode simd_op, Int32ShiftOp expected_op, | 
| 843                          int shift) { | 877                          int shift) { | 
| 844   FLAG_wasm_simd_prototype = true; | 878   FLAG_wasm_simd_prototype = true; | 
| 845   WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 879   WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 
| 846   byte a = 0; | 880   byte a = 0; | 
| 847   byte expected = 1; | 881   byte expected = 1; | 
| 848   byte simd = r.AllocateLocal(kWasmS128); | 882   byte simd = r.AllocateLocal(kWasmS128); | 
| 849   BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), | 883   BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), | 
| 850         WASM_SET_LOCAL( | 884         WASM_SET_LOCAL( | 
| 851             simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), | 885             simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), | 
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 911 WASM_EXEC_TEST(I16x8SubSaturate) { | 945 WASM_EXEC_TEST(I16x8SubSaturate) { | 
| 912   RunI16x8BinOpTest(kExprI16x8SubSaturateS, SubSaturate); | 946   RunI16x8BinOpTest(kExprI16x8SubSaturateS, SubSaturate); | 
| 913 } | 947 } | 
| 914 | 948 | 
| 915 WASM_EXEC_TEST(I16x8Mul) { RunI16x8BinOpTest(kExprI16x8Mul, Mul); } | 949 WASM_EXEC_TEST(I16x8Mul) { RunI16x8BinOpTest(kExprI16x8Mul, Mul); } | 
| 916 | 950 | 
| 917 WASM_EXEC_TEST(I16x8Min) { RunI16x8BinOpTest(kExprI16x8MinS, Minimum); } | 951 WASM_EXEC_TEST(I16x8Min) { RunI16x8BinOpTest(kExprI16x8MinS, Minimum); } | 
| 918 | 952 | 
| 919 WASM_EXEC_TEST(I16x8Max) { RunI16x8BinOpTest(kExprI16x8MaxS, Maximum); } | 953 WASM_EXEC_TEST(I16x8Max) { RunI16x8BinOpTest(kExprI16x8MaxS, Maximum); } | 
| 920 | 954 | 
| 921 WASM_EXEC_TEST(I16x8Equal) { RunI16x8BinOpTest(kExprI16x8Eq, Equal); } |  | 
| 922 |  | 
| 923 WASM_EXEC_TEST(I16x8NotEqual) { RunI16x8BinOpTest(kExprI16x8Ne, NotEqual); } |  | 
| 924 |  | 
| 925 WASM_EXEC_TEST(I16x8Greater) { RunI16x8BinOpTest(kExprI16x8GtS, Greater); } |  | 
| 926 |  | 
| 927 WASM_EXEC_TEST(I16x8GreaterEqual) { |  | 
| 928   RunI16x8BinOpTest(kExprI16x8GeS, GreaterEqual); |  | 
| 929 } |  | 
| 930 |  | 
| 931 WASM_EXEC_TEST(I16x8Less) { RunI16x8BinOpTest(kExprI16x8LtS, Less); } |  | 
| 932 |  | 
| 933 WASM_EXEC_TEST(I16x8LessEqual) { RunI16x8BinOpTest(kExprI16x8LeS, LessEqual); } |  | 
| 934 |  | 
| 935 WASM_EXEC_TEST(Ui16x8AddSaturate) { | 955 WASM_EXEC_TEST(Ui16x8AddSaturate) { | 
| 936   RunI16x8BinOpTest(kExprI16x8AddSaturateU, UnsignedAddSaturate); | 956   RunI16x8BinOpTest(kExprI16x8AddSaturateU, UnsignedAddSaturate); | 
| 937 } | 957 } | 
| 938 | 958 | 
| 939 WASM_EXEC_TEST(Ui16x8SubSaturate) { | 959 WASM_EXEC_TEST(Ui16x8SubSaturate) { | 
| 940   RunI16x8BinOpTest(kExprI16x8SubSaturateU, UnsignedSubSaturate); | 960   RunI16x8BinOpTest(kExprI16x8SubSaturateU, UnsignedSubSaturate); | 
| 941 } | 961 } | 
| 942 | 962 | 
| 943 WASM_EXEC_TEST(Ui16x8Min) { | 963 WASM_EXEC_TEST(Ui16x8Min) { | 
| 944   RunI16x8BinOpTest(kExprI16x8MinU, UnsignedMinimum); | 964   RunI16x8BinOpTest(kExprI16x8MinU, UnsignedMinimum); | 
| 945 } | 965 } | 
| 946 | 966 | 
| 947 WASM_EXEC_TEST(Ui16x8Max) { | 967 WASM_EXEC_TEST(Ui16x8Max) { | 
| 948   RunI16x8BinOpTest(kExprI16x8MaxU, UnsignedMaximum); | 968   RunI16x8BinOpTest(kExprI16x8MaxU, UnsignedMaximum); | 
| 949 } | 969 } | 
| 950 | 970 | 
|  | 971 void RunI16x8CompareOpTest(WasmOpcode simd_op, Int16BinOp expected_op) { | 
|  | 972   FLAG_wasm_simd_prototype = true; | 
|  | 973   WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); | 
|  | 974   byte a = 0; | 
|  | 975   byte b = 1; | 
|  | 976   byte expected = 2; | 
|  | 977   byte simd0 = r.AllocateLocal(kWasmS128); | 
|  | 978   byte simd1 = r.AllocateLocal(kWasmS128); | 
|  | 979   BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), | 
|  | 980         WASM_SET_LOCAL(simd1, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(b))), | 
|  | 981         WASM_SET_LOCAL(simd1, | 
|  | 982                        WASM_SIMD_MATERIALIZE_BOOLS( | 
|  | 983                            16x8, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), | 
|  | 984                                                  WASM_GET_LOCAL(simd1)))), | 
|  | 985         WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected), WASM_ONE); | 
|  | 986 | 
|  | 987   FOR_INT16_INPUTS(i) { | 
|  | 988     FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } | 
|  | 989   } | 
|  | 990 } | 
|  | 991 | 
|  | 992 WASM_EXEC_TEST(I16x8Equal) { RunI16x8CompareOpTest(kExprI16x8Eq, Equal); } | 
|  | 993 | 
|  | 994 WASM_EXEC_TEST(I16x8NotEqual) { RunI16x8CompareOpTest(kExprI16x8Ne, NotEqual); } | 
|  | 995 | 
|  | 996 WASM_EXEC_TEST(I16x8Greater) { RunI16x8CompareOpTest(kExprI16x8GtS, Greater); } | 
|  | 997 | 
|  | 998 WASM_EXEC_TEST(I16x8GreaterEqual) { | 
|  | 999   RunI16x8CompareOpTest(kExprI16x8GeS, GreaterEqual); | 
|  | 1000 } | 
|  | 1001 | 
|  | 1002 WASM_EXEC_TEST(I16x8Less) { RunI16x8CompareOpTest(kExprI16x8LtS, Less); } | 
|  | 1003 | 
|  | 1004 WASM_EXEC_TEST(I16x8LessEqual) { | 
|  | 1005   RunI16x8CompareOpTest(kExprI16x8LeS, LessEqual); | 
|  | 1006 } | 
|  | 1007 | 
| 951 WASM_EXEC_TEST(Ui16x8Greater) { | 1008 WASM_EXEC_TEST(Ui16x8Greater) { | 
| 952   RunI16x8BinOpTest(kExprI16x8GtU, UnsignedGreater); | 1009   RunI16x8CompareOpTest(kExprI16x8GtU, UnsignedGreater); | 
| 953 } | 1010 } | 
| 954 | 1011 | 
| 955 WASM_EXEC_TEST(Ui16x8GreaterEqual) { | 1012 WASM_EXEC_TEST(Ui16x8GreaterEqual) { | 
| 956   RunI16x8BinOpTest(kExprI16x8GeU, UnsignedGreaterEqual); | 1013   RunI16x8CompareOpTest(kExprI16x8GeU, UnsignedGreaterEqual); | 
| 957 } | 1014 } | 
| 958 | 1015 | 
| 959 WASM_EXEC_TEST(Ui16x8Less) { RunI16x8BinOpTest(kExprI16x8LtU, UnsignedLess); } | 1016 WASM_EXEC_TEST(Ui16x8Less) { | 
|  | 1017   RunI16x8CompareOpTest(kExprI16x8LtU, UnsignedLess); | 
|  | 1018 } | 
| 960 | 1019 | 
| 961 WASM_EXEC_TEST(Ui16x8LessEqual) { | 1020 WASM_EXEC_TEST(Ui16x8LessEqual) { | 
| 962   RunI16x8BinOpTest(kExprI16x8LeU, UnsignedLessEqual); | 1021   RunI16x8CompareOpTest(kExprI16x8LeU, UnsignedLessEqual); | 
| 963 } | 1022 } | 
| 964 | 1023 | 
| 965 void RunI16x8ShiftOpTest(WasmOpcode simd_op, Int16ShiftOp expected_op, | 1024 void RunI16x8ShiftOpTest(WasmOpcode simd_op, Int16ShiftOp expected_op, | 
| 966                          int shift) { | 1025                          int shift) { | 
| 967   FLAG_wasm_simd_prototype = true; | 1026   FLAG_wasm_simd_prototype = true; | 
| 968   WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 1027   WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 
| 969   byte a = 0; | 1028   byte a = 0; | 
| 970   byte expected = 1; | 1029   byte expected = 1; | 
| 971   byte simd = r.AllocateLocal(kWasmS128); | 1030   byte simd = r.AllocateLocal(kWasmS128); | 
| 972   BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), | 1031   BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), | 
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1034 WASM_EXEC_TEST(I8x16SubSaturate) { | 1093 WASM_EXEC_TEST(I8x16SubSaturate) { | 
| 1035   RunI8x16BinOpTest(kExprI8x16SubSaturateS, SubSaturate); | 1094   RunI8x16BinOpTest(kExprI8x16SubSaturateS, SubSaturate); | 
| 1036 } | 1095 } | 
| 1037 | 1096 | 
| 1038 WASM_EXEC_TEST(I8x16Mul) { RunI8x16BinOpTest(kExprI8x16Mul, Mul); } | 1097 WASM_EXEC_TEST(I8x16Mul) { RunI8x16BinOpTest(kExprI8x16Mul, Mul); } | 
| 1039 | 1098 | 
| 1040 WASM_EXEC_TEST(I8x16Min) { RunI8x16BinOpTest(kExprI8x16MinS, Minimum); } | 1099 WASM_EXEC_TEST(I8x16Min) { RunI8x16BinOpTest(kExprI8x16MinS, Minimum); } | 
| 1041 | 1100 | 
| 1042 WASM_EXEC_TEST(I8x16Max) { RunI8x16BinOpTest(kExprI8x16MaxS, Maximum); } | 1101 WASM_EXEC_TEST(I8x16Max) { RunI8x16BinOpTest(kExprI8x16MaxS, Maximum); } | 
| 1043 | 1102 | 
| 1044 WASM_EXEC_TEST(I8x16Equal) { RunI8x16BinOpTest(kExprI8x16Eq, Equal); } |  | 
| 1045 |  | 
| 1046 WASM_EXEC_TEST(I8x16NotEqual) { RunI8x16BinOpTest(kExprI8x16Ne, NotEqual); } |  | 
| 1047 |  | 
| 1048 WASM_EXEC_TEST(I8x16Greater) { RunI8x16BinOpTest(kExprI8x16GtS, Greater); } |  | 
| 1049 |  | 
| 1050 WASM_EXEC_TEST(I8x16GreaterEqual) { |  | 
| 1051   RunI8x16BinOpTest(kExprI8x16GeS, GreaterEqual); |  | 
| 1052 } |  | 
| 1053 |  | 
| 1054 WASM_EXEC_TEST(I8x16Less) { RunI8x16BinOpTest(kExprI8x16LtS, Less); } |  | 
| 1055 |  | 
| 1056 WASM_EXEC_TEST(I8x16LessEqual) { RunI8x16BinOpTest(kExprI8x16LeS, LessEqual); } |  | 
| 1057 |  | 
| 1058 WASM_EXEC_TEST(Ui8x16AddSaturate) { | 1103 WASM_EXEC_TEST(Ui8x16AddSaturate) { | 
| 1059   RunI8x16BinOpTest(kExprI8x16AddSaturateU, UnsignedAddSaturate); | 1104   RunI8x16BinOpTest(kExprI8x16AddSaturateU, UnsignedAddSaturate); | 
| 1060 } | 1105 } | 
| 1061 | 1106 | 
| 1062 WASM_EXEC_TEST(Ui8x16SubSaturate) { | 1107 WASM_EXEC_TEST(Ui8x16SubSaturate) { | 
| 1063   RunI8x16BinOpTest(kExprI8x16SubSaturateU, UnsignedSubSaturate); | 1108   RunI8x16BinOpTest(kExprI8x16SubSaturateU, UnsignedSubSaturate); | 
| 1064 } | 1109 } | 
| 1065 | 1110 | 
| 1066 WASM_EXEC_TEST(Ui8x16Min) { | 1111 WASM_EXEC_TEST(Ui8x16Min) { | 
| 1067   RunI8x16BinOpTest(kExprI8x16MinU, UnsignedMinimum); | 1112   RunI8x16BinOpTest(kExprI8x16MinU, UnsignedMinimum); | 
| 1068 } | 1113 } | 
| 1069 | 1114 | 
| 1070 WASM_EXEC_TEST(Ui8x16Max) { | 1115 WASM_EXEC_TEST(Ui8x16Max) { | 
| 1071   RunI8x16BinOpTest(kExprI8x16MaxU, UnsignedMaximum); | 1116   RunI8x16BinOpTest(kExprI8x16MaxU, UnsignedMaximum); | 
| 1072 } | 1117 } | 
| 1073 | 1118 | 
|  | 1119 void RunI8x16CompareOpTest(WasmOpcode simd_op, Int8BinOp expected_op) { | 
|  | 1120   FLAG_wasm_simd_prototype = true; | 
|  | 1121   WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); | 
|  | 1122   byte a = 0; | 
|  | 1123   byte b = 1; | 
|  | 1124   byte expected = 2; | 
|  | 1125   byte simd0 = r.AllocateLocal(kWasmS128); | 
|  | 1126   byte simd1 = r.AllocateLocal(kWasmS128); | 
|  | 1127   BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), | 
|  | 1128         WASM_SET_LOCAL(simd1, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(b))), | 
|  | 1129         WASM_SET_LOCAL(simd1, | 
|  | 1130                        WASM_SIMD_MATERIALIZE_BOOLS( | 
|  | 1131                            8x16, WASM_SIMD_BINOP(simd_op, WASM_GET_LOCAL(simd0), | 
|  | 1132                                                  WASM_GET_LOCAL(simd1)))), | 
|  | 1133         WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected), WASM_ONE); | 
|  | 1134 | 
|  | 1135   FOR_INT8_INPUTS(i) { | 
|  | 1136     FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } | 
|  | 1137   } | 
|  | 1138 } | 
|  | 1139 | 
|  | 1140 WASM_EXEC_TEST(I8x16Equal) { RunI8x16CompareOpTest(kExprI8x16Eq, Equal); } | 
|  | 1141 | 
|  | 1142 WASM_EXEC_TEST(I8x16NotEqual) { RunI8x16CompareOpTest(kExprI8x16Ne, NotEqual); } | 
|  | 1143 | 
|  | 1144 WASM_EXEC_TEST(I8x16Greater) { RunI8x16CompareOpTest(kExprI8x16GtS, Greater); } | 
|  | 1145 | 
|  | 1146 WASM_EXEC_TEST(I8x16GreaterEqual) { | 
|  | 1147   RunI8x16CompareOpTest(kExprI8x16GeS, GreaterEqual); | 
|  | 1148 } | 
|  | 1149 | 
|  | 1150 WASM_EXEC_TEST(I8x16Less) { RunI8x16CompareOpTest(kExprI8x16LtS, Less); } | 
|  | 1151 | 
|  | 1152 WASM_EXEC_TEST(I8x16LessEqual) { | 
|  | 1153   RunI8x16CompareOpTest(kExprI8x16LeS, LessEqual); | 
|  | 1154 } | 
|  | 1155 | 
| 1074 WASM_EXEC_TEST(Ui8x16Greater) { | 1156 WASM_EXEC_TEST(Ui8x16Greater) { | 
| 1075   RunI8x16BinOpTest(kExprI8x16GtU, UnsignedGreater); | 1157   RunI8x16CompareOpTest(kExprI8x16GtU, UnsignedGreater); | 
| 1076 } | 1158 } | 
| 1077 | 1159 | 
| 1078 WASM_EXEC_TEST(Ui8x16GreaterEqual) { | 1160 WASM_EXEC_TEST(Ui8x16GreaterEqual) { | 
| 1079   RunI8x16BinOpTest(kExprI8x16GeU, UnsignedGreaterEqual); | 1161   RunI8x16CompareOpTest(kExprI8x16GeU, UnsignedGreaterEqual); | 
| 1080 } | 1162 } | 
| 1081 | 1163 | 
| 1082 WASM_EXEC_TEST(Ui8x16Less) { RunI8x16BinOpTest(kExprI8x16LtU, UnsignedLess); } | 1164 WASM_EXEC_TEST(Ui8x16Less) { | 
|  | 1165   RunI8x16CompareOpTest(kExprI8x16LtU, UnsignedLess); | 
|  | 1166 } | 
| 1083 | 1167 | 
| 1084 WASM_EXEC_TEST(Ui8x16LessEqual) { | 1168 WASM_EXEC_TEST(Ui8x16LessEqual) { | 
| 1085   RunI8x16BinOpTest(kExprI8x16LeU, UnsignedLessEqual); | 1169   RunI8x16CompareOpTest(kExprI8x16LeU, UnsignedLessEqual); | 
| 1086 } | 1170 } | 
| 1087 | 1171 | 
| 1088 void RunI8x16ShiftOpTest(WasmOpcode simd_op, Int8ShiftOp expected_op, | 1172 void RunI8x16ShiftOpTest(WasmOpcode simd_op, Int8ShiftOp expected_op, | 
| 1089                          int shift) { | 1173                          int shift) { | 
| 1090   FLAG_wasm_simd_prototype = true; | 1174   FLAG_wasm_simd_prototype = true; | 
| 1091   WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 1175   WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 
| 1092   byte a = 0; | 1176   byte a = 0; | 
| 1093   byte expected = 1; | 1177   byte expected = 1; | 
| 1094   byte simd = r.AllocateLocal(kWasmS128); | 1178   byte simd = r.AllocateLocal(kWasmS128); | 
| 1095   BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), | 1179   BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), | 
| 1096         WASM_SET_LOCAL( | 1180         WASM_SET_LOCAL( | 
| 1097             simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), | 1181             simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))), | 
| 1098         WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE); | 1182         WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE); | 
| 1099 | 1183 | 
| 1100   FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); } | 1184   FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); } | 
| 1101 } | 1185 } | 
| 1102 | 1186 | 
| 1103 WASM_EXEC_TEST(I8x16Shl) { | 1187 WASM_EXEC_TEST(I8x16Shl) { | 
| 1104   RunI8x16ShiftOpTest(kExprI8x16Shl, LogicalShiftLeft, 1); | 1188   RunI8x16ShiftOpTest(kExprI8x16Shl, LogicalShiftLeft, 1); | 
| 1105 } | 1189 } | 
| 1106 | 1190 | 
| 1107 WASM_EXEC_TEST(I8x16ShrS) { | 1191 WASM_EXEC_TEST(I8x16ShrS) { | 
| 1108   RunI8x16ShiftOpTest(kExprI8x16ShrS, ArithmeticShiftRight, 1); | 1192   RunI8x16ShiftOpTest(kExprI8x16ShrS, ArithmeticShiftRight, 1); | 
| 1109 } | 1193 } | 
| 1110 | 1194 | 
| 1111 WASM_EXEC_TEST(I8x16ShrU) { | 1195 WASM_EXEC_TEST(I8x16ShrU) { | 
| 1112   RunI8x16ShiftOpTest(kExprI8x16ShrU, LogicalShiftRight, 1); | 1196   RunI8x16ShiftOpTest(kExprI8x16ShrU, LogicalShiftRight, 1); | 
| 1113 } | 1197 } | 
| 1114 | 1198 | 
|  | 1199 // Test Select by making a mask where the first two lanes are true and the rest | 
|  | 1200 // false, and comparing for non-equality with zero to materialize a bool vector. | 
| 1115 #define WASM_SIMD_SELECT_TEST(format)                                         \ | 1201 #define WASM_SIMD_SELECT_TEST(format)                                         \ | 
| 1116   WASM_EXEC_TEST(S##format##Select) {                                         \ | 1202   WASM_EXEC_TEST(S##format##Select) {                                         \ | 
| 1117     FLAG_wasm_simd_prototype = true;                                          \ | 1203     FLAG_wasm_simd_prototype = true;                                          \ | 
| 1118     WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);                \ | 1204     WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);                \ | 
| 1119     byte val1 = 0;                                                            \ | 1205     byte val1 = 0;                                                            \ | 
| 1120     byte val2 = 1;                                                            \ | 1206     byte val2 = 1;                                                            \ | 
| 1121     byte mask = r.AllocateLocal(kWasmS128);                                   \ |  | 
| 1122     byte src1 = r.AllocateLocal(kWasmS128);                                   \ | 1207     byte src1 = r.AllocateLocal(kWasmS128);                                   \ | 
| 1123     byte src2 = r.AllocateLocal(kWasmS128);                                   \ | 1208     byte src2 = r.AllocateLocal(kWasmS128);                                   \ | 
| 1124     BUILD(r, WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_SPLAT(WASM_ZERO)),    \ | 1209     byte zero = r.AllocateLocal(kWasmS128);                                   \ | 
| 1125           WASM_SET_LOCAL(src1,                                                \ | 1210     byte mask = r.AllocateLocal(kWasmS128);                                   \ | 
| 1126                          WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val1))),  \ | 1211     BUILD(r, WASM_SET_LOCAL(                                                  \ | 
|  | 1212                  src1, WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val1))),    \ | 
| 1127           WASM_SET_LOCAL(src2,                                                \ | 1213           WASM_SET_LOCAL(src2,                                                \ | 
| 1128                          WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val2))),  \ | 1214                          WASM_SIMD_I##format##_SPLAT(WASM_GET_LOCAL(val2))),  \ | 
|  | 1215           WASM_SET_LOCAL(zero, WASM_SIMD_I##format##_SPLAT(WASM_ZERO)),       \ | 
| 1129           WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE(            \ | 1216           WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE(            \ | 
| 1130                                    1, WASM_GET_LOCAL(mask), WASM_I32V(-1))),  \ | 1217                                    1, WASM_GET_LOCAL(zero), WASM_I32V(-1))),  \ | 
| 1131           WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE(            \ | 1218           WASM_SET_LOCAL(mask, WASM_SIMD_I##format##_REPLACE_LANE(            \ | 
| 1132                                    2, WASM_GET_LOCAL(mask), WASM_I32V(-1))),  \ | 1219                                    2, WASM_GET_LOCAL(mask), WASM_I32V(-1))),  \ | 
| 1133           WASM_SET_LOCAL(mask, WASM_SIMD_SELECT(format, WASM_GET_LOCAL(mask), \ | 1220           WASM_SET_LOCAL(                                                     \ | 
| 1134                                                 WASM_GET_LOCAL(src1),         \ | 1221               mask,                                                           \ | 
| 1135                                                 WASM_GET_LOCAL(src2))),       \ | 1222               WASM_SIMD_SELECT(format, WASM_SIMD_BINOP(kExprI##format##Ne,    \ | 
|  | 1223                                                        WASM_GET_LOCAL(mask),  \ | 
|  | 1224                                                        WASM_GET_LOCAL(zero)), \ | 
|  | 1225                                WASM_GET_LOCAL(src1), WASM_GET_LOCAL(src2))),  \ | 
| 1136           WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 0),                \ | 1226           WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 0),                \ | 
| 1137           WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 1),                \ | 1227           WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 1),                \ | 
| 1138           WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 2),                \ | 1228           WASM_SIMD_CHECK_LANE(I##format, mask, I32, val1, 2),                \ | 
| 1139           WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE);     \ | 1229           WASM_SIMD_CHECK_LANE(I##format, mask, I32, val2, 3), WASM_ONE);     \ | 
| 1140                                                                               \ | 1230                                                                               \ | 
| 1141     CHECK_EQ(1, r.Call(0x12, 0x34));                                          \ | 1231     CHECK_EQ(1, r.Call(0x12, 0x34));                                          \ | 
| 1142   } | 1232   } | 
| 1143 | 1233 | 
| 1144 WASM_SIMD_SELECT_TEST(32x4) | 1234 WASM_SIMD_SELECT_TEST(32x4) | 
| 1145 WASM_SIMD_SELECT_TEST(16x8) | 1235 WASM_SIMD_SELECT_TEST(16x8) | 
| 1146 WASM_SIMD_SELECT_TEST(8x16) | 1236 WASM_SIMD_SELECT_TEST(8x16) | 
| 1147 #endif  // V8_TARGET_ARCH_ARM | 1237 #endif  // V8_TARGET_ARCH_ARM | 
| OLD | NEW | 
|---|