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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/wasm/wasm-macro-gen.h" | 10 #include "src/wasm/wasm-macro-gen.h" |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 } | 293 } |
294 } | 294 } |
295 } | 295 } |
296 } | 296 } |
297 | 297 |
298 WASM_EXEC_TEST(I64DivU_Trap) { | 298 WASM_EXEC_TEST(I64DivU_Trap) { |
299 REQUIRE(I64DivU); | 299 REQUIRE(I64DivU); |
300 WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), | 300 WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), |
301 MachineType::Uint64()); | 301 MachineType::Uint64()); |
302 BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 302 BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
303 CHECK_EQ(0, r.Call(asu64(0), asu64(100))); | 303 CHECK_EQ(0u, r.Call(asu64(0), asu64(100))); |
304 CHECK_TRAP64(r.Call(asu64(100), asu64(0))); | 304 CHECK_TRAP64(r.Call(asu64(100), asu64(0))); |
305 CHECK_TRAP64(r.Call(asu64(1001), asu64(0))); | 305 CHECK_TRAP64(r.Call(asu64(1001), asu64(0))); |
306 CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); | 306 CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); |
307 } | 307 } |
308 | 308 |
309 WASM_EXEC_TEST(I64DivU_Byzero_Const) { | 309 WASM_EXEC_TEST(I64DivU_Byzero_Const) { |
310 REQUIRE(I64DivU); | 310 REQUIRE(I64DivU); |
311 for (uint64_t denom = 0xfffffffffffffffe; denom < 8; denom++) { | 311 for (uint64_t denom = 0xfffffffffffffffe; denom < 8; denom++) { |
312 WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64()); | 312 WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64()); |
313 BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(denom))); | 313 BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(denom))); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 364 } |
365 } | 365 } |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 WASM_EXEC_TEST(I64RemU_Trap) { | 369 WASM_EXEC_TEST(I64RemU_Trap) { |
370 REQUIRE(I64RemU); | 370 REQUIRE(I64RemU); |
371 WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), | 371 WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), |
372 MachineType::Uint64()); | 372 MachineType::Uint64()); |
373 BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 373 BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
374 CHECK_EQ(17, r.Call(asu64(217), asu64(100))); | 374 CHECK_EQ(17u, r.Call(asu64(217), asu64(100))); |
375 CHECK_TRAP64(r.Call(asu64(100), asu64(0))); | 375 CHECK_TRAP64(r.Call(asu64(100), asu64(0))); |
376 CHECK_TRAP64(r.Call(asu64(1001), asu64(0))); | 376 CHECK_TRAP64(r.Call(asu64(1001), asu64(0))); |
377 CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); | 377 CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); |
378 } | 378 } |
379 | 379 |
380 WASM_EXEC_TEST(I64And) { | 380 WASM_EXEC_TEST(I64And) { |
381 REQUIRE(I64And); | 381 REQUIRE(I64And); |
382 WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), | 382 WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), |
383 MachineType::Int64()); | 383 MachineType::Int64()); |
384 BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 384 BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
(...skipping 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1654 CHECK_EQ(expected, result); | 1654 CHECK_EQ(expected, result); |
1655 } | 1655 } |
1656 } | 1656 } |
1657 } | 1657 } |
1658 } | 1658 } |
1659 | 1659 |
1660 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); } | 1660 WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); } |
1661 WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); } | 1661 WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); } |
1662 WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); } | 1662 WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); } |
1663 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); } | 1663 WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); } |
OLD | NEW |