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 #include "src/utils.h" | 10 #include "src/utils.h" |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 double expect = *i; | 820 double expect = *i; |
821 double result = r.Call(expect); | 821 double result = r.Call(expect); |
822 if (std::isnan(expect)) { | 822 if (std::isnan(expect)) { |
823 CHECK(std::isnan(result)); | 823 CHECK(std::isnan(result)); |
824 } else { | 824 } else { |
825 CHECK_EQ(expect, result); | 825 CHECK_EQ(expect, result); |
826 } | 826 } |
827 } | 827 } |
828 } | 828 } |
829 | 829 |
| 830 WASM_EXEC_TEST(Select_float_parameters) { |
| 831 WasmRunner<float> r(execution_mode, MachineType::Float32(), |
| 832 MachineType::Float32(), MachineType::Int32()); |
| 833 // return select(11, 22, a); |
| 834 BUILD(r, |
| 835 WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))); |
| 836 CHECK_FLOAT_EQ(2.0f, r.Call(2.0f, 1.0f, 1)); |
| 837 } |
| 838 |
830 WASM_EXEC_TEST(Select) { | 839 WASM_EXEC_TEST(Select) { |
831 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); | 840 WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); |
832 // return select(11, 22, a); | 841 // return select(11, 22, a); |
833 BUILD(r, WASM_SELECT(WASM_I8(11), WASM_I8(22), WASM_GET_LOCAL(0))); | 842 BUILD(r, WASM_SELECT(WASM_I8(11), WASM_I8(22), WASM_GET_LOCAL(0))); |
834 FOR_INT32_INPUTS(i) { | 843 FOR_INT32_INPUTS(i) { |
835 int32_t expected = *i ? 11 : 22; | 844 int32_t expected = *i ? 11 : 22; |
836 CHECK_EQ(expected, r.Call(*i)); | 845 CHECK_EQ(expected, r.Call(*i)); |
837 } | 846 } |
838 } | 847 } |
839 | 848 |
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2975 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, | 2984 BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP, |
2976 WASM_ZERO); | 2985 WASM_ZERO); |
2977 const int32_t kMin = std::numeric_limits<int32_t>::min(); | 2986 const int32_t kMin = std::numeric_limits<int32_t>::min(); |
2978 CHECK_EQ(0, r.Call(133, 100)); | 2987 CHECK_EQ(0, r.Call(133, 100)); |
2979 CHECK_EQ(0, r.Call(kMin, -1)); | 2988 CHECK_EQ(0, r.Call(kMin, -1)); |
2980 CHECK_EQ(0, r.Call(0, 1)); | 2989 CHECK_EQ(0, r.Call(0, 1)); |
2981 CHECK_TRAP(r.Call(100, 0)); | 2990 CHECK_TRAP(r.Call(100, 0)); |
2982 CHECK_TRAP(r.Call(-1001, 0)); | 2991 CHECK_TRAP(r.Call(-1001, 0)); |
2983 CHECK_TRAP(r.Call(kMin, 0)); | 2992 CHECK_TRAP(r.Call(kMin, 0)); |
2984 } | 2993 } |
OLD | NEW |