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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 for (size_t i = 0; i < arraysize(values); i++) { | 534 for (size_t i = 0; i < arraysize(values); i++) { |
535 CHECK_EQ(values[i].expected, r.Call(values[i].input)); | 535 CHECK_EQ(values[i].expected, r.Call(values[i].input)); |
536 } | 536 } |
537 } | 537 } |
538 | 538 |
539 // kExprF32SConvertI64: | 539 // kExprF32SConvertI64: |
540 TEST(Run_WasmF32SConvertI64) { | 540 TEST(Run_WasmF32SConvertI64) { |
541 REQUIRE(F32SConvertI64); | 541 REQUIRE(F32SConvertI64); |
542 WasmRunner<float> r(MachineType::Int64()); | 542 WasmRunner<float> r(MachineType::Int64()); |
543 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); | 543 BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); |
544 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), r.Call(*i)); } | 544 FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); } |
545 } | 545 } |
546 // kExprF32UConvertI64: | 546 // kExprF32UConvertI64: |
547 TEST(Run_WasmF32UConvertI64) { | 547 TEST(Run_WasmF32UConvertI64) { |
548 REQUIRE(F32UConvertI64); | 548 REQUIRE(F32UConvertI64); |
549 struct { | 549 struct { |
550 uint64_t input; | 550 uint64_t input; |
551 uint32_t expected; | 551 uint32_t expected; |
552 } values[] = {{0x0, 0x0}, | 552 } values[] = {{0x0, 0x0}, |
553 {0x1, 0x3f800000}, | 553 {0x1, 0x3f800000}, |
554 {0xffffffff, 0x4f800000}, | 554 {0xffffffff, 0x4f800000}, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); | 629 BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0))); |
630 for (size_t i = 0; i < arraysize(values); i++) { | 630 for (size_t i = 0; i < arraysize(values); i++) { |
631 CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input)); | 631 CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input)); |
632 } | 632 } |
633 } | 633 } |
634 // kExprF64SConvertI64: | 634 // kExprF64SConvertI64: |
635 TEST(Run_WasmF64SConvertI64) { | 635 TEST(Run_WasmF64SConvertI64) { |
636 REQUIRE(F64SConvertI64); | 636 REQUIRE(F64SConvertI64); |
637 WasmRunner<double> r(MachineType::Int64()); | 637 WasmRunner<double> r(MachineType::Int64()); |
638 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); | 638 BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); |
639 FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), r.Call(*i)); } | 639 FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); } |
640 } | 640 } |
641 // kExprF64UConvertI64: | 641 // kExprF64UConvertI64: |
642 TEST(Run_Wasm_F64UConvertI64) { | 642 TEST(Run_Wasm_F64UConvertI64) { |
643 REQUIRE(F64UConvertI64); | 643 REQUIRE(F64UConvertI64); |
644 struct { | 644 struct { |
645 uint64_t input; | 645 uint64_t input; |
646 uint64_t expected; | 646 uint64_t expected; |
647 } values[] = {{0x0, 0x0}, | 647 } values[] = {{0x0, 0x0}, |
648 {0x1, 0x3ff0000000000000}, | 648 {0x1, 0x3ff0000000000000}, |
649 {0xffffffff, 0x41efffffffe00000}, | 649 {0xffffffff, 0x41efffffffe00000}, |
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1298 REQUIRE(I64Eq); | 1298 REQUIRE(I64Eq); |
1299 | 1299 |
1300 WasmRunner<int32_t> r(MachineType::Int64()); | 1300 WasmRunner<int32_t> r(MachineType::Int64()); |
1301 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); | 1301 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); |
1302 | 1302 |
1303 FOR_INT64_INPUTS(i) { | 1303 FOR_INT64_INPUTS(i) { |
1304 int32_t result = *i == 0 ? 1 : 0; | 1304 int32_t result = *i == 0 ? 1 : 0; |
1305 CHECK_EQ(result, r.Call(*i)); | 1305 CHECK_EQ(result, r.Call(*i)); |
1306 } | 1306 } |
1307 } | 1307 } |
OLD | NEW |