| OLD | NEW |
| 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 Loading... |
| 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)))); |
| 613 } | 621 } |
| 614 | 622 |
| 615 WASM_EXEC_TEST(Float64SubMinusZero) { | 623 WASM_EXEC_TEST(Float64SubMinusZero) { |
| 616 WasmRunner<double> r(execution_mode, MachineType::Float64()); | 624 WasmRunner<double> r(execution_mode, MachineType::Float64()); |
| 617 BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0))); | 625 BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0))); |
| 618 | 626 |
| 619 CHECK_EQ(0x7ff8123456789abc, | 627 uint64_t sNanValue = |
| 620 bit_cast<uint64_t>(r.Call(bit_cast<double>(0x7ff0123456789abc)))); | 628 bit_cast<uint64_t>(std::numeric_limits<double>::signaling_NaN()); |
| 629 uint64_t qNanValue = |
| 630 bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN()); |
| 631 uint64_t payload = 0x0000123456789abc; |
| 632 |
| 633 uint64_t expected = (qNanValue & 0xfff8000000000000) | payload; |
| 634 uint64_t operand = (sNanValue & 0xfff8000000000000) | payload; |
| 635 CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand)))); |
| 621 } | 636 } |
| 622 | 637 |
| 623 WASM_EXEC_TEST(Float64Neg) { | 638 WASM_EXEC_TEST(Float64Neg) { |
| 624 WasmRunner<double> r(execution_mode, MachineType::Float64()); | 639 WasmRunner<double> r(execution_mode, MachineType::Float64()); |
| 625 BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); | 640 BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); |
| 626 | 641 |
| 627 FOR_FLOAT64_INPUTS(i) { | 642 FOR_FLOAT64_INPUTS(i) { |
| 628 CHECK_EQ(0x8000000000000000, | 643 CHECK_EQ(0x8000000000000000, |
| 629 bit_cast<uint64_t>(*i) ^ bit_cast<uint64_t>(r.Call(*i))); | 644 bit_cast<uint64_t>(*i) ^ bit_cast<uint64_t>(r.Call(*i))); |
| 630 } | 645 } |
| (...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2814 MachineType::Int32()); | 2829 MachineType::Int32()); |
| 2815 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); | 2830 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); |
| 2816 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2831 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
| 2817 CHECK_EQ(0, r.Call(133, 100)); | 2832 CHECK_EQ(0, r.Call(133, 100)); |
| 2818 CHECK_EQ(0, r.Call(kMin, -1)); | 2833 CHECK_EQ(0, r.Call(kMin, -1)); |
| 2819 CHECK_EQ(0, r.Call(0, 1)); | 2834 CHECK_EQ(0, r.Call(0, 1)); |
| 2820 CHECK_TRAP(r.Call(100, 0)); | 2835 CHECK_TRAP(r.Call(100, 0)); |
| 2821 CHECK_TRAP(r.Call(-1001, 0)); | 2836 CHECK_TRAP(r.Call(-1001, 0)); |
| 2822 CHECK_TRAP(r.Call(kMin, 0)); | 2837 CHECK_TRAP(r.Call(kMin, 0)); |
| 2823 } | 2838 } |
| OLD | NEW |