| 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 3150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3161 WasmRunner<double> r; | 3161 WasmRunner<double> r; |
| 3162 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), | 3162 BUILD(r, WASM_F64_MAX(WASM_F64(45.73), |
| 3163 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); | 3163 WASM_F64(bit_cast<double>(0x7ff000000000f1e2)))); |
| 3164 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); | 3164 CHECK_EQ(0x7ff800000000f1e2, bit_cast<uint64_t>(r.Call())); |
| 3165 } | 3165 } |
| 3166 } | 3166 } |
| 3167 | 3167 |
| 3168 #endif | 3168 #endif |
| 3169 | 3169 |
| 3170 #if WASM_64 | 3170 #if WASM_64 |
| 3171 TEST(Run_Wasm_F32SConvertI64) { | |
| 3172 WasmRunner<float> r(MachineType::Int64()); | |
| 3173 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3174 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | |
| 3175 } | |
| 3176 | |
| 3177 | |
| 3178 #if !defined(_WIN64) | |
| 3179 // TODO(ahaas): Fix this failure. | |
| 3180 TEST(Run_Wasm_F32UConvertI64) { | |
| 3181 WasmRunner<float> r(MachineType::Uint64()); | |
| 3182 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3183 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | |
| 3184 } | |
| 3185 #endif | |
| 3186 | |
| 3187 | |
| 3188 TEST(Run_Wasm_F64SConvertI64) { | |
| 3189 WasmRunner<double> r(MachineType::Int64()); | |
| 3190 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3191 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | |
| 3192 } | |
| 3193 | |
| 3194 | |
| 3195 #if !defined(_WIN64) | |
| 3196 // TODO(ahaas): Fix this failure. | |
| 3197 TEST(Run_Wasm_F64UConvertI64) { | |
| 3198 WasmRunner<double> r(MachineType::Uint64()); | |
| 3199 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); | |
| 3200 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | |
| 3201 } | |
| 3202 #endif | |
| 3203 | |
| 3204 | 3171 |
| 3205 TEST(Run_Wasm_I64SConvertF32) { | 3172 TEST(Run_Wasm_I64SConvertF32) { |
| 3206 WasmRunner<int64_t> r(MachineType::Float32()); | 3173 WasmRunner<int64_t> r(MachineType::Float32()); |
| 3207 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); | 3174 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); |
| 3208 | 3175 |
| 3209 FOR_FLOAT32_INPUTS(i) { | 3176 FOR_FLOAT32_INPUTS(i) { |
| 3210 if (*i < static_cast<float>(INT64_MAX) && | 3177 if (*i < static_cast<float>(INT64_MAX) && |
| 3211 *i >= static_cast<float>(INT64_MIN)) { | 3178 *i >= static_cast<float>(INT64_MIN)) { |
| 3212 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | 3179 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); |
| 3213 } else { | 3180 } else { |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3382 | 3349 |
| 3383 #if WASM_64 | 3350 #if WASM_64 |
| 3384 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3351 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
| 3385 #endif | 3352 #endif |
| 3386 | 3353 |
| 3387 | 3354 |
| 3388 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3355 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
| 3389 | 3356 |
| 3390 | 3357 |
| 3391 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3358 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
| OLD | NEW |