| 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 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3123 WasmRunner<double> r; | 3123 WasmRunner<double> r; |
| 3124 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), | 3124 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), |
| 3125 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); | 3125 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); |
| 3126 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); | 3126 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); |
| 3127 } | 3127 } |
| 3128 } | 3128 } |
| 3129 | 3129 |
| 3130 #endif | 3130 #endif |
| 3131 | 3131 |
| 3132 #if WASM_64 | 3132 #if WASM_64 |
| 3133 TEST(Run_Wasm_F32SConvertI64) { | |
| 3134 WasmRunner<float> r(MachineType::Int64()); | |
| 3135 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3136 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | |
| 3137 } | |
| 3138 | |
| 3139 | |
| 3140 #if !defined(_WIN64) | |
| 3141 // TODO(ahaas): Fix this failure. | |
| 3142 TEST(Run_Wasm_F32UConvertI64) { | |
| 3143 WasmRunner<float> r(MachineType::Uint64()); | |
| 3144 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3145 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | |
| 3146 } | |
| 3147 #endif | |
| 3148 | |
| 3149 | |
| 3150 TEST(Run_Wasm_F64SConvertI64) { | |
| 3151 WasmRunner<double> r(MachineType::Int64()); | |
| 3152 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3153 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | |
| 3154 } | |
| 3155 | |
| 3156 | |
| 3157 #if !defined(_WIN64) | |
| 3158 // TODO(ahaas): Fix this failure. | |
| 3159 TEST(Run_Wasm_F64UConvertI64) { | |
| 3160 WasmRunner<double> r(MachineType::Uint64()); | |
| 3161 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3162 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | |
| 3163 } | |
| 3164 #endif | |
| 3165 | |
| 3166 | |
| 3167 TEST(Run_Wasm_I64SConvertF32) { | 3133 TEST(Run_Wasm_I64SConvertF32) { |
| 3168 WasmRunner<int64_t> r(MachineType::Float32()); | 3134 WasmRunner<int64_t> r(MachineType::Float32()); |
| 3169 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); | 3135 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); |
| 3170 | 3136 |
| 3171 FOR_FLOAT32_INPUTS(i) { | 3137 FOR_FLOAT32_INPUTS(i) { |
| 3172 if (*i < static_cast<float>(INT64_MAX) && | 3138 if (*i < static_cast<float>(INT64_MAX) && |
| 3173 *i >= static_cast<float>(INT64_MIN)) { | 3139 *i >= static_cast<float>(INT64_MIN)) { |
| 3174 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | 3140 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); |
| 3175 } else { | 3141 } else { |
| 3176 CHECK_TRAP64(r.Call(*i)); | 3142 CHECK_TRAP64(r.Call(*i)); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3344 | 3310 |
| 3345 #if WASM_64 | 3311 #if WASM_64 |
| 3346 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3312 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
| 3347 #endif | 3313 #endif |
| 3348 | 3314 |
| 3349 | 3315 |
| 3350 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3316 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
| 3351 | 3317 |
| 3352 | 3318 |
| 3353 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3319 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
| OLD | NEW |