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 2742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2753 CHECK_TRAP32(r.Call(*i)); | 2753 CHECK_TRAP32(r.Call(*i)); |
2754 } | 2754 } |
2755 } | 2755 } |
2756 } | 2756 } |
2757 | 2757 |
2758 WASM_EXEC_TEST(I32UConvertF32) { | 2758 WASM_EXEC_TEST(I32UConvertF32) { |
2759 WasmRunner<uint32_t> r(execution_mode, MachineType::Float32()); | 2759 WasmRunner<uint32_t> r(execution_mode, MachineType::Float32()); |
2760 BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0))); | 2760 BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0))); |
2761 | 2761 |
2762 FOR_FLOAT32_INPUTS(i) { | 2762 FOR_FLOAT32_INPUTS(i) { |
2763 if (*i < (static_cast<float>(UINT32_MAX) + 1.0) && *i > -1) { | 2763 if (*i < (static_cast<float>(static_cast<uint64_t>(UINT32_MAX) + 1)) && |
| 2764 *i > -1) { |
2764 CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i)); | 2765 CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i)); |
2765 } else { | 2766 } else { |
2766 CHECK_TRAP32(r.Call(*i)); | 2767 CHECK_TRAP32(r.Call(*i)); |
2767 } | 2768 } |
2768 } | 2769 } |
2769 } | 2770 } |
2770 | 2771 |
2771 WASM_EXEC_TEST(I32UConvertF64) { | 2772 WASM_EXEC_TEST(I32UConvertF64) { |
2772 WasmRunner<uint32_t> r(execution_mode, MachineType::Float64()); | 2773 WasmRunner<uint32_t> r(execution_mode, MachineType::Float64()); |
2773 BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0))); | 2774 BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0))); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2841 MachineType::Int32()); | 2842 MachineType::Int32()); |
2842 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); | 2843 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); |
2843 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2844 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
2844 CHECK_EQ(0, r.Call(133, 100)); | 2845 CHECK_EQ(0, r.Call(133, 100)); |
2845 CHECK_EQ(0, r.Call(kMin, -1)); | 2846 CHECK_EQ(0, r.Call(kMin, -1)); |
2846 CHECK_EQ(0, r.Call(0, 1)); | 2847 CHECK_EQ(0, r.Call(0, 1)); |
2847 CHECK_TRAP(r.Call(100, 0)); | 2848 CHECK_TRAP(r.Call(100, 0)); |
2848 CHECK_TRAP(r.Call(-1001, 0)); | 2849 CHECK_TRAP(r.Call(-1001, 0)); |
2849 CHECK_TRAP(r.Call(kMin, 0)); | 2850 CHECK_TRAP(r.Call(kMin, 0)); |
2850 } | 2851 } |
OLD | NEW |