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 "src/wasm/wasm-macro-gen.h" | 6 #include "src/wasm/wasm-macro-gen.h" |
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 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 return a ^ b; | 207 return a ^ b; |
208 } | 208 } |
209 | 209 |
210 template <typename T> | 210 template <typename T> |
211 T Not(T a) { | 211 T Not(T a) { |
212 return ~a; | 212 return ~a; |
213 } | 213 } |
214 | 214 |
215 } // namespace | 215 } // namespace |
216 | 216 |
217 #if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 | 217 #if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_X64 |
218 #define SIMD_LOWERING_TARGET 1 | 218 #define SIMD_LOWERING_TARGET 1 |
219 #else | 219 #else |
220 #define SIMD_LOWERING_TARGET 0 | 220 #define SIMD_LOWERING_TARGET 0 |
221 #endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 | 221 #endif // !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_X64 |
222 | 222 |
223 // TODO(gdeepti): These are tests using sample values to verify functional | 223 // TODO(gdeepti): These are tests using sample values to verify functional |
224 // correctness of opcodes, add more tests for a range of values and macroize | 224 // correctness of opcodes, add more tests for a range of values and macroize |
225 // tests. | 225 // tests. |
226 | 226 |
227 // TODO(bbudge) Figure out how to compare floats in Wasm code that can handle | 227 // TODO(bbudge) Figure out how to compare floats in Wasm code that can handle |
228 // NaNs. For now, our tests avoid using NaNs. | 228 // NaNs. For now, our tests avoid using NaNs. |
229 #define WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lane_value, lane_index) \ | 229 #define WASM_SIMD_CHECK_LANE(TYPE, value, LANE_TYPE, lane_value, lane_index) \ |
230 WASM_IF(WASM_##LANE_TYPE##_NE(WASM_GET_LOCAL(lane_value), \ | 230 WASM_IF(WASM_##LANE_TYPE##_NE(WASM_GET_LOCAL(lane_value), \ |
231 WASM_SIMD_##TYPE##_EXTRACT_LANE( \ | 231 WASM_SIMD_##TYPE##_EXTRACT_LANE( \ |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1551 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0), | 1551 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0), |
1552 WASM_F32(65.0))), | 1552 WASM_F32(65.0))), |
1553 WASM_I32V(1)); | 1553 WASM_I32V(1)); |
1554 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } | 1554 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); } |
1555 CHECK_EQ(*global, 13.5); | 1555 CHECK_EQ(*global, 13.5); |
1556 CHECK_EQ(*(global + 1), 45.5); | 1556 CHECK_EQ(*(global + 1), 45.5); |
1557 CHECK_EQ(*(global + 2), 32.25); | 1557 CHECK_EQ(*(global + 2), 32.25); |
1558 CHECK_EQ(*(global + 3), 65.0); | 1558 CHECK_EQ(*(global + 3), 65.0); |
1559 } | 1559 } |
1560 #endif // SIMD_LOWERING_TARGET | 1560 #endif // SIMD_LOWERING_TARGET |
OLD | NEW |