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

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

Issue 2670673002: [wasm] Implement polymorphic checking, matching the reference interpreter. (Closed)
Patch Set: Fix test-run-simd Created 3 years, 10 months 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 | « test/cctest/wasm/test-run-wasm.cc ('k') | test/cctest/wasm/test-run-wasm-simd-lowering.cc » ('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 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 #define WASM_SIMD_CHECK_SPLAT4_F32(TYPE, value, lv) \ 184 #define WASM_SIMD_CHECK_SPLAT4_F32(TYPE, value, lv) \
185 WASM_SIMD_CHECK4_F32(TYPE, value, lv, lv, lv, lv) 185 WASM_SIMD_CHECK4_F32(TYPE, value, lv, lv, lv, lv)
186 186
187 #if V8_TARGET_ARCH_ARM 187 #if V8_TARGET_ARCH_ARM
188 WASM_EXEC_TEST(F32x4Splat) { 188 WASM_EXEC_TEST(F32x4Splat) {
189 FLAG_wasm_simd_prototype = true; 189 FLAG_wasm_simd_prototype = true;
190 190
191 WasmRunner<int32_t, float> r(kExecuteCompiled); 191 WasmRunner<int32_t, float> r(kExecuteCompiled);
192 byte lane_val = 0; 192 byte lane_val = 0;
193 byte simd = r.AllocateLocal(kWasmS128); 193 byte simd = r.AllocateLocal(kWasmS128);
194 BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT( 194 BUILD(r,
195 WASM_GET_LOCAL(lane_val))), 195 WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(lane_val))),
196 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd, lane_val), 196 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd, lane_val), WASM_ONE);
197 WASM_RETURN1(WASM_ONE)));
198 197
199 FOR_FLOAT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } 198 FOR_FLOAT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
200 } 199 }
201 200
202 WASM_EXEC_TEST(F32x4ReplaceLane) { 201 WASM_EXEC_TEST(F32x4ReplaceLane) {
203 FLAG_wasm_simd_prototype = true; 202 FLAG_wasm_simd_prototype = true;
204 WasmRunner<int32_t, float, float> r(kExecuteCompiled); 203 WasmRunner<int32_t, float, float> r(kExecuteCompiled);
205 byte old_val = 0; 204 byte old_val = 0;
206 byte new_val = 1; 205 byte new_val = 1;
207 byte simd = r.AllocateLocal(kWasmS128); 206 byte simd = r.AllocateLocal(kWasmS128);
208 BUILD(r, WASM_BLOCK( 207 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(old_val))),
209 WASM_SET_LOCAL(simd, 208 WASM_SET_LOCAL(simd,
210 WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(old_val))), 209 WASM_SIMD_F32x4_REPLACE_LANE(0, WASM_GET_LOCAL(simd),
211 WASM_SET_LOCAL( 210 WASM_GET_LOCAL(new_val))),
212 simd, WASM_SIMD_F32x4_REPLACE_LANE(0, WASM_GET_LOCAL(simd), 211 WASM_SIMD_CHECK4(F32x4, simd, F32, new_val, old_val, old_val, old_val),
213 WASM_GET_LOCAL(new_val))), 212 WASM_SET_LOCAL(simd,
214 WASM_SIMD_CHECK4(F32x4, simd, F32, new_val, old_val, old_val, 213 WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GET_LOCAL(simd),
215 old_val), 214 WASM_GET_LOCAL(new_val))),
216 WASM_SET_LOCAL( 215 WASM_SIMD_CHECK4(F32x4, simd, F32, new_val, new_val, old_val, old_val),
217 simd, WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GET_LOCAL(simd), 216 WASM_SET_LOCAL(simd,
218 WASM_GET_LOCAL(new_val))), 217 WASM_SIMD_F32x4_REPLACE_LANE(2, WASM_GET_LOCAL(simd),
219 WASM_SIMD_CHECK4(F32x4, simd, F32, new_val, new_val, old_val, 218 WASM_GET_LOCAL(new_val))),
220 old_val), 219 WASM_SIMD_CHECK4(F32x4, simd, F32, new_val, new_val, new_val, old_val),
221 WASM_SET_LOCAL( 220 WASM_SET_LOCAL(simd,
222 simd, WASM_SIMD_F32x4_REPLACE_LANE(2, WASM_GET_LOCAL(simd), 221 WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_LOCAL(simd),
223 WASM_GET_LOCAL(new_val))), 222 WASM_GET_LOCAL(new_val))),
224 WASM_SIMD_CHECK4(F32x4, simd, F32, new_val, new_val, new_val, 223 WASM_SIMD_CHECK_SPLAT4(F32x4, simd, F32, new_val), WASM_ONE);
225 old_val),
226 WASM_SET_LOCAL(
227 simd, WASM_SIMD_F32x4_REPLACE_LANE(3, WASM_GET_LOCAL(simd),
228 WASM_GET_LOCAL(new_val))),
229 WASM_SIMD_CHECK_SPLAT4(F32x4, simd, F32, new_val),
230 WASM_RETURN1(WASM_ONE)));
231 224
232 CHECK_EQ(1, r.Call(3.14159, -1.5)); 225 CHECK_EQ(1, r.Call(3.14159, -1.5));
233 } 226 }
234 227
235 // Tests both signed and unsigned conversion. 228 // Tests both signed and unsigned conversion.
236 WASM_EXEC_TEST(F32x4FromInt32x4) { 229 WASM_EXEC_TEST(F32x4FromInt32x4) {
237 FLAG_wasm_simd_prototype = true; 230 FLAG_wasm_simd_prototype = true;
238 WasmRunner<int32_t, int32_t, float, float> r(kExecuteCompiled); 231 WasmRunner<int32_t, int32_t, float, float> r(kExecuteCompiled);
239 byte a = 0; 232 byte a = 0;
240 byte expected_signed = 1; 233 byte expected_signed = 1;
241 byte expected_unsigned = 2; 234 byte expected_unsigned = 2;
242 byte simd0 = r.AllocateLocal(kWasmS128); 235 byte simd0 = r.AllocateLocal(kWasmS128);
243 byte simd1 = r.AllocateLocal(kWasmS128); 236 byte simd1 = r.AllocateLocal(kWasmS128);
244 byte simd2 = r.AllocateLocal(kWasmS128); 237 byte simd2 = r.AllocateLocal(kWasmS128);
245 BUILD(r, WASM_BLOCK( 238 BUILD(
246 WASM_SET_LOCAL(simd0, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), 239 r, WASM_SET_LOCAL(simd0, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))),
247 WASM_SET_LOCAL( 240 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_FROM_I32x4(WASM_GET_LOCAL(simd0))),
248 simd1, WASM_SIMD_F32x4_FROM_I32x4(WASM_GET_LOCAL(simd0))), 241 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd1, expected_signed),
249 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd1, expected_signed), 242 WASM_SET_LOCAL(simd2, WASM_SIMD_F32x4_FROM_U32x4(WASM_GET_LOCAL(simd0))),
250 WASM_SET_LOCAL( 243 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd2, expected_unsigned), WASM_ONE);
251 simd2, WASM_SIMD_F32x4_FROM_U32x4(WASM_GET_LOCAL(simd0))),
252 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd2, expected_unsigned),
253 WASM_RETURN1(WASM_ONE)));
254 244
255 FOR_INT32_INPUTS(i) { 245 FOR_INT32_INPUTS(i) {
256 CHECK_EQ(1, r.Call(*i, static_cast<float>(*i), 246 CHECK_EQ(1, r.Call(*i, static_cast<float>(*i),
257 static_cast<float>(static_cast<uint32_t>(*i)))); 247 static_cast<float>(static_cast<uint32_t>(*i))));
258 } 248 }
259 } 249 }
260 250
261 WASM_EXEC_TEST(S32x4Select) { 251 WASM_EXEC_TEST(S32x4Select) {
262 FLAG_wasm_simd_prototype = true; 252 FLAG_wasm_simd_prototype = true;
263 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); 253 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
264 byte val1 = 0; 254 byte val1 = 0;
265 byte val2 = 1; 255 byte val2 = 1;
266 byte mask = r.AllocateLocal(kWasmS128); 256 byte mask = r.AllocateLocal(kWasmS128);
267 byte src1 = r.AllocateLocal(kWasmS128); 257 byte src1 = r.AllocateLocal(kWasmS128);
268 byte src2 = r.AllocateLocal(kWasmS128); 258 byte src2 = r.AllocateLocal(kWasmS128);
269 BUILD(r, 259 BUILD(r,
270 WASM_BLOCK( 260
271 WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_SPLAT(WASM_ZERO)), 261 WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_SPLAT(WASM_ZERO)),
272 WASM_SET_LOCAL(src1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(val1))), 262 WASM_SET_LOCAL(src1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(val1))),
273 WASM_SET_LOCAL(src2, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(val2))), 263 WASM_SET_LOCAL(src2, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(val2))),
274 WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_REPLACE_LANE( 264 WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_REPLACE_LANE(
275 1, WASM_GET_LOCAL(mask), WASM_I32V(-1))), 265 1, WASM_GET_LOCAL(mask), WASM_I32V(-1))),
276 WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_REPLACE_LANE( 266 WASM_SET_LOCAL(mask, WASM_SIMD_I32x4_REPLACE_LANE(
277 2, WASM_GET_LOCAL(mask), WASM_I32V(-1))), 267 2, WASM_GET_LOCAL(mask), WASM_I32V(-1))),
278 WASM_SET_LOCAL(mask, WASM_SIMD_S32x4_SELECT(WASM_GET_LOCAL(mask), 268 WASM_SET_LOCAL(mask, WASM_SIMD_S32x4_SELECT(WASM_GET_LOCAL(mask),
279 WASM_GET_LOCAL(src1), 269 WASM_GET_LOCAL(src1),
280 WASM_GET_LOCAL(src2))), 270 WASM_GET_LOCAL(src2))),
281 WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val2, 0), 271 WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val2, 0),
282 WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val1, 1), 272 WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val1, 1),
283 WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val1, 2), 273 WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val1, 2),
284 WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val2, 3), 274 WASM_SIMD_CHECK_LANE(I32x4, mask, I32, val2, 3), WASM_ONE);
285 WASM_RETURN1(WASM_ONE)));
286 275
287 CHECK_EQ(1, r.Call(0x1234, 0x5678)); 276 CHECK_EQ(1, r.Call(0x1234, 0x5678));
288 } 277 }
289 278
290 void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op) { 279 void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op) {
291 FLAG_wasm_simd_prototype = true; 280 FLAG_wasm_simd_prototype = true;
292 WasmRunner<int32_t, float, float> r(kExecuteCompiled); 281 WasmRunner<int32_t, float, float> r(kExecuteCompiled);
293 byte a = 0; 282 byte a = 0;
294 byte expected = 1; 283 byte expected = 1;
295 byte simd = r.AllocateLocal(kWasmS128); 284 byte simd = r.AllocateLocal(kWasmS128);
296 BUILD(r, WASM_BLOCK( 285 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))),
297 WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), 286 WASM_SET_LOCAL(simd,
298 WASM_SET_LOCAL( 287 WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))),
299 simd, WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))), 288 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd, expected), WASM_ONE);
300 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd, expected),
301 WASM_RETURN1(WASM_ONE)));
302 289
303 FOR_FLOAT32_INPUTS(i) { 290 FOR_FLOAT32_INPUTS(i) {
304 if (std::isnan(*i)) continue; 291 if (std::isnan(*i)) continue;
305 CHECK_EQ(1, r.Call(*i, expected_op(*i))); 292 CHECK_EQ(1, r.Call(*i, expected_op(*i)));
306 } 293 }
307 } 294 }
308 295
309 WASM_EXEC_TEST(F32x4Abs) { RunF32x4UnOpTest(kExprF32x4Abs, std::abs); } 296 WASM_EXEC_TEST(F32x4Abs) { RunF32x4UnOpTest(kExprF32x4Abs, std::abs); }
310 WASM_EXEC_TEST(F32x4Neg) { RunF32x4UnOpTest(kExprF32x4Neg, Negate); } 297 WASM_EXEC_TEST(F32x4Neg) { RunF32x4UnOpTest(kExprF32x4Neg, Negate); }
311 298
312 void RunF32x4BinOpTest(WasmOpcode simd_op, FloatBinOp expected_op) { 299 void RunF32x4BinOpTest(WasmOpcode simd_op, FloatBinOp expected_op) {
313 FLAG_wasm_simd_prototype = true; 300 FLAG_wasm_simd_prototype = true;
314 WasmRunner<int32_t, float, float, float> r(kExecuteCompiled); 301 WasmRunner<int32_t, float, float, float> r(kExecuteCompiled);
315 byte a = 0; 302 byte a = 0;
316 byte b = 1; 303 byte b = 1;
317 byte expected = 2; 304 byte expected = 2;
318 byte simd0 = r.AllocateLocal(kWasmS128); 305 byte simd0 = r.AllocateLocal(kWasmS128);
319 byte simd1 = r.AllocateLocal(kWasmS128); 306 byte simd1 = r.AllocateLocal(kWasmS128);
320 BUILD(r, WASM_BLOCK( 307 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))),
321 WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), 308 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))),
322 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), 309 WASM_SET_LOCAL(simd1,
323 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu, 310 WASM_SIMD_BINOP(simd_op & 0xffu, WASM_GET_LOCAL(simd0),
324 WASM_GET_LOCAL(simd0), 311 WASM_GET_LOCAL(simd1))),
325 WASM_GET_LOCAL(simd1))), 312 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd1, expected), WASM_ONE);
326 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd1, expected),
327 WASM_RETURN1(WASM_ONE)));
328 313
329 FOR_FLOAT32_INPUTS(i) { 314 FOR_FLOAT32_INPUTS(i) {
330 if (std::isnan(*i)) continue; 315 if (std::isnan(*i)) continue;
331 FOR_FLOAT32_INPUTS(j) { 316 FOR_FLOAT32_INPUTS(j) {
332 if (std::isnan(*j)) continue; 317 if (std::isnan(*j)) continue;
333 float expected = expected_op(*i, *j); 318 float expected = expected_op(*i, *j);
334 // SIMD on some platforms may handle denormalized numbers differently. 319 // SIMD on some platforms may handle denormalized numbers differently.
335 // TODO(bbudge) On platforms that flush denorms to zero, test with 320 // TODO(bbudge) On platforms that flush denorms to zero, test with
336 // expected == 0. 321 // expected == 0.
337 if (std::fpclassify(expected) == FP_SUBNORMAL) continue; 322 if (std::fpclassify(expected) == FP_SUBNORMAL) continue;
338 CHECK_EQ(1, r.Call(*i, *j, expected)); 323 CHECK_EQ(1, r.Call(*i, *j, expected));
339 } 324 }
340 } 325 }
341 } 326 }
342 327
343 WASM_EXEC_TEST(F32x4Add) { RunF32x4BinOpTest(kExprF32x4Add, Add); } 328 WASM_EXEC_TEST(F32x4Add) { RunF32x4BinOpTest(kExprF32x4Add, Add); }
344 WASM_EXEC_TEST(F32x4Sub) { RunF32x4BinOpTest(kExprF32x4Sub, Sub); } 329 WASM_EXEC_TEST(F32x4Sub) { RunF32x4BinOpTest(kExprF32x4Sub, Sub); }
345 330
346 void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) { 331 void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) {
347 FLAG_wasm_simd_prototype = true; 332 FLAG_wasm_simd_prototype = true;
348 WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled); 333 WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled);
349 byte a = 0; 334 byte a = 0;
350 byte b = 1; 335 byte b = 1;
351 byte expected = 2; 336 byte expected = 2;
352 byte simd0 = r.AllocateLocal(kWasmS128); 337 byte simd0 = r.AllocateLocal(kWasmS128);
353 byte simd1 = r.AllocateLocal(kWasmS128); 338 byte simd1 = r.AllocateLocal(kWasmS128);
354 BUILD(r, WASM_BLOCK( 339 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))),
355 WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), 340 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))),
356 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), 341 WASM_SET_LOCAL(simd1,
357 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu, 342 WASM_SIMD_BINOP(simd_op & 0xffu, WASM_GET_LOCAL(simd0),
358 WASM_GET_LOCAL(simd0), 343 WASM_GET_LOCAL(simd1))),
359 WASM_GET_LOCAL(simd1))), 344 WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE);
360 WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected),
361 WASM_RETURN1(WASM_ONE)));
362 345
363 FOR_FLOAT32_INPUTS(i) { 346 FOR_FLOAT32_INPUTS(i) {
364 if (std::isnan(*i)) continue; 347 if (std::isnan(*i)) continue;
365 FOR_FLOAT32_INPUTS(j) { 348 FOR_FLOAT32_INPUTS(j) {
366 if (std::isnan(*j)) continue; 349 if (std::isnan(*j)) continue;
367 // SIMD on some platforms may handle denormalized numbers differently. 350 // SIMD on some platforms may handle denormalized numbers differently.
368 // Check for number pairs that are very close together. 351 // Check for number pairs that are very close together.
369 if (std::fpclassify(*i - *j) == FP_SUBNORMAL) continue; 352 if (std::fpclassify(*i - *j) == FP_SUBNORMAL) continue;
370 CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); 353 CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j)));
371 } 354 }
(...skipping 13 matching lines...) Expand all
385 // 368 //
386 // SetLocal(1, I32x4Splat(Local(0))); 369 // SetLocal(1, I32x4Splat(Local(0)));
387 // For each lane index 370 // For each lane index
388 // if(Local(0) != I32x4ExtractLane(Local(1), index) 371 // if(Local(0) != I32x4ExtractLane(Local(1), index)
389 // return 0 372 // return 0
390 // 373 //
391 // return 1 374 // return 1
392 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 375 WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
393 byte lane_val = 0; 376 byte lane_val = 0;
394 byte simd = r.AllocateLocal(kWasmS128); 377 byte simd = r.AllocateLocal(kWasmS128);
395 BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT( 378 BUILD(r,
396 WASM_GET_LOCAL(lane_val))), 379 WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(lane_val))),
397 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, lane_val), 380 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, lane_val), WASM_ONE);
398 WASM_RETURN1(WASM_ONE)));
399 381
400 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } 382 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
401 } 383 }
402 384
403 WASM_EXEC_TEST(I32x4ReplaceLane) { 385 WASM_EXEC_TEST(I32x4ReplaceLane) {
404 FLAG_wasm_simd_prototype = true; 386 FLAG_wasm_simd_prototype = true;
405 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); 387 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
406 byte old_val = 0; 388 byte old_val = 0;
407 byte new_val = 1; 389 byte new_val = 1;
408 byte simd = r.AllocateLocal(kWasmS128); 390 byte simd = r.AllocateLocal(kWasmS128);
409 BUILD(r, WASM_BLOCK( 391 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(old_val))),
410 WASM_SET_LOCAL(simd, 392 WASM_SET_LOCAL(simd,
411 WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(old_val))), 393 WASM_SIMD_I32x4_REPLACE_LANE(0, WASM_GET_LOCAL(simd),
412 WASM_SET_LOCAL( 394 WASM_GET_LOCAL(new_val))),
413 simd, WASM_SIMD_I32x4_REPLACE_LANE(0, WASM_GET_LOCAL(simd), 395 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, old_val, old_val, old_val),
414 WASM_GET_LOCAL(new_val))), 396 WASM_SET_LOCAL(simd,
415 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, old_val, old_val, 397 WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GET_LOCAL(simd),
416 old_val), 398 WASM_GET_LOCAL(new_val))),
417 WASM_SET_LOCAL( 399 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, new_val, old_val, old_val),
418 simd, WASM_SIMD_I32x4_REPLACE_LANE(1, WASM_GET_LOCAL(simd), 400 WASM_SET_LOCAL(simd,
419 WASM_GET_LOCAL(new_val))), 401 WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(simd),
420 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, new_val, old_val, 402 WASM_GET_LOCAL(new_val))),
421 old_val), 403 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, new_val, new_val, old_val),
422 WASM_SET_LOCAL( 404 WASM_SET_LOCAL(simd,
423 simd, WASM_SIMD_I32x4_REPLACE_LANE(2, WASM_GET_LOCAL(simd), 405 WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_LOCAL(simd),
424 WASM_GET_LOCAL(new_val))), 406 WASM_GET_LOCAL(new_val))),
425 WASM_SIMD_CHECK4(I32x4, simd, I32, new_val, new_val, new_val, 407 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, new_val), WASM_ONE);
426 old_val),
427 WASM_SET_LOCAL(
428 simd, WASM_SIMD_I32x4_REPLACE_LANE(3, WASM_GET_LOCAL(simd),
429 WASM_GET_LOCAL(new_val))),
430 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, new_val),
431 WASM_RETURN1(WASM_ONE)));
432 408
433 CHECK_EQ(1, r.Call(1, 2)); 409 CHECK_EQ(1, r.Call(1, 2));
434 } 410 }
435 411
436 #if V8_TARGET_ARCH_ARM 412 #if V8_TARGET_ARCH_ARM
437 413
438 WASM_EXEC_TEST(I16x8Splat) { 414 WASM_EXEC_TEST(I16x8Splat) {
439 FLAG_wasm_simd_prototype = true; 415 FLAG_wasm_simd_prototype = true;
440 416
441 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 417 WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
442 byte lane_val = 0; 418 byte lane_val = 0;
443 byte simd = r.AllocateLocal(kWasmS128); 419 byte simd = r.AllocateLocal(kWasmS128);
444 BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT( 420 BUILD(r,
445 WASM_GET_LOCAL(lane_val))), 421 WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(lane_val))),
446 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), 422 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), WASM_ONE);
447 WASM_RETURN1(WASM_ONE)));
448 423
449 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } 424 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
450 } 425 }
451 426
452 WASM_EXEC_TEST(I16x8ReplaceLane) { 427 WASM_EXEC_TEST(I16x8ReplaceLane) {
453 FLAG_wasm_simd_prototype = true; 428 FLAG_wasm_simd_prototype = true;
454 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); 429 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
455 byte old_val = 0; 430 byte old_val = 0;
456 byte new_val = 1; 431 byte new_val = 1;
457 byte simd = r.AllocateLocal(kWasmS128); 432 byte simd = r.AllocateLocal(kWasmS128);
458 BUILD(r, WASM_BLOCK( 433 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(old_val))),
459 WASM_SET_LOCAL(simd, 434 WASM_SET_LOCAL(simd,
460 WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(old_val))), 435 WASM_SIMD_I16x8_REPLACE_LANE(0, WASM_GET_LOCAL(simd),
461 WASM_SET_LOCAL( 436 WASM_GET_LOCAL(new_val))),
462 simd, WASM_SIMD_I16x8_REPLACE_LANE(0, WASM_GET_LOCAL(simd), 437 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, old_val, old_val, old_val,
463 WASM_GET_LOCAL(new_val))), 438 old_val, old_val, old_val, old_val),
464 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, old_val, old_val, 439 WASM_SET_LOCAL(simd,
465 old_val, old_val, old_val, old_val, old_val), 440 WASM_SIMD_I16x8_REPLACE_LANE(1, WASM_GET_LOCAL(simd),
466 WASM_SET_LOCAL( 441 WASM_GET_LOCAL(new_val))),
467 simd, WASM_SIMD_I16x8_REPLACE_LANE(1, WASM_GET_LOCAL(simd), 442 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, old_val, old_val,
468 WASM_GET_LOCAL(new_val))), 443 old_val, old_val, old_val, old_val),
469 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, old_val, 444 WASM_SET_LOCAL(simd,
470 old_val, old_val, old_val, old_val, old_val), 445 WASM_SIMD_I16x8_REPLACE_LANE(2, WASM_GET_LOCAL(simd),
471 WASM_SET_LOCAL( 446 WASM_GET_LOCAL(new_val))),
472 simd, WASM_SIMD_I16x8_REPLACE_LANE(2, WASM_GET_LOCAL(simd), 447 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, old_val,
473 WASM_GET_LOCAL(new_val))), 448 old_val, old_val, old_val, old_val),
474 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, 449 WASM_SET_LOCAL(simd,
475 old_val, old_val, old_val, old_val, old_val), 450 WASM_SIMD_I16x8_REPLACE_LANE(3, WASM_GET_LOCAL(simd),
476 WASM_SET_LOCAL( 451 WASM_GET_LOCAL(new_val))),
477 simd, WASM_SIMD_I16x8_REPLACE_LANE(3, WASM_GET_LOCAL(simd), 452 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val,
478 WASM_GET_LOCAL(new_val))), 453 old_val, old_val, old_val, old_val),
479 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, 454 WASM_SET_LOCAL(simd,
480 new_val, old_val, old_val, old_val, old_val), 455 WASM_SIMD_I16x8_REPLACE_LANE(4, WASM_GET_LOCAL(simd),
481 WASM_SET_LOCAL( 456 WASM_GET_LOCAL(new_val))),
482 simd, WASM_SIMD_I16x8_REPLACE_LANE(4, WASM_GET_LOCAL(simd), 457 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val,
483 WASM_GET_LOCAL(new_val))), 458 new_val, old_val, old_val, old_val),
484 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, 459 WASM_SET_LOCAL(simd,
485 new_val, new_val, old_val, old_val, old_val), 460 WASM_SIMD_I16x8_REPLACE_LANE(5, WASM_GET_LOCAL(simd),
486 WASM_SET_LOCAL( 461 WASM_GET_LOCAL(new_val))),
487 simd, WASM_SIMD_I16x8_REPLACE_LANE(5, WASM_GET_LOCAL(simd), 462 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val,
488 WASM_GET_LOCAL(new_val))), 463 new_val, new_val, old_val, old_val),
489 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, 464 WASM_SET_LOCAL(simd,
490 new_val, new_val, new_val, old_val, old_val), 465 WASM_SIMD_I16x8_REPLACE_LANE(6, WASM_GET_LOCAL(simd),
491 WASM_SET_LOCAL( 466 WASM_GET_LOCAL(new_val))),
492 simd, WASM_SIMD_I16x8_REPLACE_LANE(6, WASM_GET_LOCAL(simd), 467 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, new_val,
493 WASM_GET_LOCAL(new_val))), 468 new_val, new_val, new_val, old_val),
494 WASM_SIMD_CHECK8(I16x8, simd, I32, new_val, new_val, new_val, 469 WASM_SET_LOCAL(simd,
495 new_val, new_val, new_val, new_val, old_val), 470 WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd),
496 WASM_SET_LOCAL( 471 WASM_GET_LOCAL(new_val))),
497 simd, WASM_SIMD_I16x8_REPLACE_LANE(7, WASM_GET_LOCAL(simd), 472 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val), WASM_ONE);
498 WASM_GET_LOCAL(new_val))),
499 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, new_val),
500 WASM_RETURN1(WASM_ONE)));
501 473
502 CHECK_EQ(1, r.Call(1, 2)); 474 CHECK_EQ(1, r.Call(1, 2));
503 } 475 }
504 476
505 WASM_EXEC_TEST(I8x16Splat) { 477 WASM_EXEC_TEST(I8x16Splat) {
506 FLAG_wasm_simd_prototype = true; 478 FLAG_wasm_simd_prototype = true;
507 479
508 WasmRunner<int32_t, int32_t> r(kExecuteCompiled); 480 WasmRunner<int32_t, int32_t> r(kExecuteCompiled);
509 byte lane_val = 0; 481 byte lane_val = 0;
510 byte simd = r.AllocateLocal(kWasmS128); 482 byte simd = r.AllocateLocal(kWasmS128);
511 BUILD(r, WASM_BLOCK(WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT( 483 BUILD(r,
512 WASM_GET_LOCAL(lane_val))), 484 WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))),
513 WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), 485 WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE);
514 WASM_RETURN1(WASM_ONE)));
515 486
516 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } 487 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
517 } 488 }
518 489
519 WASM_EXEC_TEST(I8x16ReplaceLane) { 490 WASM_EXEC_TEST(I8x16ReplaceLane) {
520 FLAG_wasm_simd_prototype = true; 491 FLAG_wasm_simd_prototype = true;
521 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); 492 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
522 byte old_val = 0; 493 byte old_val = 0;
523 byte new_val = 1; 494 byte new_val = 1;
524 byte simd = r.AllocateLocal(kWasmS128); 495 byte simd = r.AllocateLocal(kWasmS128);
525 BUILD(r, WASM_BLOCK( 496 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(old_val))),
526 WASM_SET_LOCAL(simd, 497 WASM_SET_LOCAL(simd,
527 WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(old_val))), 498 WASM_SIMD_I8x16_REPLACE_LANE(0, WASM_GET_LOCAL(simd),
528 WASM_SET_LOCAL( 499 WASM_GET_LOCAL(new_val))),
529 simd, WASM_SIMD_I8x16_REPLACE_LANE(0, WASM_GET_LOCAL(simd), 500 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, old_val, old_val, old_val,
530 WASM_GET_LOCAL(new_val))), 501 old_val, old_val, old_val, old_val, old_val, old_val,
531 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, old_val, old_val, 502 old_val, old_val, old_val, old_val, old_val, old_val),
532 old_val, old_val, old_val, old_val, old_val, 503 WASM_SET_LOCAL(simd,
533 old_val, old_val, old_val, old_val, old_val, 504 WASM_SIMD_I8x16_REPLACE_LANE(1, WASM_GET_LOCAL(simd),
534 old_val, old_val, old_val), 505 WASM_GET_LOCAL(new_val))),
535 WASM_SET_LOCAL( 506 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, old_val, old_val,
536 simd, WASM_SIMD_I8x16_REPLACE_LANE(1, WASM_GET_LOCAL(simd), 507 old_val, old_val, old_val, old_val, old_val, old_val,
537 WASM_GET_LOCAL(new_val))), 508 old_val, old_val, old_val, old_val, old_val, old_val),
538 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, old_val, 509 WASM_SET_LOCAL(simd,
539 old_val, old_val, old_val, old_val, old_val, 510 WASM_SIMD_I8x16_REPLACE_LANE(2, WASM_GET_LOCAL(simd),
540 old_val, old_val, old_val, old_val, old_val, 511 WASM_GET_LOCAL(new_val))),
541 old_val, old_val, old_val), 512 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, old_val,
542 WASM_SET_LOCAL( 513 old_val, old_val, old_val, old_val, old_val, old_val,
543 simd, WASM_SIMD_I8x16_REPLACE_LANE(2, WASM_GET_LOCAL(simd), 514 old_val, old_val, old_val, old_val, old_val, old_val),
544 WASM_GET_LOCAL(new_val))), 515 WASM_SET_LOCAL(simd,
545 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 516 WASM_SIMD_I8x16_REPLACE_LANE(3, WASM_GET_LOCAL(simd),
546 old_val, old_val, old_val, old_val, old_val, 517 WASM_GET_LOCAL(new_val))),
547 old_val, old_val, old_val, old_val, old_val, 518 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
548 old_val, old_val, old_val), 519 old_val, old_val, old_val, old_val, old_val, old_val,
549 WASM_SET_LOCAL( 520 old_val, old_val, old_val, old_val, old_val, old_val),
550 simd, WASM_SIMD_I8x16_REPLACE_LANE(3, WASM_GET_LOCAL(simd), 521 WASM_SET_LOCAL(simd,
551 WASM_GET_LOCAL(new_val))), 522 WASM_SIMD_I8x16_REPLACE_LANE(4, WASM_GET_LOCAL(simd),
552 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 523 WASM_GET_LOCAL(new_val))),
553 new_val, old_val, old_val, old_val, old_val, 524 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
554 old_val, old_val, old_val, old_val, old_val, 525 new_val, old_val, old_val, old_val, old_val, old_val,
555 old_val, old_val, old_val), 526 old_val, old_val, old_val, old_val, old_val, old_val),
556 WASM_SET_LOCAL( 527 WASM_SET_LOCAL(simd,
557 simd, WASM_SIMD_I8x16_REPLACE_LANE(4, WASM_GET_LOCAL(simd), 528 WASM_SIMD_I8x16_REPLACE_LANE(5, WASM_GET_LOCAL(simd),
558 WASM_GET_LOCAL(new_val))), 529 WASM_GET_LOCAL(new_val))),
559 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 530 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
560 new_val, new_val, old_val, old_val, old_val, 531 new_val, new_val, old_val, old_val, old_val, old_val,
561 old_val, old_val, old_val, old_val, old_val, 532 old_val, old_val, old_val, old_val, old_val, old_val),
562 old_val, old_val, old_val), 533 WASM_SET_LOCAL(simd,
563 WASM_SET_LOCAL( 534 WASM_SIMD_I8x16_REPLACE_LANE(6, WASM_GET_LOCAL(simd),
564 simd, WASM_SIMD_I8x16_REPLACE_LANE(5, WASM_GET_LOCAL(simd), 535 WASM_GET_LOCAL(new_val))),
565 WASM_GET_LOCAL(new_val))), 536 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
566 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 537 new_val, new_val, new_val, old_val, old_val, old_val,
567 new_val, new_val, new_val, old_val, old_val, 538 old_val, old_val, old_val, old_val, old_val, old_val),
568 old_val, old_val, old_val, old_val, old_val, 539 WASM_SET_LOCAL(simd,
569 old_val, old_val, old_val), 540 WASM_SIMD_I8x16_REPLACE_LANE(7, WASM_GET_LOCAL(simd),
570 WASM_SET_LOCAL( 541 WASM_GET_LOCAL(new_val))),
571 simd, WASM_SIMD_I8x16_REPLACE_LANE(6, WASM_GET_LOCAL(simd), 542 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
572 WASM_GET_LOCAL(new_val))), 543 new_val, new_val, new_val, new_val, old_val, old_val,
573 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 544 old_val, old_val, old_val, old_val, old_val, old_val),
574 new_val, new_val, new_val, new_val, old_val, 545 WASM_SET_LOCAL(simd,
575 old_val, old_val, old_val, old_val, old_val, 546 WASM_SIMD_I8x16_REPLACE_LANE(8, WASM_GET_LOCAL(simd),
576 old_val, old_val, old_val), 547 WASM_GET_LOCAL(new_val))),
577 WASM_SET_LOCAL( 548 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
578 simd, WASM_SIMD_I8x16_REPLACE_LANE(7, WASM_GET_LOCAL(simd), 549 new_val, new_val, new_val, new_val, new_val, old_val,
579 WASM_GET_LOCAL(new_val))), 550 old_val, old_val, old_val, old_val, old_val, old_val),
580 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 551 WASM_SET_LOCAL(simd,
581 new_val, new_val, new_val, new_val, new_val, 552 WASM_SIMD_I8x16_REPLACE_LANE(9, WASM_GET_LOCAL(simd),
582 old_val, old_val, old_val, old_val, old_val, 553 WASM_GET_LOCAL(new_val))),
583 old_val, old_val, old_val), 554 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
584 WASM_SET_LOCAL( 555 new_val, new_val, new_val, new_val, new_val, new_val,
585 simd, WASM_SIMD_I8x16_REPLACE_LANE(8, WASM_GET_LOCAL(simd), 556 old_val, old_val, old_val, old_val, old_val, old_val),
586 WASM_GET_LOCAL(new_val))), 557 WASM_SET_LOCAL(simd,
587 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 558 WASM_SIMD_I8x16_REPLACE_LANE(10, WASM_GET_LOCAL(simd),
588 new_val, new_val, new_val, new_val, new_val, 559 WASM_GET_LOCAL(new_val))),
589 new_val, old_val, old_val, old_val, old_val, 560 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
590 old_val, old_val, old_val), 561 new_val, new_val, new_val, new_val, new_val, new_val,
591 WASM_SET_LOCAL( 562 new_val, old_val, old_val, old_val, old_val, old_val),
592 simd, WASM_SIMD_I8x16_REPLACE_LANE(9, WASM_GET_LOCAL(simd), 563 WASM_SET_LOCAL(simd,
593 WASM_GET_LOCAL(new_val))), 564 WASM_SIMD_I8x16_REPLACE_LANE(11, WASM_GET_LOCAL(simd),
594 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 565 WASM_GET_LOCAL(new_val))),
595 new_val, new_val, new_val, new_val, new_val, 566 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
596 new_val, new_val, old_val, old_val, old_val, 567 new_val, new_val, new_val, new_val, new_val, new_val,
597 old_val, old_val, old_val), 568 new_val, new_val, old_val, old_val, old_val, old_val),
598 WASM_SET_LOCAL( 569 WASM_SET_LOCAL(simd,
599 simd, WASM_SIMD_I8x16_REPLACE_LANE(10, WASM_GET_LOCAL(simd), 570 WASM_SIMD_I8x16_REPLACE_LANE(12, WASM_GET_LOCAL(simd),
600 WASM_GET_LOCAL(new_val))), 571 WASM_GET_LOCAL(new_val))),
601 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 572 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
602 new_val, new_val, new_val, new_val, new_val, 573 new_val, new_val, new_val, new_val, new_val, new_val,
603 new_val, new_val, new_val, old_val, old_val, 574 new_val, new_val, new_val, old_val, old_val, old_val),
604 old_val, old_val, old_val), 575 WASM_SET_LOCAL(simd,
605 WASM_SET_LOCAL( 576 WASM_SIMD_I8x16_REPLACE_LANE(13, WASM_GET_LOCAL(simd),
606 simd, WASM_SIMD_I8x16_REPLACE_LANE(11, WASM_GET_LOCAL(simd), 577 WASM_GET_LOCAL(new_val))),
607 WASM_GET_LOCAL(new_val))), 578 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
608 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 579 new_val, new_val, new_val, new_val, new_val, new_val,
609 new_val, new_val, new_val, new_val, new_val, 580 new_val, new_val, new_val, new_val, old_val, old_val),
610 new_val, new_val, new_val, new_val, old_val, 581 WASM_SET_LOCAL(simd,
611 old_val, old_val, old_val), 582 WASM_SIMD_I8x16_REPLACE_LANE(14, WASM_GET_LOCAL(simd),
612 WASM_SET_LOCAL( 583 WASM_GET_LOCAL(new_val))),
613 simd, WASM_SIMD_I8x16_REPLACE_LANE(12, WASM_GET_LOCAL(simd), 584 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, new_val,
614 WASM_GET_LOCAL(new_val))), 585 new_val, new_val, new_val, new_val, new_val, new_val,
615 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val, 586 new_val, new_val, new_val, new_val, new_val, old_val),
616 new_val, new_val, new_val, new_val, new_val, 587 WASM_SET_LOCAL(simd,
617 new_val, new_val, new_val, new_val, new_val, 588 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd),
618 old_val, old_val, old_val), 589 WASM_GET_LOCAL(new_val))),
619 WASM_SET_LOCAL( 590 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE);
620 simd, WASM_SIMD_I8x16_REPLACE_LANE(13, WASM_GET_LOCAL(simd),
621 WASM_GET_LOCAL(new_val))),
622 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val,
623 new_val, new_val, new_val, new_val, new_val,
624 new_val, new_val, new_val, new_val, new_val,
625 new_val, old_val, old_val),
626 WASM_SET_LOCAL(
627 simd, WASM_SIMD_I8x16_REPLACE_LANE(14, WASM_GET_LOCAL(simd),
628 WASM_GET_LOCAL(new_val))),
629 WASM_SIMD_CHECK16(I8x16, simd, I32, new_val, new_val, new_val,
630 new_val, new_val, new_val, new_val, new_val,
631 new_val, new_val, new_val, new_val, new_val,
632 new_val, new_val, old_val),
633 WASM_SET_LOCAL(
634 simd, WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd),
635 WASM_GET_LOCAL(new_val))),
636 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val),
637 WASM_RETURN1(WASM_ONE)));
638 591
639 CHECK_EQ(1, r.Call(1, 2)); 592 CHECK_EQ(1, r.Call(1, 2));
640 } 593 }
641 594
642 // Determines if conversion from float to int will be valid. 595 // Determines if conversion from float to int will be valid.
643 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { 596 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) {
644 const double max_uint = static_cast<double>(0xffffffffu); 597 const double max_uint = static_cast<double>(0xffffffffu);
645 const double max_int = static_cast<double>(kMaxInt); 598 const double max_int = static_cast<double>(kMaxInt);
646 const double min_int = static_cast<double>(kMinInt); 599 const double min_int = static_cast<double>(kMinInt);
647 600
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 // Tests both signed and unsigned conversion. 635 // Tests both signed and unsigned conversion.
683 WASM_EXEC_TEST(I32x4FromFloat32x4) { 636 WASM_EXEC_TEST(I32x4FromFloat32x4) {
684 FLAG_wasm_simd_prototype = true; 637 FLAG_wasm_simd_prototype = true;
685 WasmRunner<int32_t, float, int32_t, int32_t> r(kExecuteCompiled); 638 WasmRunner<int32_t, float, int32_t, int32_t> r(kExecuteCompiled);
686 byte a = 0; 639 byte a = 0;
687 byte expected_signed = 1; 640 byte expected_signed = 1;
688 byte expected_unsigned = 2; 641 byte expected_unsigned = 2;
689 byte simd0 = r.AllocateLocal(kWasmS128); 642 byte simd0 = r.AllocateLocal(kWasmS128);
690 byte simd1 = r.AllocateLocal(kWasmS128); 643 byte simd1 = r.AllocateLocal(kWasmS128);
691 byte simd2 = r.AllocateLocal(kWasmS128); 644 byte simd2 = r.AllocateLocal(kWasmS128);
692 BUILD(r, WASM_BLOCK( 645 BUILD(
693 WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), 646 r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))),
694 WASM_SET_LOCAL( 647 WASM_SET_LOCAL(simd1, WASM_SIMD_I32x4_FROM_F32x4(WASM_GET_LOCAL(simd0))),
695 simd1, WASM_SIMD_I32x4_FROM_F32x4(WASM_GET_LOCAL(simd0))), 648 WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected_signed),
696 WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected_signed), 649 WASM_SET_LOCAL(simd2, WASM_SIMD_U32x4_FROM_F32x4(WASM_GET_LOCAL(simd0))),
697 WASM_SET_LOCAL( 650 WASM_SIMD_CHECK_SPLAT4(I32x4, simd2, I32, expected_unsigned), WASM_ONE);
698 simd2, WASM_SIMD_U32x4_FROM_F32x4(WASM_GET_LOCAL(simd0))),
699 WASM_SIMD_CHECK_SPLAT4(I32x4, simd2, I32, expected_unsigned),
700 WASM_RETURN1(WASM_ONE)));
701 651
702 FOR_FLOAT32_INPUTS(i) { 652 FOR_FLOAT32_INPUTS(i) {
703 int32_t signed_value = ConvertToInt(*i, false); 653 int32_t signed_value = ConvertToInt(*i, false);
704 int32_t unsigned_value = ConvertToInt(*i, true); 654 int32_t unsigned_value = ConvertToInt(*i, true);
705 CHECK_EQ(1, r.Call(*i, signed_value, unsigned_value)); 655 CHECK_EQ(1, r.Call(*i, signed_value, unsigned_value));
706 } 656 }
707 } 657 }
708 658
709 void RunI32x4UnOpTest(WasmOpcode simd_op, Int32UnOp expected_op) { 659 void RunI32x4UnOpTest(WasmOpcode simd_op, Int32UnOp expected_op) {
710 FLAG_wasm_simd_prototype = true; 660 FLAG_wasm_simd_prototype = true;
711 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); 661 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
712 byte a = 0; 662 byte a = 0;
713 byte expected = 1; 663 byte expected = 1;
714 byte simd = r.AllocateLocal(kWasmS128); 664 byte simd = r.AllocateLocal(kWasmS128);
715 BUILD(r, WASM_BLOCK( 665 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))),
716 WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), 666 WASM_SET_LOCAL(simd,
717 WASM_SET_LOCAL( 667 WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))),
718 simd, WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))), 668 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE);
719 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected),
720 WASM_RETURN1(WASM_ONE)));
721 669
722 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } 670 FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
723 } 671 }
724 672
725 WASM_EXEC_TEST(I32x4Neg) { RunI32x4UnOpTest(kExprI32x4Neg, Negate); } 673 WASM_EXEC_TEST(I32x4Neg) { RunI32x4UnOpTest(kExprI32x4Neg, Negate); }
726 #endif // V8_TARGET_ARCH_ARM 674 #endif // V8_TARGET_ARCH_ARM
727 675
728 void RunI32x4BinOpTest(WasmOpcode simd_op, Int32BinOp expected_op) { 676 void RunI32x4BinOpTest(WasmOpcode simd_op, Int32BinOp expected_op) {
729 FLAG_wasm_simd_prototype = true; 677 FLAG_wasm_simd_prototype = true;
730 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); 678 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled);
731 byte a = 0; 679 byte a = 0;
732 byte b = 1; 680 byte b = 1;
733 byte expected = 2; 681 byte expected = 2;
734 byte simd0 = r.AllocateLocal(kWasmS128); 682 byte simd0 = r.AllocateLocal(kWasmS128);
735 byte simd1 = r.AllocateLocal(kWasmS128); 683 byte simd1 = r.AllocateLocal(kWasmS128);
736 BUILD(r, WASM_BLOCK( 684 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))),
737 WASM_SET_LOCAL(simd0, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), 685 WASM_SET_LOCAL(simd1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(b))),
738 WASM_SET_LOCAL(simd1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(b))), 686 WASM_SET_LOCAL(simd1,
739 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu, 687 WASM_SIMD_BINOP(simd_op & 0xffu, WASM_GET_LOCAL(simd0),
740 WASM_GET_LOCAL(simd0), 688 WASM_GET_LOCAL(simd1))),
741 WASM_GET_LOCAL(simd1))), 689 WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE);
742 WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected),
743 WASM_RETURN1(WASM_ONE)));
744 690
745 FOR_INT32_INPUTS(i) { 691 FOR_INT32_INPUTS(i) {
746 FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } 692 FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
747 } 693 }
748 } 694 }
749 695
750 WASM_EXEC_TEST(I32x4Add) { RunI32x4BinOpTest(kExprI32x4Add, Add); } 696 WASM_EXEC_TEST(I32x4Add) { RunI32x4BinOpTest(kExprI32x4Add, Add); }
751 697
752 WASM_EXEC_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); } 698 WASM_EXEC_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); }
753 699
(...skipping 27 matching lines...) Expand all
781 WASM_EXEC_TEST(Ui32x4LessEqual) { 727 WASM_EXEC_TEST(Ui32x4LessEqual) {
782 RunI32x4BinOpTest(kExprI32x4LeU, UnsignedLessEqual); 728 RunI32x4BinOpTest(kExprI32x4LeU, UnsignedLessEqual);
783 } 729 }
784 730
785 void RunI16x8UnOpTest(WasmOpcode simd_op, Int16UnOp expected_op) { 731 void RunI16x8UnOpTest(WasmOpcode simd_op, Int16UnOp expected_op) {
786 FLAG_wasm_simd_prototype = true; 732 FLAG_wasm_simd_prototype = true;
787 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); 733 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
788 byte a = 0; 734 byte a = 0;
789 byte expected = 1; 735 byte expected = 1;
790 byte simd = r.AllocateLocal(kWasmS128); 736 byte simd = r.AllocateLocal(kWasmS128);
791 BUILD(r, WASM_BLOCK( 737 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))),
792 WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), 738 WASM_SET_LOCAL(simd,
793 WASM_SET_LOCAL( 739 WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))),
794 simd, WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))), 740 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE);
795 WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected),
796 WASM_RETURN1(WASM_ONE)));
797 741
798 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } 742 FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
799 } 743 }
800 744
801 WASM_EXEC_TEST(I16x8Neg) { RunI16x8UnOpTest(kExprI16x8Neg, Negate); } 745 WASM_EXEC_TEST(I16x8Neg) { RunI16x8UnOpTest(kExprI16x8Neg, Negate); }
802 746
803 void RunI16x8BinOpTest(WasmOpcode simd_op, Int16BinOp expected_op) { 747 void RunI16x8BinOpTest(WasmOpcode simd_op, Int16BinOp expected_op) {
804 FLAG_wasm_simd_prototype = true; 748 FLAG_wasm_simd_prototype = true;
805 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); 749 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled);
806 byte a = 0; 750 byte a = 0;
807 byte b = 1; 751 byte b = 1;
808 byte expected = 2; 752 byte expected = 2;
809 byte simd0 = r.AllocateLocal(kWasmS128); 753 byte simd0 = r.AllocateLocal(kWasmS128);
810 byte simd1 = r.AllocateLocal(kWasmS128); 754 byte simd1 = r.AllocateLocal(kWasmS128);
811 BUILD(r, WASM_BLOCK( 755 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))),
812 WASM_SET_LOCAL(simd0, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(a))), 756 WASM_SET_LOCAL(simd1, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(b))),
813 WASM_SET_LOCAL(simd1, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(b))), 757 WASM_SET_LOCAL(simd1,
814 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu, 758 WASM_SIMD_BINOP(simd_op & 0xffu, WASM_GET_LOCAL(simd0),
815 WASM_GET_LOCAL(simd0), 759 WASM_GET_LOCAL(simd1))),
816 WASM_GET_LOCAL(simd1))), 760 WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected), WASM_ONE);
817 WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected),
818 WASM_RETURN1(WASM_ONE)));
819 761
820 FOR_INT16_INPUTS(i) { 762 FOR_INT16_INPUTS(i) {
821 FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } 763 FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
822 } 764 }
823 } 765 }
824 766
825 WASM_EXEC_TEST(I16x8Add) { RunI16x8BinOpTest(kExprI16x8Add, Add); } 767 WASM_EXEC_TEST(I16x8Add) { RunI16x8BinOpTest(kExprI16x8Add, Add); }
826 768
827 WASM_EXEC_TEST(I16x8Sub) { RunI16x8BinOpTest(kExprI16x8Sub, Sub); } 769 WASM_EXEC_TEST(I16x8Sub) { RunI16x8BinOpTest(kExprI16x8Sub, Sub); }
828 770
(...skipping 26 matching lines...) Expand all
855 WASM_EXEC_TEST(Ui16x8LessEqual) { 797 WASM_EXEC_TEST(Ui16x8LessEqual) {
856 RunI16x8BinOpTest(kExprI16x8LeU, UnsignedLessEqual); 798 RunI16x8BinOpTest(kExprI16x8LeU, UnsignedLessEqual);
857 } 799 }
858 800
859 void RunI8x16UnOpTest(WasmOpcode simd_op, Int8UnOp expected_op) { 801 void RunI8x16UnOpTest(WasmOpcode simd_op, Int8UnOp expected_op) {
860 FLAG_wasm_simd_prototype = true; 802 FLAG_wasm_simd_prototype = true;
861 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); 803 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled);
862 byte a = 0; 804 byte a = 0;
863 byte expected = 1; 805 byte expected = 1;
864 byte simd = r.AllocateLocal(kWasmS128); 806 byte simd = r.AllocateLocal(kWasmS128);
865 BUILD(r, WASM_BLOCK( 807 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))),
866 WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), 808 WASM_SET_LOCAL(simd,
867 WASM_SET_LOCAL( 809 WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))),
868 simd, WASM_SIMD_UNOP(simd_op & 0xffu, WASM_GET_LOCAL(simd))), 810 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE);
869 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected),
870 WASM_RETURN1(WASM_ONE)));
871 811
872 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); } 812 FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
873 } 813 }
874 814
875 WASM_EXEC_TEST(I8x16Neg) { RunI8x16UnOpTest(kExprI8x16Neg, Negate); } 815 WASM_EXEC_TEST(I8x16Neg) { RunI8x16UnOpTest(kExprI8x16Neg, Negate); }
876 816
877 void RunI8x16BinOpTest(WasmOpcode simd_op, Int8BinOp expected_op) { 817 void RunI8x16BinOpTest(WasmOpcode simd_op, Int8BinOp expected_op) {
878 FLAG_wasm_simd_prototype = true; 818 FLAG_wasm_simd_prototype = true;
879 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled); 819 WasmRunner<int32_t, int32_t, int32_t, int32_t> r(kExecuteCompiled);
880 byte a = 0; 820 byte a = 0;
881 byte b = 1; 821 byte b = 1;
882 byte expected = 2; 822 byte expected = 2;
883 byte simd0 = r.AllocateLocal(kWasmS128); 823 byte simd0 = r.AllocateLocal(kWasmS128);
884 byte simd1 = r.AllocateLocal(kWasmS128); 824 byte simd1 = r.AllocateLocal(kWasmS128);
885 BUILD(r, WASM_BLOCK( 825 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))),
886 WASM_SET_LOCAL(simd0, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(a))), 826 WASM_SET_LOCAL(simd1, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(b))),
887 WASM_SET_LOCAL(simd1, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(b))), 827 WASM_SET_LOCAL(simd1,
888 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu, 828 WASM_SIMD_BINOP(simd_op & 0xffu, WASM_GET_LOCAL(simd0),
889 WASM_GET_LOCAL(simd0), 829 WASM_GET_LOCAL(simd1))),
890 WASM_GET_LOCAL(simd1))), 830 WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected), WASM_ONE);
891 WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected),
892 WASM_RETURN1(WASM_ONE)));
893 831
894 FOR_INT8_INPUTS(i) { 832 FOR_INT8_INPUTS(i) {
895 FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); } 833 FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
896 } 834 }
897 } 835 }
898 836
899 WASM_EXEC_TEST(I8x16Add) { RunI8x16BinOpTest(kExprI8x16Add, Add); } 837 WASM_EXEC_TEST(I8x16Add) { RunI8x16BinOpTest(kExprI8x16Add, Add); }
900 838
901 WASM_EXEC_TEST(I8x16Sub) { RunI8x16BinOpTest(kExprI8x16Sub, Sub); } 839 WASM_EXEC_TEST(I8x16Sub) { RunI8x16BinOpTest(kExprI8x16Sub, Sub); }
902 840
(...skipping 20 matching lines...) Expand all
923 WASM_EXEC_TEST(Ui8x16GreaterEqual) { 861 WASM_EXEC_TEST(Ui8x16GreaterEqual) {
924 RunI8x16BinOpTest(kExprI8x16GeU, UnsignedGreaterEqual); 862 RunI8x16BinOpTest(kExprI8x16GeU, UnsignedGreaterEqual);
925 } 863 }
926 864
927 WASM_EXEC_TEST(Ui8x16Less) { RunI8x16BinOpTest(kExprI8x16LtU, UnsignedLess); } 865 WASM_EXEC_TEST(Ui8x16Less) { RunI8x16BinOpTest(kExprI8x16LtU, UnsignedLess); }
928 866
929 WASM_EXEC_TEST(Ui8x16LessEqual) { 867 WASM_EXEC_TEST(Ui8x16LessEqual) {
930 RunI8x16BinOpTest(kExprI8x16LeU, UnsignedLessEqual); 868 RunI8x16BinOpTest(kExprI8x16LeU, UnsignedLessEqual);
931 } 869 }
932 #endif // V8_TARGET_ARCH_ARM 870 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « test/cctest/wasm/test-run-wasm.cc ('k') | test/cctest/wasm/test-run-wasm-simd-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698