Chromium Code Reviews| Index: test/cctest/wasm/test-run-wasm.cc |
| diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc |
| index 617cec6a0f291f8c5ceb7e06ac3c976c03160a81..7de39a27d22075fd58774eca5bd1bfdfaa7f362e 100644 |
| --- a/test/cctest/wasm/test-run-wasm.cc |
| +++ b/test/cctest/wasm/test-run-wasm.cc |
| @@ -324,6 +324,78 @@ TEST(Run_WasmI32Eqz) { |
| TestInt32Unop(kExprI32Eqz, 1, 0); |
| } |
| +TEST(Run_WasmI32Shl) { |
| + WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); |
| + BUILD(r, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| + |
| + FOR_UINT32_INPUTS(i) { |
| + FOR_UINT32_INPUTS(j) { |
| + uint32_t expected = (*i) << (*j & 0x1f); |
| + CHECK_EQ(expected, r.Call(*i, *j)); |
| + } |
| + } |
| +} |
| + |
| +TEST(Run_WasmI32Shr) { |
| + WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); |
| + BUILD(r, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| + |
| + FOR_UINT32_INPUTS(i) { |
| + FOR_UINT32_INPUTS(j) { |
| + uint32_t expected = (*i) >> (*j & 0x1f); |
| + CHECK_EQ(expected, r.Call(*i, *j)); |
| + } |
| + } |
| +} |
| + |
| +TEST(Run_WasmI32Sar) { |
| + WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); |
| + BUILD(r, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| + |
| + FOR_INT32_INPUTS(i) { |
| + FOR_INT32_INPUTS(j) { |
| + int32_t expected = (*i) >> (*j & 0x1f); |
| + CHECK_EQ(expected, r.Call(*i, *j)); |
| + } |
| + } |
| +} |
| + |
| +TEST(Run_WasmI64Shl) { |
|
ahaas
2016/03/30 12:00:08
This test should be in test-run-wasm-64.cc
titzer
2016/03/30 12:10:26
Done.
|
| + WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
| + BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| + |
| + FOR_UINT64_INPUTS(i) { |
| + FOR_UINT64_INPUTS(j) { |
| + uint64_t expected = (*i) << (*j & 0x3f); |
| + CHECK_EQ(expected, r.Call(*i, *j)); |
| + } |
| + } |
| +} |
| + |
| +TEST(Run_WasmI64Shr) { |
| + WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); |
|
ahaas
2016/03/30 12:00:08
same here.
titzer
2016/03/30 12:10:26
Done.
|
| + BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| + |
| + FOR_UINT64_INPUTS(i) { |
| + FOR_UINT64_INPUTS(j) { |
| + uint64_t expected = (*i) >> (*j & 0x3f); |
| + CHECK_EQ(expected, r.Call(*i, *j)); |
| + } |
| + } |
| +} |
| + |
| +TEST(Run_WasmI64Sar) { |
|
ahaas
2016/03/30 12:00:09
same here.
titzer
2016/03/30 12:10:26
Done.
|
| + WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); |
| + BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |
| + |
| + FOR_INT64_INPUTS(i) { |
| + FOR_INT64_INPUTS(j) { |
| + int64_t expected = (*i) >> (*j & 0x3f); |
| + CHECK_EQ(expected, r.Call(*i, *j)); |
| + } |
| + } |
| +} |
| + |
| TEST(Run_WASM_Int32DivS_trap) { |
| WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); |
| BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); |