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/wasm/wasm-macro-gen.h" | 9 #include "src/wasm/wasm-macro-gen.h" |
10 | 10 |
(...skipping 2915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2926 CHECK_EQ(1, r.Call(1, 0, 2)); | 2926 CHECK_EQ(1, r.Call(1, 0, 2)); |
2927 CHECK_EQ(1, r.Call(1, 0, 9)); | 2927 CHECK_EQ(1, r.Call(1, 0, 9)); |
2928 | 2928 |
2929 CHECK_TRAP(r.Call(0, 2, 1)); | 2929 CHECK_TRAP(r.Call(0, 2, 1)); |
2930 CHECK_TRAP(r.Call(1, 2, 0)); | 2930 CHECK_TRAP(r.Call(1, 2, 0)); |
2931 CHECK_TRAP(r.Call(2, 0, 1)); | 2931 CHECK_TRAP(r.Call(2, 0, 1)); |
2932 CHECK_TRAP(r.Call(2, 1, 0)); | 2932 CHECK_TRAP(r.Call(2, 1, 0)); |
2933 } | 2933 } |
2934 | 2934 |
2935 | 2935 |
| 2936 TEST(Run_Wasm_F32Trunc) { |
| 2937 WasmRunner<float> r(MachineType::Float32()); |
| 2938 BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0))); |
| 2939 |
| 2940 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(trunc(*i), r.Call(*i)); } |
| 2941 } |
| 2942 |
| 2943 |
2936 // TODO(titzer): Fix for nosee4 and re-enable. | 2944 // TODO(titzer): Fix for nosee4 and re-enable. |
2937 #if 0 | 2945 #if 0 |
2938 | 2946 |
2939 TEST(Run_Wasm_F32Floor) { | 2947 TEST(Run_Wasm_F32Floor) { |
2940 WasmRunner<float> r(MachineType::Float32()); | 2948 WasmRunner<float> r(MachineType::Float32()); |
2941 BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0))); | 2949 BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0))); |
2942 | 2950 |
2943 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(floor(*i), r.Call(*i)); } | 2951 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(floor(*i), r.Call(*i)); } |
2944 } | 2952 } |
2945 | 2953 |
2946 | 2954 |
2947 TEST(Run_Wasm_F32Ceil) { | 2955 TEST(Run_Wasm_F32Ceil) { |
2948 WasmRunner<float> r(MachineType::Float32()); | 2956 WasmRunner<float> r(MachineType::Float32()); |
2949 BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0))); | 2957 BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0))); |
2950 | 2958 |
2951 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(ceil(*i), r.Call(*i)); } | 2959 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(ceil(*i), r.Call(*i)); } |
2952 } | 2960 } |
2953 | 2961 |
2954 | 2962 |
2955 TEST(Run_Wasm_F32Trunc) { | |
2956 WasmRunner<float> r(MachineType::Float32()); | |
2957 BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0))); | |
2958 | |
2959 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(trunc(*i), r.Call(*i)); } | |
2960 } | |
2961 | |
2962 | |
2963 TEST(Run_Wasm_F32NearestInt) { | 2963 TEST(Run_Wasm_F32NearestInt) { |
2964 WasmRunner<float> r(MachineType::Float32()); | 2964 WasmRunner<float> r(MachineType::Float32()); |
2965 BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0))); | 2965 BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0))); |
2966 | 2966 |
2967 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(nearbyint(*i), r.Call(*i)); } | 2967 FOR_FLOAT32_INPUTS(i) { CheckFloatEq(nearbyint(*i), r.Call(*i)); } |
2968 } | 2968 } |
2969 | 2969 |
2970 | 2970 |
2971 TEST(Run_Wasm_F64Floor) { | 2971 TEST(Run_Wasm_F64Floor) { |
2972 WasmRunner<double> r(MachineType::Float64()); | 2972 WasmRunner<double> r(MachineType::Float64()); |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 TEST(Run_Wasm_F32CopySign) { | 3269 TEST(Run_Wasm_F32CopySign) { |
3270 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); | 3270 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); |
3271 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 3271 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
3272 | 3272 |
3273 FOR_FLOAT32_INPUTS(i) { | 3273 FOR_FLOAT32_INPUTS(i) { |
3274 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } | 3274 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } |
3275 } | 3275 } |
3276 } | 3276 } |
3277 | 3277 |
3278 #endif | 3278 #endif |
OLD | NEW |