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/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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 T Minimum(T a, T b) { | 67 T Minimum(T a, T b) { |
68 return a <= b ? a : b; | 68 return a <= b ? a : b; |
69 } | 69 } |
70 | 70 |
71 template <typename T> | 71 template <typename T> |
72 T Maximum(T a, T b) { | 72 T Maximum(T a, T b) { |
73 return a >= b ? a : b; | 73 return a >= b ? a : b; |
74 } | 74 } |
75 | 75 |
76 // For float operands, Min and Max must return NaN if either operand is NaN. | 76 // For float operands, Min and Max must return NaN if either operand is NaN. |
77 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 77 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ |
| 78 V8_TARGET_ARCH_MIPS64 |
78 template <> | 79 template <> |
79 float Minimum(float a, float b) { | 80 float Minimum(float a, float b) { |
80 if (std::isnan(a) || std::isnan(b)) | 81 if (std::isnan(a) || std::isnan(b)) |
81 return std::numeric_limits<float>::quiet_NaN(); | 82 return std::numeric_limits<float>::quiet_NaN(); |
82 return a <= b ? a : b; | 83 return a <= b ? a : b; |
83 } | 84 } |
84 | 85 |
85 template <> | 86 template <> |
86 float Maximum(float a, float b) { | 87 float Maximum(float a, float b) { |
87 if (std::isnan(a) || std::isnan(b)) | 88 if (std::isnan(a) || std::isnan(b)) |
88 return std::numeric_limits<float>::quiet_NaN(); | 89 return std::numeric_limits<float>::quiet_NaN(); |
89 return a >= b ? a : b; | 90 return a >= b ? a : b; |
90 } | 91 } |
91 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 92 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || |
| 93 // V8_TARGET_ARCH_MIPS64 |
92 | 94 |
93 template <typename T> | 95 template <typename T> |
94 T UnsignedMinimum(T a, T b) { | 96 T UnsignedMinimum(T a, T b) { |
95 using UnsignedT = typename std::make_unsigned<T>::type; | 97 using UnsignedT = typename std::make_unsigned<T>::type; |
96 return static_cast<UnsignedT>(a) <= static_cast<UnsignedT>(b) ? a : b; | 98 return static_cast<UnsignedT>(a) <= static_cast<UnsignedT>(b) ? a : b; |
97 } | 99 } |
98 | 100 |
99 template <typename T> | 101 template <typename T> |
100 T UnsignedMaximum(T a, T b) { | 102 T UnsignedMaximum(T a, T b) { |
101 using UnsignedT = typename std::make_unsigned<T>::type; | 103 using UnsignedT = typename std::make_unsigned<T>::type; |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 WASM_SIMD_CHECK_SPLAT_F32x4(simd1, expected_signed), | 467 WASM_SIMD_CHECK_SPLAT_F32x4(simd1, expected_signed), |
466 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))), |
467 WASM_SIMD_CHECK_SPLAT_F32x4(simd2, expected_unsigned), | 469 WASM_SIMD_CHECK_SPLAT_F32x4(simd2, expected_unsigned), |
468 WASM_RETURN1(WASM_ONE)); | 470 WASM_RETURN1(WASM_ONE)); |
469 | 471 |
470 FOR_INT32_INPUTS(i) { | 472 FOR_INT32_INPUTS(i) { |
471 CHECK_EQ(1, r.Call(*i, static_cast<float>(*i), | 473 CHECK_EQ(1, r.Call(*i, static_cast<float>(*i), |
472 static_cast<float>(static_cast<uint32_t>(*i)))); | 474 static_cast<float>(static_cast<uint32_t>(*i)))); |
473 } | 475 } |
474 } | 476 } |
| 477 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
475 | 478 |
| 479 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ |
| 480 V8_TARGET_ARCH_MIPS64 |
476 void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op, | 481 void RunF32x4UnOpTest(WasmOpcode simd_op, FloatUnOp expected_op, |
477 float error = 0.0f) { | 482 float error = 0.0f) { |
478 FLAG_wasm_simd_prototype = true; | 483 FLAG_wasm_simd_prototype = true; |
479 WasmRunner<int32_t, float, float, float> r(kExecuteCompiled); | 484 WasmRunner<int32_t, float, float, float> r(kExecuteCompiled); |
480 byte a = 0; | 485 byte a = 0; |
481 byte low = 1; | 486 byte low = 1; |
482 byte high = 2; | 487 byte high = 2; |
483 byte simd = r.AllocateLocal(kWasmS128); | 488 byte simd = r.AllocateLocal(kWasmS128); |
484 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))), |
485 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))), |
486 WASM_SIMD_CHECK_SPLAT_F32x4_ESTIMATE(simd, low, high), | 491 WASM_SIMD_CHECK_SPLAT_F32x4_ESTIMATE(simd, low, high), |
487 WASM_RETURN1(WASM_ONE)); | 492 WASM_RETURN1(WASM_ONE)); |
488 | 493 |
489 FOR_FLOAT32_INPUTS(i) { | 494 FOR_FLOAT32_INPUTS(i) { |
490 if (SkipFPValue(*i)) continue; | 495 if (SkipFPValue(*i)) continue; |
491 float expected = expected_op(*i); | 496 float expected = expected_op(*i); |
492 if (SkipFPExpectedValue(expected)) continue; | 497 if (SkipFPExpectedValue(expected)) continue; |
493 float abs_error = std::abs(expected) * error; | 498 float abs_error = std::abs(expected) * error; |
494 CHECK_EQ(1, r.Call(*i, expected - abs_error, expected + abs_error)); | 499 CHECK_EQ(1, r.Call(*i, expected - abs_error, expected + abs_error)); |
495 } | 500 } |
496 } | 501 } |
497 | 502 |
498 WASM_EXEC_COMPILED_TEST(F32x4Abs) { RunF32x4UnOpTest(kExprF32x4Abs, std::abs); } | 503 WASM_EXEC_COMPILED_TEST(F32x4Abs) { RunF32x4UnOpTest(kExprF32x4Abs, std::abs); } |
499 WASM_EXEC_COMPILED_TEST(F32x4Neg) { RunF32x4UnOpTest(kExprF32x4Neg, Negate); } | 504 WASM_EXEC_COMPILED_TEST(F32x4Neg) { RunF32x4UnOpTest(kExprF32x4Neg, Negate); } |
500 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 505 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || |
| 506 // V8_TARGET_ARCH_MIPS64 |
501 | 507 |
502 #if SIMD_LOWERING_TARGET | 508 #if SIMD_LOWERING_TARGET |
503 WASM_EXEC_COMPILED_TEST(F32x4Sqrt) { RunF32x4UnOpTest(kExprF32x4Sqrt, Sqrt); } | 509 WASM_EXEC_COMPILED_TEST(F32x4Sqrt) { RunF32x4UnOpTest(kExprF32x4Sqrt, Sqrt); } |
504 #endif // SIMD_LOWERING_TARGET | 510 #endif // SIMD_LOWERING_TARGET |
505 | 511 |
506 #if V8_TARGET_ARCH_ARM | 512 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
507 static const float kApproxError = 0.01f; | 513 static const float kApproxError = 0.01f; |
508 | 514 |
509 WASM_EXEC_COMPILED_TEST(F32x4RecipApprox) { | 515 WASM_EXEC_COMPILED_TEST(F32x4RecipApprox) { |
510 RunF32x4UnOpTest(kExprF32x4RecipApprox, Recip, kApproxError); | 516 RunF32x4UnOpTest(kExprF32x4RecipApprox, Recip, kApproxError); |
511 } | 517 } |
512 | 518 |
513 WASM_EXEC_COMPILED_TEST(F32x4RecipSqrtApprox) { | 519 WASM_EXEC_COMPILED_TEST(F32x4RecipSqrtApprox) { |
514 RunF32x4UnOpTest(kExprF32x4RecipSqrtApprox, RecipSqrt, kApproxError); | 520 RunF32x4UnOpTest(kExprF32x4RecipSqrtApprox, RecipSqrt, kApproxError); |
515 } | 521 } |
516 #endif // V8_TARGET_ARCH_ARM | 522 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
517 | 523 |
518 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 524 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ |
| 525 V8_TARGET_ARCH_MIPS64 |
519 void RunF32x4BinOpTest(WasmOpcode simd_op, FloatBinOp expected_op) { | 526 void RunF32x4BinOpTest(WasmOpcode simd_op, FloatBinOp expected_op) { |
520 FLAG_wasm_simd_prototype = true; | 527 FLAG_wasm_simd_prototype = true; |
521 WasmRunner<int32_t, float, float, float> r(kExecuteCompiled); | 528 WasmRunner<int32_t, float, float, float> r(kExecuteCompiled); |
522 byte a = 0; | 529 byte a = 0; |
523 byte b = 1; | 530 byte b = 1; |
524 byte expected = 2; | 531 byte expected = 2; |
525 byte simd0 = r.AllocateLocal(kWasmS128); | 532 byte simd0 = r.AllocateLocal(kWasmS128); |
526 byte simd1 = r.AllocateLocal(kWasmS128); | 533 byte simd1 = r.AllocateLocal(kWasmS128); |
527 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), | 534 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), |
528 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), | 535 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), |
(...skipping 14 matching lines...) Expand all Loading... |
543 | 550 |
544 WASM_EXEC_COMPILED_TEST(F32x4Add) { RunF32x4BinOpTest(kExprF32x4Add, Add); } | 551 WASM_EXEC_COMPILED_TEST(F32x4Add) { RunF32x4BinOpTest(kExprF32x4Add, Add); } |
545 WASM_EXEC_COMPILED_TEST(F32x4Sub) { RunF32x4BinOpTest(kExprF32x4Sub, Sub); } | 552 WASM_EXEC_COMPILED_TEST(F32x4Sub) { RunF32x4BinOpTest(kExprF32x4Sub, Sub); } |
546 WASM_EXEC_COMPILED_TEST(F32x4Mul) { RunF32x4BinOpTest(kExprF32x4Mul, Mul); } | 553 WASM_EXEC_COMPILED_TEST(F32x4Mul) { RunF32x4BinOpTest(kExprF32x4Mul, Mul); } |
547 WASM_EXEC_COMPILED_TEST(F32x4_Min) { | 554 WASM_EXEC_COMPILED_TEST(F32x4_Min) { |
548 RunF32x4BinOpTest(kExprF32x4Min, Minimum); | 555 RunF32x4BinOpTest(kExprF32x4Min, Minimum); |
549 } | 556 } |
550 WASM_EXEC_COMPILED_TEST(F32x4_Max) { | 557 WASM_EXEC_COMPILED_TEST(F32x4_Max) { |
551 RunF32x4BinOpTest(kExprF32x4Max, Maximum); | 558 RunF32x4BinOpTest(kExprF32x4Max, Maximum); |
552 } | 559 } |
553 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 560 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || |
| 561 // V8_TARGET_ARCH_MIPS64 |
554 | 562 |
555 #if SIMD_LOWERING_TARGET | 563 #if SIMD_LOWERING_TARGET |
556 WASM_EXEC_COMPILED_TEST(F32x4Div) { RunF32x4BinOpTest(kExprF32x4Div, Div); } | 564 WASM_EXEC_COMPILED_TEST(F32x4Div) { RunF32x4BinOpTest(kExprF32x4Div, Div); } |
557 #endif // SIMD_LOWERING_TARGET | 565 #endif // SIMD_LOWERING_TARGET |
558 | 566 |
559 #if V8_TARGET_ARCH_ARM | 567 #if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
560 WASM_EXEC_COMPILED_TEST(F32x4RecipRefine) { | 568 WASM_EXEC_COMPILED_TEST(F32x4RecipRefine) { |
561 RunF32x4BinOpTest(kExprF32x4RecipRefine, RecipRefine); | 569 RunF32x4BinOpTest(kExprF32x4RecipRefine, RecipRefine); |
562 } | 570 } |
563 | 571 |
564 WASM_EXEC_COMPILED_TEST(F32x4RecipSqrtRefine) { | 572 WASM_EXEC_COMPILED_TEST(F32x4RecipSqrtRefine) { |
565 RunF32x4BinOpTest(kExprF32x4RecipSqrtRefine, RecipSqrtRefine); | 573 RunF32x4BinOpTest(kExprF32x4RecipSqrtRefine, RecipSqrtRefine); |
566 } | 574 } |
567 #endif // V8_TARGET_ARCH_ARM | 575 #endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS || V8_TARGET_ARCH_MIPS64 |
568 | 576 |
569 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 577 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ |
| 578 V8_TARGET_ARCH_MIPS64 |
570 void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) { | 579 void RunF32x4CompareOpTest(WasmOpcode simd_op, FloatCompareOp expected_op) { |
571 FLAG_wasm_simd_prototype = true; | 580 FLAG_wasm_simd_prototype = true; |
572 WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled); | 581 WasmRunner<int32_t, float, float, int32_t> r(kExecuteCompiled); |
573 byte a = 0; | 582 byte a = 0; |
574 byte b = 1; | 583 byte b = 1; |
575 byte expected = 2; | 584 byte expected = 2; |
576 byte simd0 = r.AllocateLocal(kWasmS128); | 585 byte simd0 = r.AllocateLocal(kWasmS128); |
577 byte simd1 = r.AllocateLocal(kWasmS128); | 586 byte simd1 = r.AllocateLocal(kWasmS128); |
578 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), | 587 BUILD(r, WASM_SET_LOCAL(simd0, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(a))), |
579 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), | 588 WASM_SET_LOCAL(simd1, WASM_SIMD_F32x4_SPLAT(WASM_GET_LOCAL(b))), |
(...skipping 26 matching lines...) Expand all Loading... |
606 | 615 |
607 WASM_EXEC_COMPILED_TEST(F32x4Ge) { | 616 WASM_EXEC_COMPILED_TEST(F32x4Ge) { |
608 RunF32x4CompareOpTest(kExprF32x4Ge, GreaterEqual); | 617 RunF32x4CompareOpTest(kExprF32x4Ge, GreaterEqual); |
609 } | 618 } |
610 | 619 |
611 WASM_EXEC_COMPILED_TEST(F32x4Lt) { RunF32x4CompareOpTest(kExprF32x4Lt, Less); } | 620 WASM_EXEC_COMPILED_TEST(F32x4Lt) { RunF32x4CompareOpTest(kExprF32x4Lt, Less); } |
612 | 621 |
613 WASM_EXEC_COMPILED_TEST(F32x4Le) { | 622 WASM_EXEC_COMPILED_TEST(F32x4Le) { |
614 RunF32x4CompareOpTest(kExprF32x4Le, LessEqual); | 623 RunF32x4CompareOpTest(kExprF32x4Le, LessEqual); |
615 } | 624 } |
616 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 625 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || |
| 626 // V8_TARGET_ARCH_MIPS64 |
617 | 627 |
618 WASM_EXEC_COMPILED_TEST(I32x4Splat) { | 628 WASM_EXEC_COMPILED_TEST(I32x4Splat) { |
619 FLAG_wasm_simd_prototype = true; | 629 FLAG_wasm_simd_prototype = true; |
620 | 630 |
621 // Store SIMD value in a local variable, use extract lane to check lane values | 631 // Store SIMD value in a local variable, use extract lane to check lane values |
622 // This test is not a test for ExtractLane as Splat does not create | 632 // This test is not a test for ExtractLane as Splat does not create |
623 // interesting SIMD values. | 633 // interesting SIMD values. |
624 // | 634 // |
625 // SetLocal(1, I32x4Splat(Local(0))); | 635 // SetLocal(1, I32x4Splat(Local(0))); |
626 // For each lane index | 636 // For each lane index |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 new_val, new_val, new_val, new_val, new_val, old_val), | 852 new_val, new_val, new_val, new_val, new_val, old_val), |
843 WASM_SET_LOCAL(simd, | 853 WASM_SET_LOCAL(simd, |
844 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd), | 854 WASM_SIMD_I8x16_REPLACE_LANE(15, WASM_GET_LOCAL(simd), |
845 WASM_GET_LOCAL(new_val))), | 855 WASM_GET_LOCAL(new_val))), |
846 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE); | 856 WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, new_val), WASM_ONE); |
847 | 857 |
848 CHECK_EQ(1, r.Call(1, 2)); | 858 CHECK_EQ(1, r.Call(1, 2)); |
849 } | 859 } |
850 #endif // V8_TARGET_ARCH_ARM | 860 #endif // V8_TARGET_ARCH_ARM |
851 | 861 |
852 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 862 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || \ |
| 863 V8_TARGET_ARCH_MIPS64 |
853 // Determines if conversion from float to int will be valid. | 864 // Determines if conversion from float to int will be valid. |
854 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { | 865 bool CanRoundToZeroAndConvert(double val, bool unsigned_integer) { |
855 const double max_uint = static_cast<double>(0xffffffffu); | 866 const double max_uint = static_cast<double>(0xffffffffu); |
856 const double max_int = static_cast<double>(kMaxInt); | 867 const double max_int = static_cast<double>(kMaxInt); |
857 const double min_int = static_cast<double>(kMinInt); | 868 const double min_int = static_cast<double>(kMinInt); |
858 | 869 |
859 // Check for NaN. | 870 // Check for NaN. |
860 if (val != val) { | 871 if (val != val) { |
861 return false; | 872 return false; |
862 } | 873 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 WASM_SET_LOCAL(simd2, WASM_SIMD_U32x4_FROM_F32x4(WASM_GET_LOCAL(simd0))), | 918 WASM_SET_LOCAL(simd2, WASM_SIMD_U32x4_FROM_F32x4(WASM_GET_LOCAL(simd0))), |
908 WASM_SIMD_CHECK_SPLAT4(I32x4, simd2, I32, expected_unsigned), WASM_ONE); | 919 WASM_SIMD_CHECK_SPLAT4(I32x4, simd2, I32, expected_unsigned), WASM_ONE); |
909 | 920 |
910 FOR_FLOAT32_INPUTS(i) { | 921 FOR_FLOAT32_INPUTS(i) { |
911 if (SkipFPValue(*i)) continue; | 922 if (SkipFPValue(*i)) continue; |
912 int32_t signed_value = ConvertToInt(*i, false); | 923 int32_t signed_value = ConvertToInt(*i, false); |
913 int32_t unsigned_value = ConvertToInt(*i, true); | 924 int32_t unsigned_value = ConvertToInt(*i, true); |
914 CHECK_EQ(1, r.Call(*i, signed_value, unsigned_value)); | 925 CHECK_EQ(1, r.Call(*i, signed_value, unsigned_value)); |
915 } | 926 } |
916 } | 927 } |
| 928 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET || V8_TARGET_ARCH_MIPS || |
| 929 // V8_TARGET_ARCH_MIPS64 |
917 | 930 |
| 931 #if V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
918 void RunI32x4UnOpTest(WasmOpcode simd_op, Int32UnOp expected_op) { | 932 void RunI32x4UnOpTest(WasmOpcode simd_op, Int32UnOp expected_op) { |
919 FLAG_wasm_simd_prototype = true; | 933 FLAG_wasm_simd_prototype = true; |
920 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); | 934 WasmRunner<int32_t, int32_t, int32_t> r(kExecuteCompiled); |
921 byte a = 0; | 935 byte a = 0; |
922 byte expected = 1; | 936 byte expected = 1; |
923 byte simd = r.AllocateLocal(kWasmS128); | 937 byte simd = r.AllocateLocal(kWasmS128); |
924 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), | 938 BUILD(r, WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(a))), |
925 WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), | 939 WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))), |
926 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE); | 940 WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE); |
927 | 941 |
(...skipping 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 WASM_SIMD_I32x4_EXTRACT_LANE( | 1869 WASM_SIMD_I32x4_EXTRACT_LANE( |
1856 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); | 1870 0, WASM_LOAD_MEM(MachineType::Simd128(), WASM_ZERO))); |
1857 | 1871 |
1858 FOR_INT32_INPUTS(i) { | 1872 FOR_INT32_INPUTS(i) { |
1859 int32_t expected = *i; | 1873 int32_t expected = *i; |
1860 r.module().WriteMemory(&memory[0], expected); | 1874 r.module().WriteMemory(&memory[0], expected); |
1861 CHECK_EQ(expected, r.Call()); | 1875 CHECK_EQ(expected, r.Call()); |
1862 } | 1876 } |
1863 } | 1877 } |
1864 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET | 1878 #endif // V8_TARGET_ARCH_ARM || SIMD_LOWERING_TARGET |
OLD | NEW |