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

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

Issue 2066483008: MIPS: Followup '[turbofan] Introduce new operators Float32SubPreserveNan and Float64SubPreserveNan'. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Comment the iterpreter. 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 qNanValue =
615 bit_cast<uint32_t>(std::numeric_limits<float>::quiet_NaN());
616 uint32_t payload = 0x00200000;
617
618 uint32_t expected = (qNanValue & 0xffc00000) | payload;
619 uint32_t operand = (sNanValue & 0xffc00000) | payload;
620 CHECK_EQ(expected, bit_cast<uint32_t>(r.Call(bit_cast<float>(operand))));
621
622 // Change the sign of the NaN.
623 expected |= 0x80000000;
624 operand |= 0x80000000;
625 CHECK_EQ(expected, bit_cast<uint32_t>(r.Call(bit_cast<float>(operand))));
613 } 626 }
614 627
615 WASM_EXEC_TEST(Float64SubMinusZero) { 628 WASM_EXEC_TEST(Float64SubMinusZero) {
616 WasmRunner<double> r(execution_mode, MachineType::Float64()); 629 WasmRunner<double> r(execution_mode, MachineType::Float64());
617 BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0))); 630 BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0)));
618 631
619 CHECK_EQ(0x7ff8123456789abc, 632 uint64_t sNanValue =
620 bit_cast<uint64_t>(r.Call(bit_cast<double>(0x7ff0123456789abc)))); 633 bit_cast<uint64_t>(std::numeric_limits<double>::signaling_NaN());
634 uint64_t qNanValue =
635 bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN());
636 uint64_t payload = 0x0000123456789abc;
637
638 uint64_t expected = (qNanValue & 0xfff8000000000000) | payload;
639 uint64_t operand = (sNanValue & 0xfff8000000000000) | payload;
640 CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand))));
641
642 // Change the sign of the NaN.
643 expected |= 0x8000000000000000;
644 operand |= 0x8000000000000000;
645 CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand))));
621 } 646 }
622 647
623 WASM_EXEC_TEST(Float64Neg) { 648 WASM_EXEC_TEST(Float64Neg) {
624 WasmRunner<double> r(execution_mode, MachineType::Float64()); 649 WasmRunner<double> r(execution_mode, MachineType::Float64());
625 BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); 650 BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0)));
626 651
627 FOR_FLOAT64_INPUTS(i) { 652 FOR_FLOAT64_INPUTS(i) {
628 CHECK_EQ(0x8000000000000000, 653 CHECK_EQ(0x8000000000000000,
629 bit_cast<uint64_t>(*i) ^ bit_cast<uint64_t>(r.Call(*i))); 654 bit_cast<uint64_t>(*i) ^ bit_cast<uint64_t>(r.Call(*i)));
630 } 655 }
(...skipping 2185 matching lines...) Expand 10 before | Expand all | Expand 10 after
2816 MachineType::Int32()); 2841 MachineType::Int32());
2817 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); 2842 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO);
2818 const int32_t kMin = std::numeric_limits<int32_t>::min(); 2843 const int32_t kMin = std::numeric_limits<int32_t>::min();
2819 CHECK_EQ(0, r.Call(133, 100)); 2844 CHECK_EQ(0, r.Call(133, 100));
2820 CHECK_EQ(0, r.Call(kMin, -1)); 2845 CHECK_EQ(0, r.Call(kMin, -1));
2821 CHECK_EQ(0, r.Call(0, 1)); 2846 CHECK_EQ(0, r.Call(0, 1));
2822 CHECK_TRAP(r.Call(100, 0)); 2847 CHECK_TRAP(r.Call(100, 0));
2823 CHECK_TRAP(r.Call(-1001, 0)); 2848 CHECK_TRAP(r.Call(-1001, 0));
2824 CHECK_TRAP(r.Call(kMin, 0)); 2849 CHECK_TRAP(r.Call(kMin, 0));
2825 } 2850 }
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