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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 REQUIRE(I64Eq); | 1310 REQUIRE(I64Eq); |
1311 | 1311 |
1312 WasmRunner<int32_t> r(MachineType::Int64()); | 1312 WasmRunner<int32_t> r(MachineType::Int64()); |
1313 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); | 1313 BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0))); |
1314 | 1314 |
1315 FOR_INT64_INPUTS(i) { | 1315 FOR_INT64_INPUTS(i) { |
1316 int32_t result = *i == 0 ? 1 : 0; | 1316 int32_t result = *i == 0 ? 1 : 0; |
1317 CHECK_EQ(result, r.Call(*i)); | 1317 CHECK_EQ(result, r.Call(*i)); |
1318 } | 1318 } |
1319 } | 1319 } |
| 1320 |
| 1321 TEST(Run_WasmI64Shl) { |
| 1322 REQUIRE(I64Shl); |
| 1323 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
| 1324 BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 1325 |
| 1326 FOR_UINT64_INPUTS(i) { |
| 1327 FOR_UINT64_INPUTS(j) { |
| 1328 uint64_t expected = (*i) << (*j & 0x3f); |
| 1329 CHECK_EQ(expected, r.Call(*i, *j)); |
| 1330 } |
| 1331 } |
| 1332 } |
| 1333 |
| 1334 TEST(Run_WasmI64Shr) { |
| 1335 REQUIRE(I64ShrU); |
| 1336 WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
| 1337 BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 1338 |
| 1339 FOR_UINT64_INPUTS(i) { |
| 1340 FOR_UINT64_INPUTS(j) { |
| 1341 uint64_t expected = (*i) >> (*j & 0x3f); |
| 1342 CHECK_EQ(expected, r.Call(*i, *j)); |
| 1343 } |
| 1344 } |
| 1345 } |
| 1346 |
| 1347 TEST(Run_WasmI64Sar) { |
| 1348 REQUIRE(I64ShrS); |
| 1349 WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
| 1350 BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| 1351 |
| 1352 FOR_INT64_INPUTS(i) { |
| 1353 FOR_INT64_INPUTS(j) { |
| 1354 int64_t expected = (*i) >> (*j & 0x3f); |
| 1355 CHECK_EQ(expected, r.Call(*i, *j)); |
| 1356 } |
| 1357 } |
| 1358 } |
OLD | NEW |