| 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 3158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3169 WasmRunner<double> r; | 3169 WasmRunner<double> r; |
| 3170 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), | 3170 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), |
| 3171 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); | 3171 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); |
| 3172 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); | 3172 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); |
| 3173 } | 3173 } |
| 3174 } | 3174 } |
| 3175 | 3175 |
| 3176 #endif | 3176 #endif |
| 3177 | 3177 |
| 3178 #if WASM_64 | 3178 #if WASM_64 |
| 3179 TEST(Run_Wasm_F32SConvertI64) { | |
| 3180 WasmRunner<float> r(MachineType::Int64()); | |
| 3181 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3182 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | |
| 3183 } | |
| 3184 | |
| 3185 | |
| 3186 #if !defined(_WIN64) | |
| 3187 // TODO(ahaas): Fix this failure. | |
| 3188 TEST(Run_Wasm_F32UConvertI64) { | |
| 3189 WasmRunner<float> r(MachineType::Uint64()); | |
| 3190 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3191 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | |
| 3192 } | |
| 3193 #endif | |
| 3194 | |
| 3195 | |
| 3196 TEST(Run_Wasm_F64SConvertI64) { | |
| 3197 WasmRunner<double> r(MachineType::Int64()); | |
| 3198 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3199 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | |
| 3200 } | |
| 3201 | |
| 3202 | |
| 3203 #if !defined(_WIN64) | |
| 3204 // TODO(ahaas): Fix this failure. | |
| 3205 TEST(Run_Wasm_F64UConvertI64) { | |
| 3206 WasmRunner<double> r(MachineType::Uint64()); | |
| 3207 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3208 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | |
| 3209 } | |
| 3210 #endif | |
| 3211 | |
| 3212 | |
| 3213 TEST(Run_Wasm_I64SConvertF32) { | 3179 TEST(Run_Wasm_I64SConvertF32) { |
| 3214 WasmRunner<int64_t> r(MachineType::Float32()); | 3180 WasmRunner<int64_t> r(MachineType::Float32()); |
| 3215 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); | 3181 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); |
| 3216 | 3182 |
| 3217 FOR_FLOAT32_INPUTS(i) { | 3183 FOR_FLOAT32_INPUTS(i) { |
| 3218 if (*i < static_cast<float>(INT64_MAX) && | 3184 if (*i < static_cast<float>(INT64_MAX) && |
| 3219 *i >= static_cast<float>(INT64_MIN)) { | 3185 *i >= static_cast<float>(INT64_MIN)) { |
| 3220 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | 3186 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); |
| 3221 } else { | 3187 } else { |
| 3222 CHECK_TRAP64(r.Call(*i)); | 3188 CHECK_TRAP64(r.Call(*i)); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3390 | 3356 |
| 3391 #if WASM_64 | 3357 #if WASM_64 |
| 3392 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3358 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
| 3393 #endif | 3359 #endif |
| 3394 | 3360 |
| 3395 | 3361 |
| 3396 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3362 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
| 3397 | 3363 |
| 3398 | 3364 |
| 3399 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3365 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
| OLD | NEW |