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 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2183 float* global = r.module().AddGlobal<float>(kWasmS128); | 2183 float* global = r.module().AddGlobal<float>(kWasmS128); |
2184 BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))), | 2184 BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))), |
2185 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GET_GLOBAL(0), | 2185 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GET_GLOBAL(0), |
2186 WASM_F32(45.5))), | 2186 WASM_F32(45.5))), |
2187 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(2, WASM_GET_GLOBAL(0), | 2187 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(2, WASM_GET_GLOBAL(0), |
2188 WASM_F32(32.25))), | 2188 WASM_F32(32.25))), |
2189 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0), | 2189 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_GLOBAL(0), |
2190 WASM_F32(65.0))), | 2190 WASM_F32(65.0))), |
2191 WASM_I32V(1)); | 2191 WASM_I32V(1)); |
2192 CHECK_EQ(1, r.Call(0)); | 2192 CHECK_EQ(1, r.Call(0)); |
2193 CHECK_EQ(*global, 13.5); | 2193 CHECK_EQ(*global, 13.5); |
john.yan
2017/04/27 17:44:48
I am not sure I am on the right tract. If global m
Clemens Hammacher
2017/04/27 17:48:33
OK, let me correct myself: Tests are the only way
| |
2194 CHECK_EQ(*(global + 1), 45.5); | 2194 CHECK_EQ(*(global + 1), 45.5); |
2195 CHECK_EQ(*(global + 2), 32.25); | 2195 CHECK_EQ(*(global + 2), 32.25); |
2196 CHECK_EQ(*(global + 3), 65.0); | 2196 CHECK_EQ(*(global + 3), 65.0); |
2197 } | 2197 } |
2198 | 2198 |
2199 WASM_EXEC_COMPILED_TEST(SimdLoadStoreLoad) { | 2199 WASM_EXEC_COMPILED_TEST(SimdLoadStoreLoad) { |
2200 FLAG_wasm_simd_prototype = true; | 2200 FLAG_wasm_simd_prototype = true; |
2201 WasmRunner<int32_t> r(kExecuteCompiled); | 2201 WasmRunner<int32_t> r(kExecuteCompiled); |
2202 int32_t* memory = r.module().AddMemoryElems<int32_t>(4); | 2202 int32_t* memory = r.module().AddMemoryElems<int32_t>(4); |
2203 | 2203 |
2204 BUILD(r, | 2204 BUILD(r, |
2205 WASM_STORE_MEM(MachineType::Simd128(), WASM_ZERO, | 2205 WASM_STORE_MEM(MachineType::Simd128(), WASM_ZERO, |
2206 WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO)), | 2206 WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO)), |
2207 WASM_SIMD_I32x4_EXTRACT_LANE( | 2207 WASM_SIMD_I32x4_EXTRACT_LANE( |
2208 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); | 2208 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); |
2209 | 2209 |
2210 FOR_INT32_INPUTS(i) { | 2210 FOR_INT32_INPUTS(i) { |
2211 int32_t expected = *i; | 2211 int32_t expected = *i; |
2212 #if defined(V8_TARGET_LITTLE_ENDIAN) | |
2212 r.module().WriteMemory(&memory[0], expected); | 2213 r.module().WriteMemory(&memory[0], expected); |
2214 #else | |
2215 r.module().WriteMemory(&memory[3], expected); | |
2216 #endif | |
2213 CHECK_EQ(expected, r.Call()); | 2217 CHECK_EQ(expected, r.Call()); |
2214 } | 2218 } |
2215 } | 2219 } |
2216 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 2220 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
OLD | NEW |