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

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

Issue 2019693002: MIPS: Fix '[turbofan] Introduce new operators Float32SubPreserveNan and Float64SubPreserveNan'. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix instruction selector mips64. Created 4 years, 6 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/wasm/wasm-interpreter.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "src/base/platform/elapsed-timer.h" 9 #include "src/base/platform/elapsed-timer.h"
10 10
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 FOR_FLOAT32_INPUTS(i) { 602 FOR_FLOAT32_INPUTS(i) {
603 CHECK_EQ(0x80000000, 603 CHECK_EQ(0x80000000,
604 bit_cast<uint32_t>(*i) ^ bit_cast<uint32_t>(r.Call(*i))); 604 bit_cast<uint32_t>(*i) ^ bit_cast<uint32_t>(r.Call(*i)));
605 } 605 }
606 } 606 }
607 607
608 WASM_EXEC_TEST(Float32SubMinusZero) { 608 WASM_EXEC_TEST(Float32SubMinusZero) {
609 WasmRunner<float> r(execution_mode, MachineType::Float32()); 609 WasmRunner<float> r(execution_mode, MachineType::Float32());
610 BUILD(r, WASM_F32_SUB(WASM_F32(-0.0), WASM_GET_LOCAL(0))); 610 BUILD(r, WASM_F32_SUB(WASM_F32(-0.0), WASM_GET_LOCAL(0)));
611 611
612 CHECK_EQ(0x7fe00000, bit_cast<uint32_t>(r.Call(bit_cast<float>(0x7fa00000)))); 612 uint32_t sNanValue =
613 bit_cast<uint32_t>(std::numeric_limits<float>::signaling_NaN());
614 uint32_t payload = 0x00200000;
615
616 static const uint32_t kSignalingBit = 1 << 22;
617 uint32_t qNanValue =
618 bit_cast<uint32_t>(std::numeric_limits<float>::quiet_NaN());
619 if ((qNanValue & kSignalingBit) != 0) {
620 // On some machines, the signaling bit set indicates it's a quiet NaN.
621 qNanValue = sNanValue | kSignalingBit;
622 } else {
623 // On others, the signaling bit set indicates it's a signaling NaN.
624 qNanValue = qNanValue & ~kSignalingBit;
625 }
626 uint32_t expected = qNanValue | payload;
627 uint32_t operand = sNanValue | payload;
628 CHECK_EQ(expected, bit_cast<uint32_t>(r.Call(bit_cast<float>(operand))));
613 } 629 }
614 630
615 WASM_EXEC_TEST(Float64SubMinusZero) { 631 WASM_EXEC_TEST(Float64SubMinusZero) {
616 WasmRunner<double> r(execution_mode, MachineType::Float64()); 632 WasmRunner<double> r(execution_mode, MachineType::Float64());
617 BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0))); 633 BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0)));
618 634
619 CHECK_EQ(0x7ff8123456789abc, 635 uint64_t sNanValue =
620 bit_cast<uint64_t>(r.Call(bit_cast<double>(0x7ff0123456789abc)))); 636 bit_cast<uint64_t>(std::numeric_limits<double>::signaling_NaN());
637 uint64_t payload = 0x0000123456789abc;
638
639 static const uint64_t kSignalingBit = 1ULL << 51;
640 uint64_t qNanValue =
641 bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN());
642 if ((qNanValue & kSignalingBit) != 0) {
643 // On some machines, the signaling bit set indicates it's a quiet NaN.
644 qNanValue = sNanValue | kSignalingBit;
645 } else {
646 // On others, the signaling bit set indicates it's a signaling NaN.
647 qNanValue = qNanValue & ~kSignalingBit;
648 }
649 uint64_t expected = qNanValue | payload;
650 uint64_t operand = sNanValue | payload;
651 CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand))));
621 } 652 }
622 653
623 WASM_EXEC_TEST(Float64Neg) { 654 WASM_EXEC_TEST(Float64Neg) {
624 WasmRunner<double> r(execution_mode, MachineType::Float64()); 655 WasmRunner<double> r(execution_mode, MachineType::Float64());
625 BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); 656 BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0)));
626 657
627 FOR_FLOAT64_INPUTS(i) { 658 FOR_FLOAT64_INPUTS(i) {
628 CHECK_EQ(0x8000000000000000, 659 CHECK_EQ(0x8000000000000000,
629 bit_cast<uint64_t>(*i) ^ bit_cast<uint64_t>(r.Call(*i))); 660 bit_cast<uint64_t>(*i) ^ bit_cast<uint64_t>(r.Call(*i)));
630 } 661 }
(...skipping 2202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 MachineType::Int32()); 2864 MachineType::Int32());
2834 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); 2865 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO);
2835 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2866 const int32_t kMin = std::numeric_limits<int32_t>::min();
2836 CHECK_EQ(0, r.Call(133, 100)); 2867 CHECK_EQ(0, r.Call(133, 100));
2837 CHECK_EQ(0, r.Call(kMin, -1)); 2868 CHECK_EQ(0, r.Call(kMin, -1));
2838 CHECK_EQ(0, r.Call(0, 1)); 2869 CHECK_EQ(0, r.Call(0, 1));
2839 CHECK_TRAP(r.Call(100, 0)); 2870 CHECK_TRAP(r.Call(100, 0));
2840 CHECK_TRAP(r.Call(-1001, 0)); 2871 CHECK_TRAP(r.Call(-1001, 0));
2841 CHECK_TRAP(r.Call(kMin, 0)); 2872 CHECK_TRAP(r.Call(kMin, 0));
2842 } 2873 }
OLDNEW
« no previous file with comments | « src/wasm/wasm-interpreter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698