| 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 a87656f408d8ba980810870dd29afa5286fb5f27..3b491d8bf821d9cacadf5e90f9989681dbd9abf1 100644
|
| --- a/test/cctest/wasm/test-run-wasm.cc
|
| +++ b/test/cctest/wasm/test-run-wasm.cc
|
| @@ -448,6 +448,42 @@ WASM_EXEC_TEST(Int32DivS_byzero_const) {
|
| }
|
| }
|
|
|
| +WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) {
|
| + for (int8_t denom = -2; denom < 8; ++denom) {
|
| + TestingModule module(execution_mode);
|
| + module.ChangeOriginToAsmjs();
|
| + WasmRunner<int32_t> r(&module, MachineType::Int32());
|
| + BUILD(r, WASM_I32_ASMJS_DIVS(WASM_GET_LOCAL(0), WASM_I8(denom)));
|
| + FOR_INT32_INPUTS(i) {
|
| + if (denom == 0) {
|
| + CHECK_EQ(0, r.Call(*i));
|
| + } else if (denom == -1 && *i == std::numeric_limits<int32_t>::min()) {
|
| + CHECK_EQ(std::numeric_limits<int32_t>::min(), r.Call(*i));
|
| + } else {
|
| + CHECK_EQ(*i / denom, r.Call(*i));
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| +WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) {
|
| + for (int8_t denom = -2; denom < 8; ++denom) {
|
| + TestingModule module(execution_mode);
|
| + module.ChangeOriginToAsmjs();
|
| + WasmRunner<int32_t> r(&module, MachineType::Int32());
|
| + BUILD(r, WASM_I32_ASMJS_REMS(WASM_GET_LOCAL(0), WASM_I8(denom)));
|
| + FOR_INT32_INPUTS(i) {
|
| + if (denom == 0) {
|
| + CHECK_EQ(0, r.Call(*i));
|
| + } else if (denom == -1 && *i == std::numeric_limits<int32_t>::min()) {
|
| + CHECK_EQ(0, r.Call(*i));
|
| + } else {
|
| + CHECK_EQ(*i % denom, r.Call(*i));
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| WASM_EXEC_TEST(Int32DivU_byzero_const) {
|
| for (uint32_t denom = 0xfffffffe; denom < 8; ++denom) {
|
| WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32());
|
|
|