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 <stdlib.h> | 5 #include <stdlib.h> |
6 #include <string.h> | 6 #include <string.h> |
7 | 7 |
8 #include "src/compiler/graph-visualizer.h" | 8 #include "src/compiler/graph-visualizer.h" |
9 #include "src/compiler/js-graph.h" | 9 #include "src/compiler/js-graph.h" |
10 #include "src/compiler/wasm-compiler.h" | 10 #include "src/compiler/wasm-compiler.h" |
(...skipping 3360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3371 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); | 3371 BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0))); |
3372 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | 3372 FOR_UINT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } |
3373 } | 3373 } |
3374 | 3374 |
3375 | 3375 |
3376 TEST(Run_Wasm_I64SConvertF32) { | 3376 TEST(Run_Wasm_I64SConvertF32) { |
3377 WasmRunner<int64_t> r(MachineType::Float32()); | 3377 WasmRunner<int64_t> r(MachineType::Float32()); |
3378 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); | 3378 BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); |
3379 | 3379 |
3380 FOR_FLOAT32_INPUTS(i) { | 3380 FOR_FLOAT32_INPUTS(i) { |
3381 if (*i < 9223372036854775808.0 && *i > -9223372036854775809.0) { | 3381 if (*i < static_cast<float>(INT64_MAX) && |
| 3382 *i >= static_cast<float>(INT64_MIN)) { |
3382 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | 3383 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); |
3383 } else { | 3384 } else { |
3384 CHECK_TRAP64(r.Call(*i)); | 3385 CHECK_TRAP64(r.Call(*i)); |
3385 } | 3386 } |
3386 } | 3387 } |
3387 } | 3388 } |
3388 | 3389 |
3389 | 3390 |
3390 TEST(Run_Wasm_I64SConvertF64) { | 3391 TEST(Run_Wasm_I64SConvertF64) { |
3391 WasmRunner<int64_t> r(MachineType::Float64()); | 3392 WasmRunner<int64_t> r(MachineType::Float64()); |
3392 BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); | 3393 BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); |
3393 | 3394 |
3394 FOR_FLOAT64_INPUTS(i) { | 3395 FOR_FLOAT64_INPUTS(i) { |
3395 if (*i < 9223372036854775808.0 && *i > -9223372036854775809.0) { | 3396 if (*i < static_cast<double>(INT64_MAX) && |
| 3397 *i >= static_cast<double>(INT64_MIN)) { |
3396 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); | 3398 CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); |
3397 } else { | 3399 } else { |
3398 CHECK_TRAP64(r.Call(*i)); | 3400 CHECK_TRAP64(r.Call(*i)); |
3399 } | 3401 } |
3400 } | 3402 } |
3401 } | 3403 } |
3402 | 3404 |
3403 | 3405 |
3404 TEST(Run_Wasm_I64UConvertF32) { | 3406 TEST(Run_Wasm_I64UConvertF32) { |
3405 WasmRunner<uint64_t> r(MachineType::Float32()); | 3407 WasmRunner<uint64_t> r(MachineType::Float32()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3441 | 3443 |
3442 | 3444 |
3443 TEST(Run_Wasm_F32CopySign) { | 3445 TEST(Run_Wasm_F32CopySign) { |
3444 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); | 3446 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); |
3445 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 3447 BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
3446 | 3448 |
3447 FOR_FLOAT32_INPUTS(i) { | 3449 FOR_FLOAT32_INPUTS(i) { |
3448 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } | 3450 FOR_FLOAT32_INPUTS(j) { CheckFloatEq(copysign(*i, *j), r.Call(*i, *j)); } |
3449 } | 3451 } |
3450 } | 3452 } |
OLD | NEW |