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 3390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 } | 3401 } |
3402 } | 3402 } |
3403 } | 3403 } |
3404 | 3404 |
3405 | 3405 |
3406 TEST(Run_Wasm_I64UConvertF32) { | 3406 TEST(Run_Wasm_I64UConvertF32) { |
3407 WasmRunner<uint64_t> r(MachineType::Float32()); | 3407 WasmRunner<uint64_t> r(MachineType::Float32()); |
3408 BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); | 3408 BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); |
3409 | 3409 |
3410 FOR_FLOAT32_INPUTS(i) { | 3410 FOR_FLOAT32_INPUTS(i) { |
3411 if (*i < 18446744073709551616.0 && *i >= 0) { | 3411 if (*i < static_cast<float>(UINT64_MAX) && *i > -1) { |
3412 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); | 3412 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); |
3413 } else { | 3413 } else { |
3414 CHECK_TRAP64(r.Call(*i)); | 3414 CHECK_TRAP64(r.Call(*i)); |
3415 } | 3415 } |
3416 } | 3416 } |
3417 } | 3417 } |
3418 | 3418 |
3419 | 3419 |
3420 TEST(Run_Wasm_I64UConvertF64) { | 3420 TEST(Run_Wasm_I64UConvertF64) { |
3421 WasmRunner<uint64_t> r(MachineType::Float64()); | 3421 WasmRunner<uint64_t> r(MachineType::Float64()); |
3422 BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); | 3422 BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); |
3423 | 3423 |
3424 FOR_FLOAT64_INPUTS(i) { | 3424 FOR_FLOAT64_INPUTS(i) { |
3425 if (*i < 18446744073709551616.0 && *i >= 0) { | 3425 if (*i < static_cast<float>(UINT64_MAX) && *i > -1) { |
3426 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); | 3426 CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); |
3427 } else { | 3427 } else { |
3428 CHECK_TRAP64(r.Call(*i)); | 3428 CHECK_TRAP64(r.Call(*i)); |
3429 } | 3429 } |
3430 } | 3430 } |
3431 } | 3431 } |
3432 #endif | 3432 #endif |
3433 | 3433 |
3434 | 3434 |
3435 TEST(Run_Wasm_F64CopySign) { | 3435 TEST(Run_Wasm_F64CopySign) { |
3436 WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); | 3436 WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); |
3437 BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 3437 BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
3438 | 3438 |
3439 FOR_FLOAT64_INPUTS(i) { | 3439 FOR_FLOAT64_INPUTS(i) { |
3440 FOR_FLOAT64_INPUTS(j) { CheckDoubleEq(copysign(*i, *j), r.Call(*i, *j)); } | 3440 FOR_FLOAT64_INPUTS(j) { CheckDoubleEq(copysign(*i, *j), r.Call(*i, *j)); } |
3441 } | 3441 } |
3442 } | 3442 } |
3443 | 3443 |
3444 | 3444 |
3445 TEST(Run_Wasm_F32CopySign) { | 3445 TEST(Run_Wasm_F32CopySign) { |
3446 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); | 3446 WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); |
3447 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))); |
3448 | 3448 |
3449 FOR_FLOAT32_INPUTS(i) { | 3449 FOR_FLOAT32_INPUTS(i) { |
3450 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)); } |
3451 } | 3451 } |
3452 } | 3452 } |
OLD | NEW |