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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 {4, 0x00000000d7e8a610}, {3, 0x000000009afdbc88}, | 488 {4, 0x00000000d7e8a610}, {3, 0x000000009afdbc88}, |
489 {2, 0x000000009afdbc84}, {1, 0x000000009afdbc82}, | 489 {2, 0x000000009afdbc84}, {1, 0x000000009afdbc82}, |
490 {0, 0x000000009afdbc81}}; | 490 {0, 0x000000009afdbc81}}; |
491 | 491 |
492 WasmRunner<int64_t> r(MachineType::Uint64()); | 492 WasmRunner<int64_t> r(MachineType::Uint64()); |
493 BUILD(r, WASM_I64_CTZ(WASM_GET_LOCAL(0))); | 493 BUILD(r, WASM_I64_CTZ(WASM_GET_LOCAL(0))); |
494 for (size_t i = 0; i < arraysize(values); i++) { | 494 for (size_t i = 0; i < arraysize(values); i++) { |
495 CHECK_EQ(values[i].expected, r.Call(values[i].input)); | 495 CHECK_EQ(values[i].expected, r.Call(values[i].input)); |
496 } | 496 } |
497 } | 497 } |
498 | |
499 | |
500 TEST(Run_WasmInt64Popcnt) { | |
501 struct { | |
502 int64_t expected; | |
503 uint64_t input; | |
504 } values[] = {{64, 0xffffffffffffffff}, | |
505 {0, 0x0000000000000000}, | |
506 {2, 0x0000080000008000}, | |
507 {26, 0x1123456782345678}, | |
508 {38, 0xffedcba09edcba09}}; | |
509 | |
510 WasmRunner<int64_t> r(MachineType::Uint64()); | |
511 BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0))); | |
512 for (size_t i = 0; i < arraysize(values); i++) { | |
513 CHECK_EQ(values[i].expected, r.Call(values[i].input)); | |
514 } | |
515 } | |
516 | |
517 | |
518 #endif | 498 #endif |
519 | 499 |
520 TEST(Run_WASM_Int32DivS_trap) { | 500 TEST(Run_WASM_Int32DivS_trap) { |
521 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); | 501 WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); |
522 BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 502 BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
523 CHECK_EQ(0, r.Call(0, 100)); | 503 CHECK_EQ(0, r.Call(0, 100)); |
524 CHECK_TRAP(r.Call(100, 0)); | 504 CHECK_TRAP(r.Call(100, 0)); |
525 CHECK_TRAP(r.Call(-1001, 0)); | 505 CHECK_TRAP(r.Call(-1001, 0)); |
526 CHECK_TRAP(r.Call(std::numeric_limits<int32_t>::min(), -1)); | 506 CHECK_TRAP(r.Call(std::numeric_limits<int32_t>::min(), -1)); |
527 CHECK_TRAP(r.Call(std::numeric_limits<int32_t>::min(), 0)); | 507 CHECK_TRAP(r.Call(std::numeric_limits<int32_t>::min(), 0)); |
(...skipping 2782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3310 | 3290 |
3311 #if WASM_64 | 3291 #if WASM_64 |
3312 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } | 3292 TEST(Compile_Wasm_CallIndirect_Many_i64) { CompileCallIndirectMany(kAstI64); } |
3313 #endif | 3293 #endif |
3314 | 3294 |
3315 | 3295 |
3316 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } | 3296 TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } |
3317 | 3297 |
3318 | 3298 |
3319 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } | 3299 TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } |
OLD | NEW |