Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: test/cctest/wasm/test-run-wasm-simd-lowering.cc

Issue 2498283002: [wasm] implement simd lowering for replaceLane, load, store and test for phi (Closed)
Patch Set: [wasm] implement simd lowering for replaceLane, load, store and test for phi Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "src/wasm/wasm-module.h" 6 #include "src/wasm/wasm-module.h"
7 7
8 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
9 #include "test/cctest/compiler/value-helper.h" 9 #include "test/cctest/compiler/value-helper.h"
10 #include "test/cctest/wasm/wasm-run-utils.h" 10 #include "test/cctest/wasm/wasm-run-utils.h"
11 #include "test/common/wasm/test-signatures.h" 11 #include "test/common/wasm/test-signatures.h"
12 12
13 using namespace v8::base; 13 using namespace v8::base;
14 using namespace v8::internal; 14 using namespace v8::internal;
15 using namespace v8::internal::compiler; 15 using namespace v8::internal::compiler;
16 using namespace v8::internal::wasm; 16 using namespace v8::internal::wasm;
17 17
18 WASM_EXEC_TEST(Simd_I32x4_Splat) { 18 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Splat) {
19 FLAG_wasm_simd_prototype = true; 19 FLAG_wasm_simd_prototype = true;
20 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); 20 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
21 BUILD(r, 21 BUILD(r,
22 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(5)))); 22 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(5))));
23 FOR_INT32_INPUTS(i) { CHECK_EQ(5, r.Call()); } 23 FOR_INT32_INPUTS(i) { CHECK_EQ(5, r.Call()); }
24 } 24 }
25 25
26 WASM_EXEC_TEST(Simd_I32x4_Add) { 26 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Add) {
27 FLAG_wasm_simd_prototype = true; 27 FLAG_wasm_simd_prototype = true;
28 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); 28 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
29 BUILD(r, WASM_SIMD_I32x4_EXTRACT_LANE( 29 BUILD(r, WASM_SIMD_I32x4_EXTRACT_LANE(
30 0, WASM_SIMD_I32x4_ADD(WASM_SIMD_I32x4_SPLAT(WASM_I32V(5)), 30 0, WASM_SIMD_I32x4_ADD(WASM_SIMD_I32x4_SPLAT(WASM_I32V(5)),
31 WASM_SIMD_I32x4_SPLAT(WASM_I32V(6))))); 31 WASM_SIMD_I32x4_SPLAT(WASM_I32V(6)))));
32 FOR_INT32_INPUTS(i) { CHECK_EQ(11, r.Call()); } 32 FOR_INT32_INPUTS(i) { CHECK_EQ(11, r.Call()); }
33 } 33 }
34 34
35 WASM_EXEC_TEST(Simd_F32x4_Splat) { 35 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Splat) {
36 FLAG_wasm_simd_prototype = true; 36 FLAG_wasm_simd_prototype = true;
37 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); 37 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
38 BUILD(r, 38 BUILD(r,
39 WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( 39 WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE(
40 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(9.5))), 40 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(9.5))),
41 WASM_F32(9.5)), 41 WASM_F32(9.5)),
42 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); 42 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
43 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } 43 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
44 } 44 }
45 45
46 WASM_EXEC_TEST(Simd_I32x4_Extract_With_F32x4) { 46 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Extract_With_F32x4) {
47 FLAG_wasm_simd_prototype = true; 47 FLAG_wasm_simd_prototype = true;
48 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); 48 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
49 BUILD(r, 49 BUILD(r,
50 WASM_IF_ELSE(WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE( 50 WASM_IF_ELSE(WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE(
51 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(30.5))), 51 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(30.5))),
52 WASM_I32_REINTERPRET_F32(WASM_F32(30.5))), 52 WASM_I32_REINTERPRET_F32(WASM_F32(30.5))),
53 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); 53 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
54 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } 54 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
55 } 55 }
56 56
57 WASM_EXEC_TEST(Simd_F32x4_Extract_With_I32x4) { 57 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Extract_With_I32x4) {
58 FLAG_wasm_simd_prototype = true; 58 FLAG_wasm_simd_prototype = true;
59 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); 59 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
60 BUILD(r, 60 BUILD(r,
61 WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( 61 WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE(
62 0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(15))), 62 0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(15))),
63 WASM_F32_REINTERPRET_I32(WASM_I32V(15))), 63 WASM_F32_REINTERPRET_I32(WASM_I32V(15))),
64 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); 64 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
65 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } 65 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
66 } 66 }
67 67
68 WASM_EXEC_TEST(Simd_F32x4_Add_With_I32x4) { 68 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Add_With_I32x4) {
69 FLAG_wasm_simd_prototype = true; 69 FLAG_wasm_simd_prototype = true;
70 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); 70 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
71 BUILD(r, 71 BUILD(r,
72 WASM_IF_ELSE( 72 WASM_IF_ELSE(
73 WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( 73 WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE(
74 0, WASM_SIMD_F32x4_ADD( 74 0, WASM_SIMD_F32x4_ADD(
75 WASM_SIMD_I32x4_SPLAT(WASM_I32V(32)), 75 WASM_SIMD_I32x4_SPLAT(WASM_I32V(32)),
76 WASM_SIMD_I32x4_SPLAT(WASM_I32V(19)))), 76 WASM_SIMD_I32x4_SPLAT(WASM_I32V(19)))),
77 WASM_F32_ADD(WASM_F32_REINTERPRET_I32(WASM_I32V(32)), 77 WASM_F32_ADD(WASM_F32_REINTERPRET_I32(WASM_I32V(32)),
78 WASM_F32_REINTERPRET_I32(WASM_I32V(19)))), 78 WASM_F32_REINTERPRET_I32(WASM_I32V(19)))),
79 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); 79 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
80 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } 80 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
81 } 81 }
82 82
83 WASM_EXEC_TEST(Simd_I32x4_Add_With_F32x4) { 83 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Add_With_F32x4) {
84 FLAG_wasm_simd_prototype = true; 84 FLAG_wasm_simd_prototype = true;
85 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); 85 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
86 BUILD(r, 86 BUILD(r,
87 WASM_IF_ELSE( 87 WASM_IF_ELSE(
88 WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE( 88 WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE(
89 0, WASM_SIMD_I32x4_ADD( 89 0, WASM_SIMD_I32x4_ADD(
90 WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25)), 90 WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25)),
91 WASM_SIMD_F32x4_SPLAT(WASM_F32(31.5)))), 91 WASM_SIMD_F32x4_SPLAT(WASM_F32(31.5)))),
92 WASM_I32_ADD(WASM_I32_REINTERPRET_F32(WASM_F32(21.25)), 92 WASM_I32_ADD(WASM_I32_REINTERPRET_F32(WASM_F32(21.25)),
93 WASM_I32_REINTERPRET_F32(WASM_F32(31.5)))), 93 WASM_I32_REINTERPRET_F32(WASM_F32(31.5)))),
94 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); 94 WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0))));
95 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } 95 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
96 } 96 }
97
98 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Local) {
99 FLAG_wasm_simd_prototype = true;
100 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
101 r.AllocateLocal(kAstS128);
102 BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))),
103 WASM_RETURN1(
104 WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(1)))));
105 FOR_INT32_INPUTS(i) { CHECK_EQ(31, r.Call()); }
106 }
107
108 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Replace_Lane) {
109 FLAG_wasm_simd_prototype = true;
110 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
111 r.AllocateLocal(kAstS128);
112 BUILD(r,
113 WASM_BLOCK(
114 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))),
115 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(1),
116 WASM_I32V(53))),
117 WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(1)))));
118 FOR_INT32_INPUTS(i) { CHECK_EQ(53, r.Call()); }
119 }
120
121 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Replace_Lane) {
122 FLAG_wasm_simd_prototype = true;
123 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
124 r.AllocateLocal(kAstF32);
125 r.AllocateLocal(kAstS128);
126 BUILD(r, WASM_BLOCK(
127 WASM_SET_LOCAL(2, WASM_SIMD_F32x4_SPLAT(WASM_F32(23.5))),
128 WASM_SET_LOCAL(2, WASM_SIMD_F32x4_REPLACE_LANE(
129 3, WASM_GET_LOCAL(2), WASM_F32(65.25))),
130 WASM_SET_LOCAL(
131 1, WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(2))),
132 WASM_IF(WASM_F32_EQ(WASM_GET_LOCAL(1), WASM_F32(65.25)),
133 WASM_RETURN1(WASM_I32V(1))),
134 WASM_RETURN1(WASM_I32V(0))));
135 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
136 }
137
138 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Splat_From_Extract) {
139 FLAG_wasm_simd_prototype = true;
140 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
141 r.AllocateLocal(kAstI32);
142 r.AllocateLocal(kAstS128);
143 BUILD(r,
144 WASM_BLOCK(
145 WASM_SET_LOCAL(1, WASM_SIMD_I32x4_EXTRACT_LANE(
146 0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(76)))),
147 WASM_SET_LOCAL(2, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(1))),
148 WASM_RETURN1(WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_LOCAL(2)))));
149 FOR_INT32_INPUTS(i) { CHECK_EQ(76, r.Call()); }
150 }
151
152 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Get_Global) {
153 FLAG_wasm_simd_prototype = true;
154 TestingModule module(kExecuteCompiled);
155 int32_t* global = module.AddGlobal<int32_t>(kAstS128);
156 *(global) = 0;
157 *(global + 1) = 1;
158 *(global + 2) = 2;
159 *(global + 3) = 3;
160 WasmRunner<int32_t> r(&module, MachineType::Int32());
161 r.AllocateLocal(kAstI32);
162 BUILD(r, WASM_BLOCK(
163 WASM_SET_LOCAL(1, WASM_I32V(1)),
164 WASM_IF(WASM_I32_NE(WASM_I32V(0), WASM_SIMD_I32x4_EXTRACT_LANE(
165 0, WASM_GET_GLOBAL(0))),
166 WASM_SET_LOCAL(1, WASM_I32V(0))),
167 WASM_IF(WASM_I32_NE(WASM_I32V(1), WASM_SIMD_I32x4_EXTRACT_LANE(
168 1, WASM_GET_GLOBAL(0))),
169 WASM_SET_LOCAL(1, WASM_I32V(0))),
170 WASM_IF(WASM_I32_NE(WASM_I32V(2), WASM_SIMD_I32x4_EXTRACT_LANE(
171 2, WASM_GET_GLOBAL(0))),
172 WASM_SET_LOCAL(1, WASM_I32V(0))),
173 WASM_IF(WASM_I32_NE(WASM_I32V(3), WASM_SIMD_I32x4_EXTRACT_LANE(
174 3, WASM_GET_GLOBAL(0))),
175 WASM_SET_LOCAL(1, WASM_I32V(0))),
176 WASM_RETURN1(WASM_GET_LOCAL(1))));
177 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); }
178 }
179
180 WASM_EXEC_COMPILED_TEST(Simd_I32x4_Set_Global) {
181 FLAG_wasm_simd_prototype = true;
182 TestingModule module(kExecuteCompiled);
183 int32_t* global = module.AddGlobal<int32_t>(kAstS128);
184 WasmRunner<int32_t> r(&module, MachineType::Int32());
185 BUILD(r, WASM_BLOCK(
186 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(23))),
187 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE(
188 1, WASM_GET_GLOBAL(0), WASM_I32V(34))),
189 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE(
190 2, WASM_GET_GLOBAL(0), WASM_I32V(45))),
191 WASM_SET_GLOBAL(0, WASM_SIMD_I32x4_REPLACE_LANE(
192 3, WASM_GET_GLOBAL(0), WASM_I32V(56))),
193 WASM_RETURN1(WASM_I32V(1))));
194 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); }
195 CHECK_EQ(*global, 23);
196 CHECK_EQ(*(global + 1), 34);
197 CHECK_EQ(*(global + 2), 45);
198 CHECK_EQ(*(global + 3), 56);
199 }
200
201 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Get_Global) {
202 FLAG_wasm_simd_prototype = true;
203 TestingModule module(kExecuteCompiled);
204 float* global = module.AddGlobal<float>(kAstS128);
205 *(global) = 0.0;
206 *(global + 1) = 1.5;
207 *(global + 2) = 2.25;
208 *(global + 3) = 3.5;
209 WasmRunner<int32_t> r(&module, MachineType::Int32());
210 r.AllocateLocal(kAstI32);
211 BUILD(r, WASM_BLOCK(
212 WASM_SET_LOCAL(1, WASM_I32V(1)),
213 WASM_IF(WASM_F32_NE(WASM_F32(0.0), WASM_SIMD_F32x4_EXTRACT_LANE(
214 0, WASM_GET_GLOBAL(0))),
215 WASM_SET_LOCAL(1, WASM_I32V(0))),
216 WASM_IF(WASM_F32_NE(WASM_F32(1.5), WASM_SIMD_F32x4_EXTRACT_LANE(
217 1, WASM_GET_GLOBAL(0))),
218 WASM_SET_LOCAL(1, WASM_I32V(0))),
219 WASM_IF(WASM_F32_NE(WASM_F32(2.25), WASM_SIMD_F32x4_EXTRACT_LANE(
220 2, WASM_GET_GLOBAL(0))),
221 WASM_SET_LOCAL(1, WASM_I32V(0))),
222 WASM_IF(WASM_F32_NE(WASM_F32(3.5), WASM_SIMD_F32x4_EXTRACT_LANE(
223 3, WASM_GET_GLOBAL(0))),
224 WASM_SET_LOCAL(1, WASM_I32V(0))),
225 WASM_RETURN1(WASM_GET_LOCAL(1))));
226 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); }
227 }
228
229 WASM_EXEC_COMPILED_TEST(Simd_F32x4_Set_Global) {
230 FLAG_wasm_simd_prototype = true;
231 TestingModule module(kExecuteCompiled);
232 float* global = module.AddGlobal<float>(kAstS128);
233 WasmRunner<int32_t> r(&module, MachineType::Int32());
234 BUILD(r, WASM_BLOCK(
235 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))),
236 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(
237 1, WASM_GET_GLOBAL(0), WASM_F32(45.5))),
238 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(
239 2, WASM_GET_GLOBAL(0), WASM_F32(32.25))),
240 WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(
241 3, WASM_GET_GLOBAL(0), WASM_F32(65.0))),
242 WASM_RETURN1(WASM_I32V(1))));
243 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(0)); }
244 CHECK_EQ(*global, 13.5);
245 CHECK_EQ(*(global + 1), 45.5);
246 CHECK_EQ(*(global + 2), 32.25);
247 CHECK_EQ(*(global + 3), 65.0);
248 }
249
250 WASM_EXEC_COMPILED_TEST(Simd_I32x4_For) {
251 FLAG_wasm_simd_prototype = true;
252 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
253 r.AllocateLocal(kAstI32);
254 r.AllocateLocal(kAstS128);
255 BUILD(
256 r,
257 WASM_BLOCK(
258 WASM_SET_LOCAL(2, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))),
259 WASM_SET_LOCAL(2, WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GET_LOCAL(2),
260 WASM_I32V(53))),
261 WASM_SET_LOCAL(2, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(2),
262 WASM_I32V(23))),
263 WASM_SET_LOCAL(1, WASM_I32V(0)),
264 WASM_LOOP(WASM_SET_LOCAL(2, WASM_SIMD_I32x4_ADD(
265 WASM_GET_LOCAL(2),
266 WASM_SIMD_I32x4_SPLAT(WASM_I32V(1)))),
267 WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(1), WASM_I32V(5)),
268 WASM_BR(1))),
269 WASM_SET_LOCAL(1, WASM_I32V(1)),
270 WASM_IF(
271 WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(2)),
272 WASM_I32V(36)),
273 WASM_SET_LOCAL(1, WASM_I32V(0))),
274 WASM_IF(
275 WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(1, WASM_GET_LOCAL(2)),
276 WASM_I32V(58)),
277 WASM_SET_LOCAL(1, WASM_I32V(0))),
278 WASM_IF(
279 WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(2, WASM_GET_LOCAL(2)),
280 WASM_I32V(28)),
281 WASM_SET_LOCAL(1, WASM_I32V(0))),
282 WASM_IF(
283 WASM_I32_NE(WASM_SIMD_I32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(2)),
284 WASM_I32V(36)),
285 WASM_SET_LOCAL(1, WASM_I32V(0))),
286 WASM_RETURN1(WASM_GET_LOCAL(1))));
287 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
288 }
289
290 WASM_EXEC_COMPILED_TEST(Simd_F32x4_For) {
291 FLAG_wasm_simd_prototype = true;
292 WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32());
293 r.AllocateLocal(kAstI32);
294 r.AllocateLocal(kAstS128);
295 BUILD(r, WASM_BLOCK(
296 WASM_SET_LOCAL(2, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))),
297 WASM_SET_LOCAL(2, WASM_SIMD_F32x4_REPLACE_LANE(
298 3, WASM_GET_LOCAL(2), WASM_F32(19.5))),
299 WASM_SET_LOCAL(1, WASM_I32V(0)),
300 WASM_LOOP(
301 WASM_SET_LOCAL(2, WASM_SIMD_F32x4_ADD(
302 WASM_GET_LOCAL(2),
303 WASM_SIMD_F32x4_SPLAT(WASM_F32(2.0)))),
304 WASM_IF(WASM_I32_NE(WASM_INC_LOCAL(1), WASM_I32V(3)),
305 WASM_BR(1))),
306 WASM_SET_LOCAL(1, WASM_I32V(1)),
307 WASM_IF(WASM_F32_NE(
308 WASM_SIMD_F32x4_EXTRACT_LANE(0, WASM_GET_LOCAL(2)),
309 WASM_F32(27.25)),
310 WASM_SET_LOCAL(1, WASM_I32V(0))),
311 WASM_IF(WASM_F32_NE(
312 WASM_SIMD_F32x4_EXTRACT_LANE(3, WASM_GET_LOCAL(2)),
313 WASM_F32(25.5)),
314 WASM_SET_LOCAL(1, WASM_I32V(0))),
315 WASM_RETURN1(WASM_GET_LOCAL(1))));
316 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); }
317 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-opcodes.h ('k') | test/cctest/wasm/wasm-run-utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698