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 |
| 55 TEST(Run_WasmI64Shl) { |
| 56 { |
| 57 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
| 58 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 59 FOR_UINT64_INPUTS(i) { |
| 60 for (int64_t j = 0; j < 64; j++) { |
| 61 CHECK_EQ(*i << j, r.Call(*i, j)); |
| 62 } |
| 63 } |
| 64 } |
| 65 { |
| 66 WasmRunner<int64_t> r(MachineType::Int64()); |
| 67 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64(20))); |
| 68 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } |
| 69 } |
| 70 { |
| 71 WasmRunner<int64_t> r(MachineType::Int64()); |
| 72 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64(40))); |
| 73 FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } |
| 74 } |
| 75 } |
| 76 #endif |
54 // kExprI64ShrU: | 77 // kExprI64ShrU: |
55 // kExprI64ShrS: | 78 // kExprI64ShrS: |
56 // kExprI64Eq: | 79 // kExprI64Eq: |
57 TEST(Run_WasmI64Eq) { | 80 TEST(Run_WasmI64Eq) { |
58 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); | 81 WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); |
59 BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); | 82 BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
60 FOR_INT64_INPUTS(i) { | 83 FOR_INT64_INPUTS(i) { |
61 FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); } | 84 FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); } |
62 } | 85 } |
63 } | 86 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 WASM_I64(0xbcd1234000000013), WASM_I64(0xbcd1234000000014), | 207 WASM_I64(0xbcd1234000000013), WASM_I64(0xbcd1234000000014), |
185 WASM_I64(0xbcd1234000000015), WASM_I64(0xbcd1234000000016), | 208 WASM_I64(0xbcd1234000000015), WASM_I64(0xbcd1234000000016), |
186 WASM_I64(0xbcd1234000000017), WASM_I64(0xbcd1234000000018), | 209 WASM_I64(0xbcd1234000000017), WASM_I64(0xbcd1234000000018), |
187 WASM_I64(0xbcd1234000000019), WASM_I64(0xbcd123400000001a), | 210 WASM_I64(0xbcd1234000000019), WASM_I64(0xbcd123400000001a), |
188 WASM_I64(0xbcd123400000001b), WASM_I64(0xbcd123400000001c), | 211 WASM_I64(0xbcd123400000001b), WASM_I64(0xbcd123400000001c), |
189 WASM_I64(0xbcd123400000001d)))); | 212 WASM_I64(0xbcd123400000001d)))); |
190 | 213 |
191 CHECK_EQ(i + 0xb, r.Call()); | 214 CHECK_EQ(i + 0xb, r.Call()); |
192 } | 215 } |
193 } | 216 } |
OLD | NEW |