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 // | 22 // |
23 // SetLocal(1, I32x4Splat(Local(0))); | 23 // SetLocal(1, I32x4Splat(Local(0))); |
24 // For each lane index | 24 // For each lane index |
25 // if(Local(0) != I32x4ExtractLane(Local(1), index) | 25 // if(Local(0) != I32x4ExtractLane(Local(1), index) |
26 // return 0 | 26 // return 0 |
27 // | 27 // |
28 // return 1 | 28 // return 1 |
29 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); | 29 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); |
30 r.AllocateLocal(kAstS128); | 30 r.AllocateLocal(kAstS128); |
31 BUILD(r, | 31 BUILD(r, |
32 WASM_BLOCK(WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0))), | 32 WASM_BLOCK( |
33 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), | 33 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0))), |
34 WASM_SIMD_I32x4_EXTRACT_LANE( | 34 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_SIMD_I32x4_EXTRACT_LANE( |
35 WASM_GET_LOCAL(1), WASM_I8(0))), | 35 0, WASM_GET_LOCAL(1))), |
36 WASM_RETURN1(WASM_ZERO)), | 36 WASM_RETURN1(WASM_ZERO)), |
37 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), | 37 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_SIMD_I32x4_EXTRACT_LANE( |
38 WASM_SIMD_I32x4_EXTRACT_LANE( | 38 1, WASM_GET_LOCAL(1))), |
39 WASM_GET_LOCAL(1), WASM_I8(1))), | 39 WASM_RETURN1(WASM_ZERO)), |
40 WASM_RETURN1(WASM_ZERO)), | 40 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_SIMD_I32x4_EXTRACT_LANE( |
41 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), | 41 2, WASM_GET_LOCAL(1))), |
42 WASM_SIMD_I32x4_EXTRACT_LANE( | 42 WASM_RETURN1(WASM_ZERO)), |
43 WASM_GET_LOCAL(1), WASM_I8(2))), | 43 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_SIMD_I32x4_EXTRACT_LANE( |
44 WASM_RETURN1(WASM_ZERO)), | 44 3, WASM_GET_LOCAL(1))), |
45 WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), | 45 WASM_RETURN1(WASM_ZERO)), |
46 WASM_SIMD_I32x4_EXTRACT_LANE( | 46 WASM_RETURN1(WASM_ONE))); |
47 WASM_GET_LOCAL(1), WASM_I8(3))), | |
48 WASM_RETURN1(WASM_ZERO)), | |
49 WASM_RETURN1(WASM_ONE))); | |
50 | 47 |
51 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } | 48 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } |
52 } | 49 } |
OLD | NEW |