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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 // kExprI64Xor: | 45 // kExprI64Xor: |
46 TEST(Run_WasmI64Xor) { | 46 TEST(Run_WasmI64Xor) { |
47 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 47 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
48 BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 48 BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
49 FOR_INT64_INPUTS(i) { | 49 FOR_INT64_INPUTS(i) { |
50 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); } | 50 FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); } |
51 } | 51 } |
52 } | 52 } |
53 // kExprI64Shl: | 53 // kExprI64Shl: |
54 #if !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_X87 | 54 #if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_X87 |
55 TEST(Run_WasmI64Shl) { | 55 TEST(Run_WasmI64Shl) { |
56 { | 56 { |
57 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); | 57 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
58 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 58 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
59 FOR_UINT64_INPUTS(i) { | 59 FOR_UINT64_INPUTS(i) { |
60 for (int64_t j = 0; j < 64; j++) { | 60 for (int64_t j = 1; j < 64; j++) { |
61 CHECK_EQ(*i << j, r.Call(*i, j)); | 61 CHECK_EQ(*i << j, r.Call(*i, j)); |
62 } | 62 } |
63 } | 63 } |
64 } | 64 } |
65 { | 65 { |
66 WasmRunner<int64_t> r(MachineType::Int64()); | 66 WasmRunner<int64_t> r(MachineType::Int64()); |
| 67 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64(0))); |
| 68 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); } |
| 69 } |
| 70 { |
| 71 WasmRunner<int64_t> r(MachineType::Int64()); |
| 72 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64(32))); |
| 73 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); } |
| 74 } |
| 75 { |
| 76 WasmRunner<int64_t> r(MachineType::Int64()); |
67 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64(20))); | 77 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64(20))); |
68 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } | 78 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } |
69 } | 79 } |
70 { | 80 { |
71 WasmRunner<int64_t> r(MachineType::Int64()); | 81 WasmRunner<int64_t> r(MachineType::Int64()); |
72 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64(40))); | 82 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64(40))); |
73 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } | 83 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } |
74 } | 84 } |
75 } | 85 } |
76 #endif | 86 #endif |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 WASM_I64(0xbcd1234000000013), WASM_I64(0xbcd1234000000014), | 402 WASM_I64(0xbcd1234000000013), WASM_I64(0xbcd1234000000014), |
393 WASM_I64(0xbcd1234000000015), WASM_I64(0xbcd1234000000016), | 403 WASM_I64(0xbcd1234000000015), WASM_I64(0xbcd1234000000016), |
394 WASM_I64(0xbcd1234000000017), WASM_I64(0xbcd1234000000018), | 404 WASM_I64(0xbcd1234000000017), WASM_I64(0xbcd1234000000018), |
395 WASM_I64(0xbcd1234000000019), WASM_I64(0xbcd123400000001a), | 405 WASM_I64(0xbcd1234000000019), WASM_I64(0xbcd123400000001a), |
396 WASM_I64(0xbcd123400000001b), WASM_I64(0xbcd123400000001c), | 406 WASM_I64(0xbcd123400000001b), WASM_I64(0xbcd123400000001c), |
397 WASM_I64(0xbcd123400000001d)))); | 407 WASM_I64(0xbcd123400000001d)))); |
398 | 408 |
399 CHECK_EQ(i + 0xb, r.Call()); | 409 CHECK_EQ(i + 0xb, r.Call()); |
400 } | 410 } |
401 } | 411 } |
OLD | NEW |