OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "src/wasm/wasm-macro-gen.h" | |
6 | |
7 #include "test/cctest/cctest.h" | |
8 #include "test/cctest/compiler/value-helper.h" | |
9 #include "test/cctest/wasm/wasm-run-utils.h" | |
10 | |
11 using namespace v8::base; | |
12 using namespace v8::internal; | |
13 using namespace v8::internal::compiler; | |
14 using namespace v8::internal::wasm; | |
15 | |
16 // Store SIMD value in a local variable, use extract lane to check lane values | |
17 // | |
18 // SetLocal(1, I32x4Splat(Local(0))); | |
19 // For each lane index | |
20 // if(Local(0) != I32x4ExtractLane(Local(1), index) | |
21 // return 0 | |
22 // | |
23 // return 1 | |
24 | |
25 WASM_EXEC_TEST(SplatExtract) { | |
26 FLAG_wasm_simd_prototype = true; | |
27 | |
28 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); | |
29 r.AllocateLocal(kAstS128); | |
30 BUILD(r, | |
31 WASM_BLOCK(WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0))), | |
bbudge
2016/08/22 19:09:52
Using splat, it's not really possible to write a g
gdeepti
2016/08/22 23:26:11
Agree that it is not possible to have a good test
bbudge
2016/08/23 13:57:13
If it's not too hard, implementing ReplaceLane wou
gdeepti
2016/08/23 19:53:34
Did not think of replace lane, I'll add replace la
| |
32 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), | |
33 WASM_SIMD_I32x4_EXTRACT_LANE( | |
34 WASM_GET_LOCAL(1), WASM_I8(0))), | |
35 WASM_RETURN1(WASM_ZERO)), | |
36 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), | |
37 WASM_SIMD_I32x4_EXTRACT_LANE( | |
38 WASM_GET_LOCAL(1), WASM_I8(1))), | |
39 WASM_RETURN1(WASM_ZERO)), | |
40 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), | |
41 WASM_SIMD_I32x4_EXTRACT_LANE( | |
42 WASM_GET_LOCAL(1), WASM_I8(2))), | |
43 WASM_RETURN1(WASM_ZERO)), | |
44 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), | |
45 WASM_SIMD_I32x4_EXTRACT_LANE( | |
46 WASM_GET_LOCAL(1), WASM_I8(3))), | |
47 WASM_RETURN1(WASM_ZERO)), | |
48 WASM_RETURN1(WASM_ONE))); | |
49 | |
50 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } | |
51 } | |
OLD | NEW |