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

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

Issue 2780503002: MIPS[64]: Support for some SIMD operations (2) (Closed)
Patch Set: rebased Created 3 years, 8 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 | « src/compiler/mips64/instruction-selector-mips64.cc ('k') | 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/assembler-inl.h" 5 #include "src/assembler-inl.h"
6 #include "src/wasm/wasm-macro-gen.h" 6 #include "src/wasm/wasm-macro-gen.h"
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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 const float kSmallFloatThreshold = 1.0e-32f; 399 const float kSmallFloatThreshold = 1.0e-32f;
400 const float kLargeFloatThreshold = 1.0e32f; 400 const float kLargeFloatThreshold = 1.0e32f;
401 return abs_x != 0.0f && // 0 or -0 are fine. 401 return abs_x != 0.0f && // 0 or -0 are fine.
402 (abs_x < kSmallFloatThreshold || abs_x > kLargeFloatThreshold); 402 (abs_x < kSmallFloatThreshold || abs_x > kLargeFloatThreshold);
403 } 403 }
404 404
405 // Skip tests where the expected value is a NaN, since our WASM test code 405 // Skip tests where the expected value is a NaN, since our WASM test code
406 // doesn't handle NaNs. Also skip extreme values. 406 // doesn't handle NaNs. Also skip extreme values.
407 bool SkipFPExpectedValue(float x) { return std::isnan(x) || SkipFPValue(x); } 407 bool SkipFPExpectedValue(float x) { return std::isnan(x) || SkipFPValue(x); }
408 408
409 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET 409 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \
410 V8_TARGET_ARCH_MIPS64
410 WASM_EXEC_COMPILED_TEST(F32x4Splat) { 411 WASM_EXEC_COMPILED_TEST(F32x4Splat) {
411 FLAG_wasm_simd_prototype = true; 412 FLAG_wasm_simd_prototype = true;
412 413
413 WasmRunner<int32_t, float> r(kExecuteCompiled); 414 WasmRunner<int32_t, float> r(kExecuteCompiled);
414 byte lane_val = 0; 415 byte lane_val = 0;
415 byte simd = r.AllocateLocal(kWasmS128); 416 byte simd = r.AllocateLocal(kWasmS128);
416 BUILD(r, 417 BUILD(r,
417 WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(lane_val))), 418 WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(lane_val))),
418 WASM_SIMD_CHECK_SPLAT_F32x4(simd, lane_val), WASM_RETURN1(WASM_ONE)); 419 WASM_SIMD_CHECK_SPLAT_F32x4(simd, lane_val), WASM_RETURN1(WASM_ONE));
419 420
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 WASM_SIMD_CHECK_SPLAT_F32x4(simd1, expected_signed), 467 WASM_SIMD_CHECK_SPLAT_F32x4(simd1, expected_signed),
467 WASM_SET_LOCAL(simd2, WASM_SIMD_F32x4_FROM_U32x4(WASM_GET_LOCAL(simd0))), 468 WASM_SET_LOCAL(simd2, WASM_SIMD_F32x4_FROM_U32x4(WASM_GET_LOCAL(simd0))),
468 WASM_SIMD_CHECK_SPLAT_F32x4(simd2, expected_unsigned), 469 WASM_SIMD_CHECK_SPLAT_F32x4(simd2, expected_unsigned),
469 WASM_RETURN1(WASM_ONE)); 470 WASM_RETURN1(WASM_ONE));
470 471
471 FOR_INT32_INPUTS(i) { 472 FOR_INT32_INPUTS(i) {
472 CHECK_EQ(1, r.Call(*i, static_cast<float>(*i), 473 CHECK_EQ(1, r.Call(*i, static_cast<float>(*i),
473 static_cast<float>(static_cast<uint32_t>(*i)))); 474 static_cast<float>(static_cast<uint32_t>(*i))));
474 } 475 }
475 } 476 }
477 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS ||
478 // V8_TARGET_ARCH_MIPS64
476 479
480 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
477 void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op, 481 void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op,
478 float error = 0.0f) { 482 float error = 0.0f) {
479 FLAG_wasm_simd_prototype = true; 483 FLAG_wasm_simd_prototype = true;
480 WasmRunner<int32_t, float, float, float> r(kExecuteCompiled); 484 WasmRunner<int32_t, float, float, float> r(kExecuteCompiled);
481 byte a = 0; 485 byte a = 0;
482 byte low = 1; 486 byte low = 1;
483 byte high = 2; 487 byte high = 2;
484 byte simd = r.AllocateLocal(kWasmS128); 488 byte simd = r.AllocateLocal(kWasmS128);
485 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), 489 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))),
486 WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), 490 WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))),
(...skipping 1369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1856 WASM_SIMD_I32x4_EXTRACT_LANE( 1860 WASM_SIMD_I32x4_EXTRACT_LANE(
1857 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); 1861 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO)));
1858 1862
1859 FOR_INT32_INPUTS(i) { 1863 FOR_INT32_INPUTS(i) {
1860 int32_t expected = *i; 1864 int32_t expected = *i;
1861 r.module().WriteMemory(&memory[0], expected); 1865 r.module().WriteMemory(&memory[0], expected);
1862 CHECK_EQ(expected, r.Call()); 1866 CHECK_EQ(expected, r.Call());
1863 } 1867 }
1864 } 1868 }
1865 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET 1869 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET
OLDNEW
« no previous file with comments | « src/compiler/mips64/instruction-selector-mips64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698