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 970 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 WASM_EXEC_COMPILED_TEST(I32x4Add) { RunI32x4BinOpTest(kExprI32x4Add, Add); } | 981 WASM_EXEC_COMPILED_TEST(I32x4Add) { RunI32x4BinOpTest(kExprI32x4Add, Add); } |
982 | 982 |
983 WASM_EXEC_COMPILED_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); } | 983 WASM_EXEC_COMPILED_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); } |
984 | 984 |
985 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || \ | 985 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || \ |
986 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 986 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
987 WASM_EXEC_COMPILED_TEST(I32x4Mul) { RunI32x4BinOpTest(kExprI32x4Mul, Mul); } | 987 WASM_EXEC_COMPILED_TEST(I32x4Mul) { RunI32x4BinOpTest(kExprI32x4Mul, Mul); } |
988 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || | 988 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || |
989 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 989 // V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
990 | 990 |
991 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 991 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
992 WASM_EXEC_COMPILED_TEST(S128And) { RunI32x4BinOpTest(kExprS128And, And); } | 992 WASM_EXEC_COMPILED_TEST(S128And) { RunI32x4BinOpTest(kExprS128And, And); } |
993 | 993 |
994 WASM_EXEC_COMPILED_TEST(S128Or) { RunI32x4BinOpTest(kExprS128Or, Or); } | 994 WASM_EXEC_COMPILED_TEST(S128Or) { RunI32x4BinOpTest(kExprS128Or, Or); } |
995 | 995 |
996 WASM_EXEC_COMPILED_TEST(S128Xor) { RunI32x4BinOpTest(kExprS128Xor, Xor); } | 996 WASM_EXEC_COMPILED_TEST(S128Xor) { RunI32x4BinOpTest(kExprS128Xor, Xor); } |
997 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 997 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
998 | 998 |
999 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || \ | 999 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 || SIMD_LOWERING_TARGET || \ |
1000 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 | 1000 V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
1001 WASM_EXEC_COMPILED_TEST(I32x4Min) { | 1001 WASM_EXEC_COMPILED_TEST(I32x4Min) { |
1002 RunI32x4BinOpTest(kExprI32x4MinS, Minimum); | 1002 RunI32x4BinOpTest(kExprI32x4MinS, Minimum); |
1003 } | 1003 } |
1004 | 1004 |
1005 WASM_EXEC_COMPILED_TEST(I32x4MaxS) { | 1005 WASM_EXEC_COMPILED_TEST(I32x4MaxS) { |
1006 RunI32x4BinOpTest(kExprI32x4MaxS, Maximum); | 1006 RunI32x4BinOpTest(kExprI32x4MaxS, Maximum); |
1007 } | 1007 } |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1610 | 1610 |
1611 WASM_EXEC_COMPILED_TEST(S8x4Reverse) { | 1611 WASM_EXEC_COMPILED_TEST(S8x4Reverse) { |
1612 RunUnaryLaneOpTest<int8_t>(kExprS8x4Reverse, {{3, 2, 1, 0, 7, 6, 5, 4, 11, 10, | 1612 RunUnaryLaneOpTest<int8_t>(kExprS8x4Reverse, {{3, 2, 1, 0, 7, 6, 5, 4, 11, 10, |
1613 9, 8, 15, 14, 13, 12}}); | 1613 9, 8, 15, 14, 13, 12}}); |
1614 } | 1614 } |
1615 | 1615 |
1616 WASM_EXEC_COMPILED_TEST(S8x2Reverse) { | 1616 WASM_EXEC_COMPILED_TEST(S8x2Reverse) { |
1617 RunUnaryLaneOpTest<int8_t>(kExprS8x2Reverse, {{1, 0, 3, 2, 5, 4, 7, 6, 9, 8, | 1617 RunUnaryLaneOpTest<int8_t>(kExprS8x2Reverse, {{1, 0, 3, 2, 5, 4, 7, 6, 9, 8, |
1618 11, 10, 13, 12, 15, 14}}); | 1618 11, 10, 13, 12, 15, 14}}); |
1619 } | 1619 } |
| 1620 #endif // V8_TARGET_ARCH_ARM |
1620 | 1621 |
| 1622 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 |
1621 // Test binary ops with two lane test patterns, all lanes distinct. | 1623 // Test binary ops with two lane test patterns, all lanes distinct. |
1622 template <typename T> | 1624 template <typename T> |
1623 void RunBinaryLaneOpTest( | 1625 void RunBinaryLaneOpTest( |
1624 WasmOpcode simd_op, | 1626 WasmOpcode simd_op, |
1625 const std::array<T, kSimd128Size / sizeof(T)>& expected) { | 1627 const std::array<T, kSimd128Size / sizeof(T)>& expected) { |
1626 FLAG_wasm_simd_prototype = true; | 1628 FLAG_wasm_simd_prototype = true; |
1627 WasmRunner<int32_t> r(kExecuteCompiled); | 1629 WasmRunner<int32_t> r(kExecuteCompiled); |
1628 // Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7]. | 1630 // Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7]. |
1629 T* global1 = r.module().AddGlobal<T>(kWasmS128); | 1631 T* global1 = r.module().AddGlobal<T>(kWasmS128); |
1630 T* global2 = r.module().AddGlobal<T>(kWasmS128); | 1632 T* global2 = r.module().AddGlobal<T>(kWasmS128); |
1631 static const size_t kElems = kSimd128Size / sizeof(T); | 1633 static const size_t kElems = kSimd128Size / sizeof(T); |
1632 for (size_t i = 0; i < kElems; i++) { | 1634 for (size_t i = 0; i < kElems; i++) { |
1633 global1[i] = i; | 1635 global1[i] = static_cast<T>(i); |
1634 global2[i] = kElems + i; | 1636 global2[i] = static_cast<T>(kElems + i); |
1635 } | 1637 } |
1636 BUILD(r, | 1638 BUILD(r, |
1637 WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(simd_op, WASM_GET_GLOBAL(0), | 1639 WASM_SET_GLOBAL(0, WASM_SIMD_BINOP(simd_op, WASM_GET_GLOBAL(0), |
1638 WASM_GET_GLOBAL(1))), | 1640 WASM_GET_GLOBAL(1))), |
1639 WASM_ONE); | 1641 WASM_ONE); |
1640 | 1642 |
1641 CHECK_EQ(1, r.Call()); | 1643 CHECK_EQ(1, r.Call()); |
1642 for (size_t i = 0; i < expected.size(); i++) { | 1644 for (size_t i = 0; i < expected.size(); i++) { |
1643 CHECK_EQ(global1[i], expected[i]); | 1645 CHECK_EQ(global1[i], expected[i]); |
1644 } | 1646 } |
1645 } | 1647 } |
1646 | 1648 |
1647 WASM_EXEC_COMPILED_TEST(F32x4AddHoriz) { | |
1648 RunBinaryLaneOpTest<float>(kExprF32x4AddHoriz, {{1.0f, 5.0f, 9.0f, 13.0f}}); | |
1649 } | |
1650 | |
1651 WASM_EXEC_COMPILED_TEST(I32x4AddHoriz) { | 1649 WASM_EXEC_COMPILED_TEST(I32x4AddHoriz) { |
1652 RunBinaryLaneOpTest<int32_t>(kExprI32x4AddHoriz, {{1, 5, 9, 13}}); | 1650 RunBinaryLaneOpTest<int32_t>(kExprI32x4AddHoriz, {{1, 5, 9, 13}}); |
1653 } | 1651 } |
1654 | 1652 |
1655 WASM_EXEC_COMPILED_TEST(I16x8AddHoriz) { | 1653 WASM_EXEC_COMPILED_TEST(I16x8AddHoriz) { |
1656 RunBinaryLaneOpTest<int16_t>(kExprI16x8AddHoriz, | 1654 RunBinaryLaneOpTest<int16_t>(kExprI16x8AddHoriz, |
1657 {{1, 5, 9, 13, 17, 21, 25, 29}}); | 1655 {{1, 5, 9, 13, 17, 21, 25, 29}}); |
1658 } | 1656 } |
| 1657 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_X64 |
| 1658 |
| 1659 #if V8_TARGET_ARCH_ARM |
| 1660 WASM_EXEC_COMPILED_TEST(F32x4AddHoriz) { |
| 1661 RunBinaryLaneOpTest<float>(kExprF32x4AddHoriz, {{1.0f, 5.0f, 9.0f, 13.0f}}); |
| 1662 } |
1659 | 1663 |
1660 WASM_EXEC_COMPILED_TEST(S32x4ZipLeft) { | 1664 WASM_EXEC_COMPILED_TEST(S32x4ZipLeft) { |
1661 RunBinaryLaneOpTest<int32_t>(kExprS32x4ZipLeft, {{0, 4, 1, 5}}); | 1665 RunBinaryLaneOpTest<int32_t>(kExprS32x4ZipLeft, {{0, 4, 1, 5}}); |
1662 } | 1666 } |
1663 | 1667 |
1664 WASM_EXEC_COMPILED_TEST(S32x4ZipRight) { | 1668 WASM_EXEC_COMPILED_TEST(S32x4ZipRight) { |
1665 RunBinaryLaneOpTest<int32_t>(kExprS32x4ZipRight, {{2, 6, 3, 7}}); | 1669 RunBinaryLaneOpTest<int32_t>(kExprS32x4ZipRight, {{2, 6, 3, 7}}); |
1666 } | 1670 } |
1667 | 1671 |
1668 WASM_EXEC_COMPILED_TEST(S32x4UnzipLeft) { | 1672 WASM_EXEC_COMPILED_TEST(S32x4UnzipLeft) { |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2014 WASM_I32_EQ( | 2018 WASM_I32_EQ( |
2015 WASM_SIMD_I32x4_EXTRACT_LANE( | 2019 WASM_SIMD_I32x4_EXTRACT_LANE( |
2016 0, WASM_SIMD_BINOP(kExprI32x4Add, | 2020 0, WASM_SIMD_BINOP(kExprI32x4Add, |
2017 WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25)), | 2021 WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25)), |
2018 WASM_SIMD_F32x4_SPLAT(WASM_F32(31.5)))), | 2022 WASM_SIMD_F32x4_SPLAT(WASM_F32(31.5)))), |
2019 WASM_I32_ADD(WASM_I32_REINTERPRET_F32(WASM_F32(21.25)), | 2023 WASM_I32_ADD(WASM_I32_REINTERPRET_F32(WASM_F32(21.25)), |
2020 WASM_I32_REINTERPRET_F32(WASM_F32(31.5)))), | 2024 WASM_I32_REINTERPRET_F32(WASM_F32(31.5)))), |
2021 WASM_I32V(1), WASM_I32V(0))); | 2025 WASM_I32V(1), WASM_I32V(0))); |
2022 CHECK_EQ(1, r.Call()); | 2026 CHECK_EQ(1, r.Call()); |
2023 } | 2027 } |
| 2028 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
2024 | 2029 |
| 2030 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
2025 WASM_EXEC_COMPILED_TEST(SimdI32x4Local) { | 2031 WASM_EXEC_COMPILED_TEST(SimdI32x4Local) { |
2026 FLAG_wasm_simd_prototype = true; | 2032 FLAG_wasm_simd_prototype = true; |
2027 WasmRunner<int32_t> r(kExecuteCompiled); | 2033 WasmRunner<int32_t> r(kExecuteCompiled); |
2028 r.AllocateLocal(kWasmS128); | 2034 r.AllocateLocal(kWasmS128); |
2029 BUILD(r, WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), | 2035 BUILD(r, WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))), |
2030 | 2036 |
2031 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(0))); | 2037 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(0))); |
2032 CHECK_EQ(31, r.Call()); | 2038 CHECK_EQ(31, r.Call()); |
2033 } | 2039 } |
2034 | 2040 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2071 WASM_SET_LOCAL(0, WASM_I32V(0))), | 2077 WASM_SET_LOCAL(0, WASM_I32V(0))), |
2072 WASM_IF(WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(1)), | 2078 WASM_IF(WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(1)), |
2073 WASM_I32V(28)), | 2079 WASM_I32V(28)), |
2074 WASM_SET_LOCAL(0, WASM_I32V(0))), | 2080 WASM_SET_LOCAL(0, WASM_I32V(0))), |
2075 WASM_IF(WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), | 2081 WASM_IF(WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), |
2076 WASM_I32V(36)), | 2082 WASM_I32V(36)), |
2077 WASM_SET_LOCAL(0, WASM_I32V(0))), | 2083 WASM_SET_LOCAL(0, WASM_I32V(0))), |
2078 WASM_GET_LOCAL(0)); | 2084 WASM_GET_LOCAL(0)); |
2079 CHECK_EQ(1, r.Call()); | 2085 CHECK_EQ(1, r.Call()); |
2080 } | 2086 } |
| 2087 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
2081 | 2088 |
| 2089 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
2082 WASM_EXEC_COMPILED_TEST(SimdF32x4For) { | 2090 WASM_EXEC_COMPILED_TEST(SimdF32x4For) { |
2083 FLAG_wasm_simd_prototype = true; | 2091 FLAG_wasm_simd_prototype = true; |
2084 WasmRunner<int32_t> r(kExecuteCompiled); | 2092 WasmRunner<int32_t> r(kExecuteCompiled); |
2085 r.AllocateLocal(kWasmI32); | 2093 r.AllocateLocal(kWasmI32); |
2086 r.AllocateLocal(kWasmS128); | 2094 r.AllocateLocal(kWasmS128); |
2087 BUILD(r, WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))), | 2095 BUILD(r, WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))), |
2088 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_LOCAL(1), | 2096 WASM_SET_LOCAL(1, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_LOCAL(1), |
2089 WASM_F32(19.5))), | 2097 WASM_F32(19.5))), |
2090 WASM_SET_LOCAL(0, WASM_I32V(0)), | 2098 WASM_SET_LOCAL(0, WASM_I32V(0)), |
2091 WASM_LOOP( | 2099 WASM_LOOP( |
2092 WASM_SET_LOCAL( | 2100 WASM_SET_LOCAL( |
2093 1, WASM_SIMD_BINOP(kExprF32x4Add, WASM_GET_LOCAL(1), | 2101 1, WASM_SIMD_BINOP(kExprF32x4Add, WASM_GET_LOCAL(1), |
2094 WASM_SIMD_F32x4_SPLAT(WASM_F32(2.0)))), | 2102 WASM_SIMD_F32x4_SPLAT(WASM_F32(2.0)))), |
2095 WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(0), WASM_I32V(3)), WASM_BR(1))), | 2103 WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(0), WASM_I32V(3)), WASM_BR(1))), |
2096 WASM_SET_LOCAL(0, WASM_I32V(1)), | 2104 WASM_SET_LOCAL(0, WASM_I32V(1)), |
2097 WASM_IF(WASM_F32_NE(WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(1)), | 2105 WASM_IF(WASM_F32_NE(WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(1)), |
2098 WASM_F32(27.25)), | 2106 WASM_F32(27.25)), |
2099 WASM_SET_LOCAL(0, WASM_I32V(0))), | 2107 WASM_SET_LOCAL(0, WASM_I32V(0))), |
2100 WASM_IF(WASM_F32_NE(WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), | 2108 WASM_IF(WASM_F32_NE(WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(1)), |
2101 WASM_F32(25.5)), | 2109 WASM_F32(25.5)), |
2102 WASM_SET_LOCAL(0, WASM_I32V(0))), | 2110 WASM_SET_LOCAL(0, WASM_I32V(0))), |
2103 WASM_GET_LOCAL(0)); | 2111 WASM_GET_LOCAL(0)); |
2104 CHECK_EQ(1, r.Call()); | 2112 CHECK_EQ(1, r.Call()); |
2105 } | 2113 } |
| 2114 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
2106 | 2115 |
| 2116 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
2107 WASM_EXEC_COMPILED_TEST(SimdI32x4GetGlobal) { | 2117 WASM_EXEC_COMPILED_TEST(SimdI32x4GetGlobal) { |
2108 FLAG_wasm_simd_prototype = true; | 2118 FLAG_wasm_simd_prototype = true; |
2109 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); | 2119 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
2110 int32_t* global = r.module().AddGlobal<int32_t>(kWasmS128); | 2120 int32_t* global = r.module().AddGlobal<int32_t>(kWasmS128); |
2111 *(global) = 0; | 2121 *(global) = 0; |
2112 *(global + 1) = 1; | 2122 *(global + 1) = 1; |
2113 *(global + 2) = 2; | 2123 *(global + 2) = 2; |
2114 *(global + 3) = 3; | 2124 *(global + 3) = 3; |
2115 r.AllocateLocal(kWasmI32); | 2125 r.AllocateLocal(kWasmI32); |
2116 BUILD( | 2126 BUILD( |
(...skipping 25 matching lines...) Expand all Loading... |
2142 WASM_I32V(45))), | 2152 WASM_I32V(45))), |
2143 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0), | 2153 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0), |
2144 WASM_I32V(56))), | 2154 WASM_I32V(56))), |
2145 WASM_I32V(1)); | 2155 WASM_I32V(1)); |
2146 CHECK_EQ(1, r.Call(0)); | 2156 CHECK_EQ(1, r.Call(0)); |
2147 CHECK_EQ(*global, 23); | 2157 CHECK_EQ(*global, 23); |
2148 CHECK_EQ(*(global + 1), 34); | 2158 CHECK_EQ(*(global + 1), 34); |
2149 CHECK_EQ(*(global + 2), 45); | 2159 CHECK_EQ(*(global + 2), 45); |
2150 CHECK_EQ(*(global + 3), 56); | 2160 CHECK_EQ(*(global + 3), 56); |
2151 } | 2161 } |
| 2162 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
2152 | 2163 |
| 2164 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
2153 WASM_EXEC_COMPILED_TEST(SimdF32x4GetGlobal) { | 2165 WASM_EXEC_COMPILED_TEST(SimdF32x4GetGlobal) { |
2154 FLAG_wasm_simd_prototype = true; | 2166 FLAG_wasm_simd_prototype = true; |
2155 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); | 2167 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); |
2156 float* global = r.module().AddGlobal<float>(kWasmS128); | 2168 float* global = r.module().AddGlobal<float>(kWasmS128); |
2157 *(global) = 0.0; | 2169 *(global) = 0.0; |
2158 *(global + 1) = 1.5; | 2170 *(global + 1) = 1.5; |
2159 *(global + 2) = 2.25; | 2171 *(global + 2) = 2.25; |
2160 *(global + 3) = 3.5; | 2172 *(global + 3) = 3.5; |
2161 r.AllocateLocal(kWasmI32); | 2173 r.AllocateLocal(kWasmI32); |
2162 BUILD( | 2174 BUILD( |
(...skipping 25 matching lines...) Expand all Loading... |
2188 WASM_F32(32.25))), | 2200 WASM_F32(32.25))), |
2189 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0), | 2201 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0), |
2190 WASM_F32(65.0))), | 2202 WASM_F32(65.0))), |
2191 WASM_I32V(1)); | 2203 WASM_I32V(1)); |
2192 CHECK_EQ(1, r.Call(0)); | 2204 CHECK_EQ(1, r.Call(0)); |
2193 CHECK_EQ(*global, 13.5); | 2205 CHECK_EQ(*global, 13.5); |
2194 CHECK_EQ(*(global + 1), 45.5); | 2206 CHECK_EQ(*(global + 1), 45.5); |
2195 CHECK_EQ(*(global + 2), 32.25); | 2207 CHECK_EQ(*(global + 2), 32.25); |
2196 CHECK_EQ(*(global + 3), 65.0); | 2208 CHECK_EQ(*(global + 3), 65.0); |
2197 } | 2209 } |
| 2210 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
2198 | 2211 |
| 2212 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
2199 WASM_EXEC_COMPILED_TEST(SimdLoadStoreLoad) { | 2213 WASM_EXEC_COMPILED_TEST(SimdLoadStoreLoad) { |
2200 FLAG_wasm_simd_prototype = true; | 2214 FLAG_wasm_simd_prototype = true; |
2201 WasmRunner<int32_t> r(kExecuteCompiled); | 2215 WasmRunner<int32_t> r(kExecuteCompiled); |
2202 int32_t* memory = r.module().AddMemoryElems<int32_t>(4); | 2216 int32_t* memory = r.module().AddMemoryElems<int32_t>(4); |
2203 | 2217 |
2204 BUILD(r, | 2218 BUILD(r, |
2205 WASM_STORE_MEM(MachineType::Simd128(), WASM_ZERO, | 2219 WASM_STORE_MEM(MachineType::Simd128(), WASM_ZERO, |
2206 WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO)), | 2220 WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO)), |
2207 WASM_SIMD_I32x4_EXTRACT_LANE( | 2221 WASM_SIMD_I32x4_EXTRACT_LANE( |
2208 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); | 2222 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); |
2209 | 2223 |
2210 FOR_INT32_INPUTS(i) { | 2224 FOR_INT32_INPUTS(i) { |
2211 int32_t expected = *i; | 2225 int32_t expected = *i; |
2212 r.module().WriteMemory(&memory[0], expected); | 2226 r.module().WriteMemory(&memory[0], expected); |
2213 CHECK_EQ(expected, r.Call()); | 2227 CHECK_EQ(expected, r.Call()); |
2214 } | 2228 } |
2215 } | 2229 } |
2216 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 2230 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_X64 |
OLD | NEW |