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

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

Issue 2598583002: [WASM] Skip SIMD test values that may result in denormalized numbers. (Closed)
Patch Set: 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 | « no previous file | no next file » | 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu, 229 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu,
230 WASM_GET_LOCAL(simd0), 230 WASM_GET_LOCAL(simd0),
231 WASM_GET_LOCAL(simd1))), 231 WASM_GET_LOCAL(simd1))),
232 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd1, expected), 232 WASM_SIMD_CHECK_SPLAT4_F32(F32x4, simd1, expected),
233 WASM_RETURN1(WASM_ONE))); 233 WASM_RETURN1(WASM_ONE)));
234 234
235 FOR_FLOAT32_INPUTS(i) { 235 FOR_FLOAT32_INPUTS(i) {
236 if (std::isnan(*i)) continue; 236 if (std::isnan(*i)) continue;
237 FOR_FLOAT32_INPUTS(j) { 237 FOR_FLOAT32_INPUTS(j) {
238 if (std::isnan(*j)) continue; 238 if (std::isnan(*j)) continue;
239 CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); 239 float expected = expected_op(*i, *j);
titzer 2016/12/21 10:19:08 IIUC, arm does flush-to-zero for sub-normal number
bbudge 2016/12/21 15:03:39 Done.
240 // SIMD on some platforms may handle denormalized numbers differently.
241 if (std::fpclassify(expected) == FP_SUBNORMAL) continue;
242 CHECK_EQ(1, r.Call(*i, *j, expected));
240 } 243 }
241 } 244 }
242 } 245 }
243 246
244 WASM_EXEC_TEST(F32x4Add) { RunF32x4BinOpTest(kExprF32x4Add, Add); } 247 WASM_EXEC_TEST(F32x4Add) { RunF32x4BinOpTest(kExprF32x4Add, Add); }
245 WASM_EXEC_TEST(F32x4Sub) { RunF32x4BinOpTest(kExprF32x4Sub, Sub); } 248 WASM_EXEC_TEST(F32x4Sub) { RunF32x4BinOpTest(kExprF32x4Sub, Sub); }
246 249
247 void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) { 250 void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) {
248 FLAG_wasm_simd_prototype = true; 251 FLAG_wasm_simd_prototype = true;
249 WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled); 252 WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled);
250 byte a = 0; 253 byte a = 0;
251 byte b = 1; 254 byte b = 1;
252 byte expected = 2; 255 byte expected = 2;
253 byte simd0 = r.AllocateLocal(kAstS128); 256 byte simd0 = r.AllocateLocal(kAstS128);
254 byte simd1 = r.AllocateLocal(kAstS128); 257 byte simd1 = r.AllocateLocal(kAstS128);
255 BUILD(r, WASM_BLOCK( 258 BUILD(r, WASM_BLOCK(
256 WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), 259 WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))),
257 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), 260 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))),
258 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu, 261 WASM_SET_LOCAL(simd1, WASM_SIMD_BINOP(simd_op & 0xffu,
259 WASM_GET_LOCAL(simd0), 262 WASM_GET_LOCAL(simd0),
260 WASM_GET_LOCAL(simd1))), 263 WASM_GET_LOCAL(simd1))),
261 WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), 264 WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected),
262 WASM_RETURN1(WASM_ONE))); 265 WASM_RETURN1(WASM_ONE)));
263 266
264 FOR_FLOAT32_INPUTS(i) { 267 FOR_FLOAT32_INPUTS(i) {
265 if (std::isnan(*i)) continue; 268 if (std::isnan(*i)) continue;
266 FOR_FLOAT32_INPUTS(j) { 269 FOR_FLOAT32_INPUTS(j) {
267 if (std::isnan(*j)) continue; 270 if (std::isnan(*j)) continue;
271 // SIMD on some platforms may handle denormalized numbers differently.
272 // Check for number pairs that are very close together.
273 if (std::fpclassify(*i - *j) == FP_SUBNORMAL) continue;
268 CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); 274 CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j)));
269 } 275 }
270 } 276 }
271 } 277 }
272 278
273 WASM_EXEC_TEST(F32x4Equal) { RunF32x4CompareOpTest(kExprF32x4Eq, Equal); } 279 WASM_EXEC_TEST(F32x4Equal) { RunF32x4CompareOpTest(kExprF32x4Eq, Equal); }
274 WASM_EXEC_TEST(F32x4NotEqual) { RunF32x4CompareOpTest(kExprF32x4Ne, NotEqual); } 280 WASM_EXEC_TEST(F32x4NotEqual) { RunF32x4CompareOpTest(kExprF32x4Ne, NotEqual); }
275 #endif // V8_TARGET_ARCH_ARM 281 #endif // V8_TARGET_ARCH_ARM
276 282
277 WASM_EXEC_TEST(I32x4Splat) { 283 WASM_EXEC_TEST(I32x4Splat) {
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 431
426 WASM_EXEC_TEST(I32x4Add) { RunI32x4BinOpTest(kExprI32x4Add, Add); } 432 WASM_EXEC_TEST(I32x4Add) { RunI32x4BinOpTest(kExprI32x4Add, Add); }
427 433
428 WASM_EXEC_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); } 434 WASM_EXEC_TEST(I32x4Sub) { RunI32x4BinOpTest(kExprI32x4Sub, Sub); }
429 435
430 #if V8_TARGET_ARCH_ARM 436 #if V8_TARGET_ARCH_ARM
431 WASM_EXEC_TEST(I32x4Equal) { RunI32x4BinOpTest(kExprI32x4Eq, Equal); } 437 WASM_EXEC_TEST(I32x4Equal) { RunI32x4BinOpTest(kExprI32x4Eq, Equal); }
432 438
433 WASM_EXEC_TEST(I32x4NotEqual) { RunI32x4BinOpTest(kExprI32x4Ne, NotEqual); } 439 WASM_EXEC_TEST(I32x4NotEqual) { RunI32x4BinOpTest(kExprI32x4Ne, NotEqual); }
434 #endif // V8_TARGET_ARCH_ARM 440 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698