Commit 3fef34e0 authored by titzer's avatar titzer Committed by Commit bot

[wasm] Refactor WASM run tests to allow them to run in the interpreter too.

R=mstarzinger@chromium.org,ahaas@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/1990923002
Cr-Commit-Position: refs/heads/master@{#36332}
parent 067f90c6
...@@ -90,7 +90,7 @@ FOREACH_I64_OPERATOR(DECLARE_CONST) ...@@ -90,7 +90,7 @@ FOREACH_I64_OPERATOR(DECLARE_CONST)
#define REQUIRE(name) \ #define REQUIRE(name) \
if (!WASM_64 && !kSupported_##name) return if (!WASM_64 && !kSupported_##name) return
TEST(Run_Wasm_I64Const) { WASM_EXEC_TEST(I64Const) {
REQUIRE(I64Const); REQUIRE(I64Const);
WasmRunner<int64_t> r; WasmRunner<int64_t> r;
const int64_t kExpectedValue = 0x1122334455667788LL; const int64_t kExpectedValue = 0x1122334455667788LL;
...@@ -99,7 +99,7 @@ TEST(Run_Wasm_I64Const) { ...@@ -99,7 +99,7 @@ TEST(Run_Wasm_I64Const) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_Wasm_I64Const_many) { WASM_EXEC_TEST(I64Const_many) {
REQUIRE(I64Const); REQUIRE(I64Const);
int cntr = 0; int cntr = 0;
FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(i) {
...@@ -112,7 +112,7 @@ TEST(Run_Wasm_I64Const_many) { ...@@ -112,7 +112,7 @@ TEST(Run_Wasm_I64Const_many) {
} }
} }
TEST(Run_Wasm_Return_I64) { WASM_EXEC_TEST(Return_I64) {
REQUIRE(I64Return); REQUIRE(I64Return);
WasmRunner<int64_t> r(MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64());
...@@ -121,7 +121,7 @@ TEST(Run_Wasm_Return_I64) { ...@@ -121,7 +121,7 @@ TEST(Run_Wasm_Return_I64) {
FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_WasmI64Add) { WASM_EXEC_TEST(I64Add) {
REQUIRE(I64Add); REQUIRE(I64Add);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -130,7 +130,7 @@ TEST(Run_WasmI64Add) { ...@@ -130,7 +130,7 @@ TEST(Run_WasmI64Add) {
} }
} }
TEST(Run_Wasm_I64Sub) { WASM_EXEC_TEST(I64Sub) {
REQUIRE(I64Sub); REQUIRE(I64Sub);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -139,7 +139,7 @@ TEST(Run_Wasm_I64Sub) { ...@@ -139,7 +139,7 @@ TEST(Run_Wasm_I64Sub) {
} }
} }
TEST(Run_WasmI64DivS) { WASM_EXEC_TEST(I64DivS) {
REQUIRE(I64DivS); REQUIRE(I64DivS);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -156,7 +156,7 @@ TEST(Run_WasmI64DivS) { ...@@ -156,7 +156,7 @@ TEST(Run_WasmI64DivS) {
} }
} }
TEST(Run_WasmI64DivS_Trap) { WASM_EXEC_TEST(I64DivS_Trap) {
REQUIRE(I64DivS); REQUIRE(I64DivS);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -167,7 +167,7 @@ TEST(Run_WasmI64DivS_Trap) { ...@@ -167,7 +167,7 @@ TEST(Run_WasmI64DivS_Trap) {
CHECK_TRAP64(r.Call(std::numeric_limits<int64_t>::min(), asi64(0))); CHECK_TRAP64(r.Call(std::numeric_limits<int64_t>::min(), asi64(0)));
} }
TEST(Run_WasmI64DivS_Byzero_Const) { WASM_EXEC_TEST(I64DivS_Byzero_Const) {
REQUIRE(I64DivS); REQUIRE(I64DivS);
for (int8_t denom = -2; denom < 8; denom++) { for (int8_t denom = -2; denom < 8; denom++) {
WasmRunner<int64_t> r(MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64());
...@@ -182,7 +182,7 @@ TEST(Run_WasmI64DivS_Byzero_Const) { ...@@ -182,7 +182,7 @@ TEST(Run_WasmI64DivS_Byzero_Const) {
} }
} }
TEST(Run_WasmI64DivU) { WASM_EXEC_TEST(I64DivU) {
REQUIRE(I64DivU); REQUIRE(I64DivU);
WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -197,7 +197,7 @@ TEST(Run_WasmI64DivU) { ...@@ -197,7 +197,7 @@ TEST(Run_WasmI64DivU) {
} }
} }
TEST(Run_WasmI64DivU_Trap) { WASM_EXEC_TEST(I64DivU_Trap) {
REQUIRE(I64DivU); REQUIRE(I64DivU);
WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -207,7 +207,7 @@ TEST(Run_WasmI64DivU_Trap) { ...@@ -207,7 +207,7 @@ TEST(Run_WasmI64DivU_Trap) {
CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0)));
} }
TEST(Run_WasmI64DivU_Byzero_Const) { WASM_EXEC_TEST(I64DivU_Byzero_Const) {
REQUIRE(I64DivU); REQUIRE(I64DivU);
for (uint64_t denom = 0xfffffffffffffffe; denom < 8; denom++) { for (uint64_t denom = 0xfffffffffffffffe; denom < 8; denom++) {
WasmRunner<uint64_t> r(MachineType::Uint64()); WasmRunner<uint64_t> r(MachineType::Uint64());
...@@ -223,7 +223,7 @@ TEST(Run_WasmI64DivU_Byzero_Const) { ...@@ -223,7 +223,7 @@ TEST(Run_WasmI64DivU_Byzero_Const) {
} }
} }
TEST(Run_WasmI64RemS) { WASM_EXEC_TEST(I64RemS) {
REQUIRE(I64RemS); REQUIRE(I64RemS);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -238,7 +238,7 @@ TEST(Run_WasmI64RemS) { ...@@ -238,7 +238,7 @@ TEST(Run_WasmI64RemS) {
} }
} }
TEST(Run_WasmI64RemS_Trap) { WASM_EXEC_TEST(I64RemS_Trap) {
REQUIRE(I64RemS); REQUIRE(I64RemS);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -249,7 +249,7 @@ TEST(Run_WasmI64RemS_Trap) { ...@@ -249,7 +249,7 @@ TEST(Run_WasmI64RemS_Trap) {
CHECK_TRAP64(r.Call(std::numeric_limits<int64_t>::min(), asi64(0))); CHECK_TRAP64(r.Call(std::numeric_limits<int64_t>::min(), asi64(0)));
} }
TEST(Run_WasmI64RemU) { WASM_EXEC_TEST(I64RemU) {
REQUIRE(I64RemU); REQUIRE(I64RemU);
WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -264,7 +264,7 @@ TEST(Run_WasmI64RemU) { ...@@ -264,7 +264,7 @@ TEST(Run_WasmI64RemU) {
} }
} }
TEST(Run_Wasm_I64RemU_Trap) { WASM_EXEC_TEST(I64RemU_Trap) {
REQUIRE(I64RemU); REQUIRE(I64RemU);
WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -274,7 +274,7 @@ TEST(Run_Wasm_I64RemU_Trap) { ...@@ -274,7 +274,7 @@ TEST(Run_Wasm_I64RemU_Trap) {
CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0)));
} }
TEST(Run_Wasm_I64And) { WASM_EXEC_TEST(I64And) {
REQUIRE(I64And); REQUIRE(I64And);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -283,7 +283,7 @@ TEST(Run_Wasm_I64And) { ...@@ -283,7 +283,7 @@ TEST(Run_Wasm_I64And) {
} }
} }
TEST(Run_Wasm_I64Ior) { WASM_EXEC_TEST(I64Ior) {
REQUIRE(I64Ior); REQUIRE(I64Ior);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -292,7 +292,7 @@ TEST(Run_Wasm_I64Ior) { ...@@ -292,7 +292,7 @@ TEST(Run_Wasm_I64Ior) {
} }
} }
TEST(Run_Wasm_I64Xor) { WASM_EXEC_TEST(I64Xor) {
REQUIRE(I64Xor); REQUIRE(I64Xor);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -301,7 +301,7 @@ TEST(Run_Wasm_I64Xor) { ...@@ -301,7 +301,7 @@ TEST(Run_Wasm_I64Xor) {
} }
} }
TEST(Run_Wasm_I64Shl) { WASM_EXEC_TEST(I64Shl) {
REQUIRE(I64Shl); REQUIRE(I64Shl);
{ {
WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
...@@ -336,7 +336,7 @@ TEST(Run_Wasm_I64Shl) { ...@@ -336,7 +336,7 @@ TEST(Run_Wasm_I64Shl) {
} }
} }
TEST(Run_Wasm_I64ShrU) { WASM_EXEC_TEST(I64ShrU) {
REQUIRE(I64ShrU); REQUIRE(I64ShrU);
{ {
WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64()); WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
...@@ -371,7 +371,7 @@ TEST(Run_Wasm_I64ShrU) { ...@@ -371,7 +371,7 @@ TEST(Run_Wasm_I64ShrU) {
} }
} }
TEST(Run_Wasm_I64ShrS) { WASM_EXEC_TEST(I64ShrS) {
REQUIRE(I64ShrS); REQUIRE(I64ShrS);
{ {
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
...@@ -406,7 +406,7 @@ TEST(Run_Wasm_I64ShrS) { ...@@ -406,7 +406,7 @@ TEST(Run_Wasm_I64ShrS) {
} }
} }
TEST(Run_Wasm_I64Eq) { WASM_EXEC_TEST(I64Eq) {
REQUIRE(I64Eq); REQUIRE(I64Eq);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -415,7 +415,7 @@ TEST(Run_Wasm_I64Eq) { ...@@ -415,7 +415,7 @@ TEST(Run_Wasm_I64Eq) {
} }
} }
TEST(Run_Wasm_I64Ne) { WASM_EXEC_TEST(I64Ne) {
REQUIRE(I64Ne); REQUIRE(I64Ne);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -424,7 +424,7 @@ TEST(Run_Wasm_I64Ne) { ...@@ -424,7 +424,7 @@ TEST(Run_Wasm_I64Ne) {
} }
} }
TEST(Run_Wasm_I64LtS) { WASM_EXEC_TEST(I64LtS) {
REQUIRE(I64LtS); REQUIRE(I64LtS);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -433,7 +433,7 @@ TEST(Run_Wasm_I64LtS) { ...@@ -433,7 +433,7 @@ TEST(Run_Wasm_I64LtS) {
} }
} }
TEST(Run_Wasm_I64LeS) { WASM_EXEC_TEST(I64LeS) {
REQUIRE(I64LeS); REQUIRE(I64LeS);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -442,7 +442,7 @@ TEST(Run_Wasm_I64LeS) { ...@@ -442,7 +442,7 @@ TEST(Run_Wasm_I64LeS) {
} }
} }
TEST(Run_Wasm_I64LtU) { WASM_EXEC_TEST(I64LtU) {
REQUIRE(I64LtU); REQUIRE(I64LtU);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -451,7 +451,7 @@ TEST(Run_Wasm_I64LtU) { ...@@ -451,7 +451,7 @@ TEST(Run_Wasm_I64LtU) {
} }
} }
TEST(Run_Wasm_I64LeU) { WASM_EXEC_TEST(I64LeU) {
REQUIRE(I64LeU); REQUIRE(I64LeU);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -460,7 +460,7 @@ TEST(Run_Wasm_I64LeU) { ...@@ -460,7 +460,7 @@ TEST(Run_Wasm_I64LeU) {
} }
} }
TEST(Run_Wasm_I64GtS) { WASM_EXEC_TEST(I64GtS) {
REQUIRE(I64GtS); REQUIRE(I64GtS);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -469,7 +469,7 @@ TEST(Run_Wasm_I64GtS) { ...@@ -469,7 +469,7 @@ TEST(Run_Wasm_I64GtS) {
} }
} }
TEST(Run_Wasm_I64GeS) { WASM_EXEC_TEST(I64GeS) {
REQUIRE(I64GeS); REQUIRE(I64GeS);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -478,7 +478,7 @@ TEST(Run_Wasm_I64GeS) { ...@@ -478,7 +478,7 @@ TEST(Run_Wasm_I64GeS) {
} }
} }
TEST(Run_Wasm_I64GtU) { WASM_EXEC_TEST(I64GtU) {
REQUIRE(I64GtU); REQUIRE(I64GtU);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -487,7 +487,7 @@ TEST(Run_Wasm_I64GtU) { ...@@ -487,7 +487,7 @@ TEST(Run_Wasm_I64GtU) {
} }
} }
TEST(Run_Wasm_I64GeU) { WASM_EXEC_TEST(I64GeU) {
REQUIRE(I64GeU); REQUIRE(I64GeU);
WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -496,7 +496,7 @@ TEST(Run_Wasm_I64GeU) { ...@@ -496,7 +496,7 @@ TEST(Run_Wasm_I64GeU) {
} }
} }
TEST(Run_Wasm_I32ConvertI64) { WASM_EXEC_TEST(I32ConvertI64) {
REQUIRE(I32ConvertI64); REQUIRE(I32ConvertI64);
FOR_INT64_INPUTS(i) { FOR_INT64_INPUTS(i) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
...@@ -505,21 +505,21 @@ TEST(Run_Wasm_I32ConvertI64) { ...@@ -505,21 +505,21 @@ TEST(Run_Wasm_I32ConvertI64) {
} }
} }
TEST(Run_Wasm_I64SConvertI32) { WASM_EXEC_TEST(I64SConvertI32) {
REQUIRE(I64SConvertI32); REQUIRE(I64SConvertI32);
WasmRunner<int64_t> r(MachineType::Int32()); WasmRunner<int64_t> r(MachineType::Int32());
BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_I64UConvertI32) { WASM_EXEC_TEST(I64UConvertI32) {
REQUIRE(I64UConvertI32); REQUIRE(I64UConvertI32);
WasmRunner<int64_t> r(MachineType::Uint32()); WasmRunner<int64_t> r(MachineType::Uint32());
BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0)));
FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); }
} }
TEST(Run_WasmI64Popcnt) { WASM_EXEC_TEST(I64Popcnt) {
struct { struct {
int64_t expected; int64_t expected;
uint64_t input; uint64_t input;
...@@ -536,14 +536,14 @@ TEST(Run_WasmI64Popcnt) { ...@@ -536,14 +536,14 @@ TEST(Run_WasmI64Popcnt) {
} }
} }
TEST(Run_WasmF32SConvertI64) { WASM_EXEC_TEST(F32SConvertI64) {
REQUIRE(F32SConvertI64); REQUIRE(F32SConvertI64);
WasmRunner<float> r(MachineType::Int64()); WasmRunner<float> r(MachineType::Int64());
BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0))); BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); } FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); }
} }
TEST(Run_WasmF32UConvertI64) { WASM_EXEC_TEST(F32UConvertI64) {
REQUIRE(F32UConvertI64); REQUIRE(F32UConvertI64);
struct { struct {
uint64_t input; uint64_t input;
...@@ -631,14 +631,14 @@ TEST(Run_WasmF32UConvertI64) { ...@@ -631,14 +631,14 @@ TEST(Run_WasmF32UConvertI64) {
} }
} }
TEST(Run_WasmF64SConvertI64) { WASM_EXEC_TEST(F64SConvertI64) {
REQUIRE(F64SConvertI64); REQUIRE(F64SConvertI64);
WasmRunner<double> r(MachineType::Int64()); WasmRunner<double> r(MachineType::Int64());
BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))); BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); } FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F64UConvertI64) { WASM_EXEC_TEST(F64UConvertI64) {
REQUIRE(F64UConvertI64); REQUIRE(F64UConvertI64);
struct { struct {
uint64_t input; uint64_t input;
...@@ -725,7 +725,7 @@ TEST(Run_Wasm_F64UConvertI64) { ...@@ -725,7 +725,7 @@ TEST(Run_Wasm_F64UConvertI64) {
} }
} }
TEST(Run_Wasm_I64SConvertF32a) { WASM_EXEC_TEST(I64SConvertF32a) {
WasmRunner<int64_t> r(MachineType::Float32()); WasmRunner<int64_t> r(MachineType::Float32());
BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
...@@ -739,7 +739,7 @@ TEST(Run_Wasm_I64SConvertF32a) { ...@@ -739,7 +739,7 @@ TEST(Run_Wasm_I64SConvertF32a) {
} }
} }
TEST(Run_Wasm_I64SConvertF64a) { WASM_EXEC_TEST(I64SConvertF64a) {
WasmRunner<int64_t> r(MachineType::Float64()); WasmRunner<int64_t> r(MachineType::Float64());
BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
...@@ -753,7 +753,7 @@ TEST(Run_Wasm_I64SConvertF64a) { ...@@ -753,7 +753,7 @@ TEST(Run_Wasm_I64SConvertF64a) {
} }
} }
TEST(Run_Wasm_I64UConvertF32a) { WASM_EXEC_TEST(I64UConvertF32a) {
WasmRunner<uint64_t> r(MachineType::Float32()); WasmRunner<uint64_t> r(MachineType::Float32());
BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
...@@ -767,7 +767,7 @@ TEST(Run_Wasm_I64UConvertF32a) { ...@@ -767,7 +767,7 @@ TEST(Run_Wasm_I64UConvertF32a) {
} }
} }
TEST(Run_Wasm_I64UConvertF64a) { WASM_EXEC_TEST(I64UConvertF64a) {
WasmRunner<uint64_t> r(MachineType::Float64()); WasmRunner<uint64_t> r(MachineType::Float64());
BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
...@@ -781,7 +781,7 @@ TEST(Run_Wasm_I64UConvertF64a) { ...@@ -781,7 +781,7 @@ TEST(Run_Wasm_I64UConvertF64a) {
} }
} }
TEST(Run_WasmCallI64Parameter) { WASM_EXEC_TEST(CallI64Parameter) {
// Build the target function. // Build the target function.
LocalType param_types[20]; LocalType param_types[20];
for (int i = 0; i < 20; i++) param_types[i] = kAstI64; for (int i = 0; i < 20; i++) param_types[i] = kAstI64;
...@@ -855,7 +855,7 @@ void TestI64Cmp(WasmOpcode opcode, int64_t expected, int64_t a, int64_t b) { ...@@ -855,7 +855,7 @@ void TestI64Cmp(WasmOpcode opcode, int64_t expected, int64_t a, int64_t b) {
TestI64Binop(kExpr##name, expected, a, b); \ TestI64Binop(kExpr##name, expected, a, b); \
} while (false) } while (false)
TEST(Run_Wasm_I64Binops) { WASM_EXEC_TEST(I64Binops) {
TEST_I64_BINOP(I64Add, -5586332274295447011, 0x501b72ebabc26847, TEST_I64_BINOP(I64Add, -5586332274295447011, 0x501b72ebabc26847,
0x625de9793d8f79d6); 0x625de9793d8f79d6);
TEST_I64_BINOP(I64Sub, 9001903251710731490, 0xf24fe6474640002e, TEST_I64_BINOP(I64Sub, 9001903251710731490, 0xf24fe6474640002e,
...@@ -892,7 +892,7 @@ TEST(Run_Wasm_I64Binops) { ...@@ -892,7 +892,7 @@ TEST(Run_Wasm_I64Binops) {
if (WASM_64 || kSupported_##name) TestI64Cmp(kExpr##name, expected, a, b); \ if (WASM_64 || kSupported_##name) TestI64Cmp(kExpr##name, expected, a, b); \
} while (false) } while (false)
TEST(Run_Wasm_I64Compare) { WASM_EXEC_TEST(I64Compare) {
TEST_I64_CMP(I64Eq, 0, 0xB915D8FA494064F0, 0x04D700B2536019A3); TEST_I64_CMP(I64Eq, 0, 0xB915D8FA494064F0, 0x04D700B2536019A3);
TEST_I64_CMP(I64Ne, 1, 0xC2FAFAAAB0446CDC, 0x52A3328F780C97A3); TEST_I64_CMP(I64Ne, 1, 0xC2FAFAAAB0446CDC, 0x52A3328F780C97A3);
TEST_I64_CMP(I64LtS, 0, 0x673636E6306B0578, 0x028EC9ECA78F7227); TEST_I64_CMP(I64LtS, 0, 0x673636E6306B0578, 0x028EC9ECA78F7227);
...@@ -905,7 +905,7 @@ TEST(Run_Wasm_I64Compare) { ...@@ -905,7 +905,7 @@ TEST(Run_Wasm_I64Compare) {
TEST_I64_CMP(I64GeU, 0, 0x0886A0C58C7AA224, 0x5DDBE5A81FD7EE47); TEST_I64_CMP(I64GeU, 0, 0x0886A0C58C7AA224, 0x5DDBE5A81FD7EE47);
} }
TEST(Run_Wasm_I64Clz) { WASM_EXEC_TEST(I64Clz) {
REQUIRE(I64Clz); REQUIRE(I64Clz);
struct { struct {
int64_t expected; int64_t expected;
...@@ -951,7 +951,7 @@ TEST(Run_Wasm_I64Clz) { ...@@ -951,7 +951,7 @@ TEST(Run_Wasm_I64Clz) {
} }
} }
TEST(Run_Wasm_I64Ctz) { WASM_EXEC_TEST(I64Ctz) {
REQUIRE(I64Ctz); REQUIRE(I64Ctz);
struct { struct {
int64_t expected; int64_t expected;
...@@ -997,7 +997,7 @@ TEST(Run_Wasm_I64Ctz) { ...@@ -997,7 +997,7 @@ TEST(Run_Wasm_I64Ctz) {
} }
} }
TEST(Run_Wasm_I64Popcnt) { WASM_EXEC_TEST(I64Popcnt2) {
REQUIRE(I64Popcnt); REQUIRE(I64Popcnt);
struct { struct {
int64_t expected; int64_t expected;
...@@ -1068,7 +1068,7 @@ TEST(Run_TestI64WasmRunner) { ...@@ -1068,7 +1068,7 @@ TEST(Run_TestI64WasmRunner) {
} }
} }
TEST(Run_WasmCall_Int64Sub) { WASM_EXEC_TEST(Call_Int64Sub) {
REQUIRE(I64Sub); REQUIRE(I64Sub);
// Build the target function. // Build the target function.
TestSignatures sigs; TestSignatures sigs;
...@@ -1095,7 +1095,7 @@ TEST(Run_WasmCall_Int64Sub) { ...@@ -1095,7 +1095,7 @@ TEST(Run_WasmCall_Int64Sub) {
} }
} }
TEST(Run_Wasm_LoadStoreI64_sx) { WASM_EXEC_TEST(LoadStoreI64_sx) {
REQUIRE(I64LoadStore); REQUIRE(I64LoadStore);
REQUIRE(DepthFirst); REQUIRE(DepthFirst);
byte loads[] = {kExprI64LoadMem8S, kExprI64LoadMem16S, kExprI64LoadMem32S, byte loads[] = {kExprI64LoadMem8S, kExprI64LoadMem16S, kExprI64LoadMem32S,
...@@ -1136,7 +1136,7 @@ TEST(Run_Wasm_LoadStoreI64_sx) { ...@@ -1136,7 +1136,7 @@ TEST(Run_Wasm_LoadStoreI64_sx) {
} }
} }
TEST(Run_Wasm_I64SConvertF32b) { WASM_EXEC_TEST(I64SConvertF32b) {
REQUIRE(I64SConvertF32); REQUIRE(I64SConvertF32);
WasmRunner<int64_t> r(MachineType::Float32()); WasmRunner<int64_t> r(MachineType::Float32());
BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
...@@ -1151,7 +1151,7 @@ TEST(Run_Wasm_I64SConvertF32b) { ...@@ -1151,7 +1151,7 @@ TEST(Run_Wasm_I64SConvertF32b) {
} }
} }
TEST(Run_Wasm_I64SConvertF64b) { WASM_EXEC_TEST(I64SConvertF64b) {
REQUIRE(I64SConvertF64); REQUIRE(I64SConvertF64);
WasmRunner<int64_t> r(MachineType::Float64()); WasmRunner<int64_t> r(MachineType::Float64());
BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
...@@ -1166,7 +1166,7 @@ TEST(Run_Wasm_I64SConvertF64b) { ...@@ -1166,7 +1166,7 @@ TEST(Run_Wasm_I64SConvertF64b) {
} }
} }
TEST(Run_Wasm_I64UConvertF32b) { WASM_EXEC_TEST(I64UConvertF32b) {
REQUIRE(I64UConvertF32); REQUIRE(I64UConvertF32);
WasmRunner<uint64_t> r(MachineType::Float32()); WasmRunner<uint64_t> r(MachineType::Float32());
BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
...@@ -1180,7 +1180,7 @@ TEST(Run_Wasm_I64UConvertF32b) { ...@@ -1180,7 +1180,7 @@ TEST(Run_Wasm_I64UConvertF32b) {
} }
} }
TEST(Run_Wasm_I64UConvertF64b) { WASM_EXEC_TEST(I64UConvertF64b) {
REQUIRE(I64UConvertF64); REQUIRE(I64UConvertF64);
WasmRunner<uint64_t> r(MachineType::Float64()); WasmRunner<uint64_t> r(MachineType::Float64());
BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0))); BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
...@@ -1194,7 +1194,7 @@ TEST(Run_Wasm_I64UConvertF64b) { ...@@ -1194,7 +1194,7 @@ TEST(Run_Wasm_I64UConvertF64b) {
} }
} }
TEST(Run_Wasm_I64ReinterpretF64) { WASM_EXEC_TEST(I64ReinterpretF64) {
REQUIRE(I64ReinterpretF64); REQUIRE(I64ReinterpretF64);
TestingModule module; TestingModule module;
int64_t* memory = module.AddMemoryElems<int64_t>(8); int64_t* memory = module.AddMemoryElems<int64_t>(8);
...@@ -1210,7 +1210,7 @@ TEST(Run_Wasm_I64ReinterpretF64) { ...@@ -1210,7 +1210,7 @@ TEST(Run_Wasm_I64ReinterpretF64) {
} }
} }
TEST(Run_Wasm_F64ReinterpretI64) { WASM_EXEC_TEST(F64ReinterpretI64) {
REQUIRE(F64ReinterpretI64); REQUIRE(F64ReinterpretI64);
TestingModule module; TestingModule module;
int64_t* memory = module.AddMemoryElems<int64_t>(8); int64_t* memory = module.AddMemoryElems<int64_t>(8);
...@@ -1228,7 +1228,7 @@ TEST(Run_Wasm_F64ReinterpretI64) { ...@@ -1228,7 +1228,7 @@ TEST(Run_Wasm_F64ReinterpretI64) {
} }
} }
TEST(Run_Wasm_LoadMemI64) { WASM_EXEC_TEST(LoadMemI64) {
REQUIRE(I64LoadStore); REQUIRE(I64LoadStore);
TestingModule module; TestingModule module;
int64_t* memory = module.AddMemoryElems<int64_t>(8); int64_t* memory = module.AddMemoryElems<int64_t>(8);
...@@ -1247,7 +1247,7 @@ TEST(Run_Wasm_LoadMemI64) { ...@@ -1247,7 +1247,7 @@ TEST(Run_Wasm_LoadMemI64) {
CHECK_EQ(77777777, r.Call()); CHECK_EQ(77777777, r.Call());
} }
TEST(Run_Wasm_MemI64_Sum) { WASM_EXEC_TEST(MemI64_Sum) {
REQUIRE(I64LoadStore); REQUIRE(I64LoadStore);
REQUIRE(I64Add); REQUIRE(I64Add);
REQUIRE(I64Sub); REQUIRE(I64Sub);
...@@ -1283,7 +1283,7 @@ TEST(Run_Wasm_MemI64_Sum) { ...@@ -1283,7 +1283,7 @@ TEST(Run_Wasm_MemI64_Sum) {
} }
} }
TEST(Run_Wasm_I64Global) { WASM_EXEC_TEST(I64Global) {
REQUIRE(I64LoadStore); REQUIRE(I64LoadStore);
REQUIRE(I64SConvertI32); REQUIRE(I64SConvertI32);
REQUIRE(I64And); REQUIRE(I64And);
...@@ -1305,7 +1305,7 @@ TEST(Run_Wasm_I64Global) { ...@@ -1305,7 +1305,7 @@ TEST(Run_Wasm_I64Global) {
} }
} }
TEST(Run_Wasm_I64Eqz) { WASM_EXEC_TEST(I64Eqz) {
REQUIRE(I64Eq); REQUIRE(I64Eq);
WasmRunner<int32_t> r(MachineType::Int64()); WasmRunner<int32_t> r(MachineType::Int64());
...@@ -1317,7 +1317,7 @@ TEST(Run_Wasm_I64Eqz) { ...@@ -1317,7 +1317,7 @@ TEST(Run_Wasm_I64Eqz) {
} }
} }
TEST(Run_Wasm_I64Ror) { WASM_EXEC_TEST(I64Ror) {
REQUIRE(I64Ror); REQUIRE(I64Ror);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -1330,7 +1330,7 @@ TEST(Run_Wasm_I64Ror) { ...@@ -1330,7 +1330,7 @@ TEST(Run_Wasm_I64Ror) {
} }
} }
TEST(Run_Wasm_I64Rol) { WASM_EXEC_TEST(I64Rol) {
REQUIRE(I64Rol); REQUIRE(I64Rol);
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64()); WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
......
...@@ -26,7 +26,7 @@ using namespace v8::internal::wasm; ...@@ -26,7 +26,7 @@ using namespace v8::internal::wasm;
#define RET(x) x, kExprReturn, 1 #define RET(x) x, kExprReturn, 1
#define RET_I8(x) kExprI8Const, x, kExprReturn, 1 #define RET_I8(x) kExprI8Const, x, kExprReturn, 1
TEST(Run_WASM_Int32AsmjsDivS) { WASM_EXEC_TEST(Int32AsmjsDivS) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
...@@ -37,7 +37,7 @@ TEST(Run_WASM_Int32AsmjsDivS) { ...@@ -37,7 +37,7 @@ TEST(Run_WASM_Int32AsmjsDivS) {
CHECK_EQ(0, r.Call(kMin, 0)); CHECK_EQ(0, r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32AsmjsRemS) { WASM_EXEC_TEST(Int32AsmjsRemS) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
...@@ -48,7 +48,7 @@ TEST(Run_WASM_Int32AsmjsRemS) { ...@@ -48,7 +48,7 @@ TEST(Run_WASM_Int32AsmjsRemS) {
CHECK_EQ(0, r.Call(kMin, 0)); CHECK_EQ(0, r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32AsmjsDivU) { WASM_EXEC_TEST(Int32AsmjsDivU) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
...@@ -59,7 +59,7 @@ TEST(Run_WASM_Int32AsmjsDivU) { ...@@ -59,7 +59,7 @@ TEST(Run_WASM_Int32AsmjsDivU) {
CHECK_EQ(0, r.Call(kMin, 0)); CHECK_EQ(0, r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32AsmjsRemU) { WASM_EXEC_TEST(Int32AsmjsRemU) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
...@@ -70,7 +70,7 @@ TEST(Run_WASM_Int32AsmjsRemU) { ...@@ -70,7 +70,7 @@ TEST(Run_WASM_Int32AsmjsRemU) {
CHECK_EQ(kMin, r.Call(kMin, -1)); CHECK_EQ(kMin, r.Call(kMin, -1));
} }
TEST(Run_Wasm_I32AsmjsSConvertF32) { WASM_EXEC_TEST(I32AsmjsSConvertF32) {
WasmRunner<int32_t> r(MachineType::Float32()); WasmRunner<int32_t> r(MachineType::Float32());
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0)));
...@@ -80,7 +80,7 @@ TEST(Run_Wasm_I32AsmjsSConvertF32) { ...@@ -80,7 +80,7 @@ TEST(Run_Wasm_I32AsmjsSConvertF32) {
} }
} }
TEST(Run_Wasm_I32AsmjsSConvertF64) { WASM_EXEC_TEST(I32AsmjsSConvertF64) {
WasmRunner<int32_t> r(MachineType::Float64()); WasmRunner<int32_t> r(MachineType::Float64());
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0)));
...@@ -90,7 +90,7 @@ TEST(Run_Wasm_I32AsmjsSConvertF64) { ...@@ -90,7 +90,7 @@ TEST(Run_Wasm_I32AsmjsSConvertF64) {
} }
} }
TEST(Run_Wasm_I32AsmjsUConvertF32) { WASM_EXEC_TEST(I32AsmjsUConvertF32) {
WasmRunner<uint32_t> r(MachineType::Float32()); WasmRunner<uint32_t> r(MachineType::Float32());
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0)));
...@@ -100,7 +100,7 @@ TEST(Run_Wasm_I32AsmjsUConvertF32) { ...@@ -100,7 +100,7 @@ TEST(Run_Wasm_I32AsmjsUConvertF32) {
} }
} }
TEST(Run_Wasm_I32AsmjsUConvertF64) { WASM_EXEC_TEST(I32AsmjsUConvertF64) {
WasmRunner<uint32_t> r(MachineType::Float64()); WasmRunner<uint32_t> r(MachineType::Float64());
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0))); BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0)));
...@@ -110,9 +110,8 @@ TEST(Run_Wasm_I32AsmjsUConvertF64) { ...@@ -110,9 +110,8 @@ TEST(Run_Wasm_I32AsmjsUConvertF64) {
} }
} }
TEST(Run_Wasm_LoadMemI32_oob_asm) { WASM_EXEC_TEST(LoadMemI32_oob_asm) {
TestingModule module; TestingModule module;
module.origin = kAsmJsOrigin;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module, MachineType::Uint32()); WasmRunner<int32_t> r(&module, MachineType::Uint32());
module.RandomizeMemory(1112); module.RandomizeMemory(1112);
...@@ -131,9 +130,8 @@ TEST(Run_Wasm_LoadMemI32_oob_asm) { ...@@ -131,9 +130,8 @@ TEST(Run_Wasm_LoadMemI32_oob_asm) {
} }
} }
TEST(Run_Wasm_LoadMemF32_oob_asm) { WASM_EXEC_TEST(LoadMemF32_oob_asm) {
TestingModule module; TestingModule module;
module.origin = kAsmJsOrigin;
float* memory = module.AddMemoryElems<float>(8); float* memory = module.AddMemoryElems<float>(8);
WasmRunner<float> r(&module, MachineType::Uint32()); WasmRunner<float> r(&module, MachineType::Uint32());
module.RandomizeMemory(1112); module.RandomizeMemory(1112);
...@@ -152,9 +150,8 @@ TEST(Run_Wasm_LoadMemF32_oob_asm) { ...@@ -152,9 +150,8 @@ TEST(Run_Wasm_LoadMemF32_oob_asm) {
} }
} }
TEST(Run_Wasm_LoadMemF64_oob_asm) { WASM_EXEC_TEST(LoadMemF64_oob_asm) {
TestingModule module; TestingModule module;
module.origin = kAsmJsOrigin;
double* memory = module.AddMemoryElems<double>(8); double* memory = module.AddMemoryElems<double>(8);
WasmRunner<double> r(&module, MachineType::Uint32()); WasmRunner<double> r(&module, MachineType::Uint32());
module.RandomizeMemory(1112); module.RandomizeMemory(1112);
...@@ -175,9 +172,8 @@ TEST(Run_Wasm_LoadMemF64_oob_asm) { ...@@ -175,9 +172,8 @@ TEST(Run_Wasm_LoadMemF64_oob_asm) {
} }
} }
TEST(Run_Wasm_StoreMemI32_oob_asm) { WASM_EXEC_TEST(StoreMemI32_oob_asm) {
TestingModule module; TestingModule module;
module.origin = kAsmJsOrigin;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module, MachineType::Uint32(), MachineType::Uint32()); WasmRunner<int32_t> r(&module, MachineType::Uint32(), MachineType::Uint32());
module.RandomizeMemory(1112); module.RandomizeMemory(1112);
......
...@@ -26,7 +26,7 @@ using namespace v8::internal::wasm; ...@@ -26,7 +26,7 @@ using namespace v8::internal::wasm;
#define RET(x) x, kExprReturn, 1 #define RET(x) x, kExprReturn, 1
#define RET_I8(x) kExprI8Const, x, kExprReturn, 1 #define RET_I8(x) kExprI8Const, x, kExprReturn, 1
TEST(Run_WasmInt8Const) { WASM_EXEC_TEST(Int8Const) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
const byte kExpectedValue = 121; const byte kExpectedValue = 121;
// return(kExpectedValue) // return(kExpectedValue)
...@@ -34,7 +34,7 @@ TEST(Run_WasmInt8Const) { ...@@ -34,7 +34,7 @@ TEST(Run_WasmInt8Const) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_WasmInt8Const_fallthru1) { WASM_EXEC_TEST(Int8Const_fallthru1) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
const byte kExpectedValue = 122; const byte kExpectedValue = 122;
// kExpectedValue // kExpectedValue
...@@ -42,7 +42,7 @@ TEST(Run_WasmInt8Const_fallthru1) { ...@@ -42,7 +42,7 @@ TEST(Run_WasmInt8Const_fallthru1) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_WasmInt8Const_fallthru2) { WASM_EXEC_TEST(Int8Const_fallthru2) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
const byte kExpectedValue = 123; const byte kExpectedValue = 123;
// -99 kExpectedValue // -99 kExpectedValue
...@@ -50,7 +50,7 @@ TEST(Run_WasmInt8Const_fallthru2) { ...@@ -50,7 +50,7 @@ TEST(Run_WasmInt8Const_fallthru2) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_WasmInt8Const_all) { WASM_EXEC_TEST(Int8Const_all) {
for (int value = -128; value <= 127; value++) { for (int value = -128; value <= 127; value++) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
// return(value) // return(value)
...@@ -60,7 +60,7 @@ TEST(Run_WasmInt8Const_all) { ...@@ -60,7 +60,7 @@ TEST(Run_WasmInt8Const_all) {
} }
} }
TEST(Run_WasmInt32Const) { WASM_EXEC_TEST(Int32Const) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
const int32_t kExpectedValue = 0x11223344; const int32_t kExpectedValue = 0x11223344;
// return(kExpectedValue) // return(kExpectedValue)
...@@ -68,7 +68,7 @@ TEST(Run_WasmInt32Const) { ...@@ -68,7 +68,7 @@ TEST(Run_WasmInt32Const) {
CHECK_EQ(kExpectedValue, r.Call()); CHECK_EQ(kExpectedValue, r.Call());
} }
TEST(Run_WasmInt32Const_many) { WASM_EXEC_TEST(Int32Const_many) {
FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(i) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
const int32_t kExpectedValue = *i; const int32_t kExpectedValue = *i;
...@@ -78,7 +78,7 @@ TEST(Run_WasmInt32Const_many) { ...@@ -78,7 +78,7 @@ TEST(Run_WasmInt32Const_many) {
} }
} }
TEST(Run_WasmMemorySize) { WASM_EXEC_TEST(MemorySize) {
TestingModule module; TestingModule module;
WasmRunner<int32_t> r(&module); WasmRunner<int32_t> r(&module);
module.AddMemory(1024); module.AddMemory(1024);
...@@ -86,49 +86,49 @@ TEST(Run_WasmMemorySize) { ...@@ -86,49 +86,49 @@ TEST(Run_WasmMemorySize) {
CHECK_EQ(1024, r.Call()); CHECK_EQ(1024, r.Call());
} }
TEST(Run_WasmInt32Param0) { WASM_EXEC_TEST(Int32Param0) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// return(local[0]) // return(local[0])
BUILD(r, WASM_GET_LOCAL(0)); BUILD(r, WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_WasmInt32Param0_fallthru) { WASM_EXEC_TEST(Int32Param0_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// local[0] // local[0]
BUILD(r, WASM_GET_LOCAL(0)); BUILD(r, WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_WasmInt32Param1) { WASM_EXEC_TEST(Int32Param1) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
// local[1] // local[1]
BUILD(r, WASM_GET_LOCAL(1)); BUILD(r, WASM_GET_LOCAL(1));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); }
} }
TEST(Run_WasmInt32Add) { WASM_EXEC_TEST(Int32Add) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
// 11 + 44 // 11 + 44
BUILD(r, WASM_I32_ADD(WASM_I8(11), WASM_I8(44))); BUILD(r, WASM_I32_ADD(WASM_I8(11), WASM_I8(44)));
CHECK_EQ(55, r.Call()); CHECK_EQ(55, r.Call());
} }
TEST(Run_WasmInt32Add_P) { WASM_EXEC_TEST(Int32Add_P) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// p0 + 13 // p0 + 13
BUILD(r, WASM_I32_ADD(WASM_I8(13), WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_ADD(WASM_I8(13), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); }
} }
TEST(Run_WasmInt32Add_P_fallthru) { WASM_EXEC_TEST(Int32Add_P_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// p0 + 13 // p0 + 13
BUILD(r, WASM_I32_ADD(WASM_I8(13), WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_ADD(WASM_I8(13), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); }
} }
TEST(Run_WasmInt32Add_P2) { WASM_EXEC_TEST(Int32Add_P2) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
// p0 + p1 // p0 + p1
BUILD(r, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -141,7 +141,7 @@ TEST(Run_WasmInt32Add_P2) { ...@@ -141,7 +141,7 @@ TEST(Run_WasmInt32Add_P2) {
} }
} }
TEST(Run_WasmFloat32Add) { WASM_EXEC_TEST(Float32Add) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
// int(11.5f + 44.5f) // int(11.5f + 44.5f)
BUILD(r, BUILD(r,
...@@ -149,7 +149,7 @@ TEST(Run_WasmFloat32Add) { ...@@ -149,7 +149,7 @@ TEST(Run_WasmFloat32Add) {
CHECK_EQ(56, r.Call()); CHECK_EQ(56, r.Call());
} }
TEST(Run_WasmFloat64Add) { WASM_EXEC_TEST(Float64Add) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
// return int(13.5d + 43.5d) // return int(13.5d + 43.5d)
BUILD(r, WASM_I32_SCONVERT_F64(WASM_F64_ADD(WASM_F64(13.5), WASM_F64(43.5)))); BUILD(r, WASM_I32_SCONVERT_F64(WASM_F64_ADD(WASM_F64(13.5), WASM_F64(43.5))));
...@@ -171,7 +171,7 @@ void TestInt32Binop(WasmOpcode opcode, int32_t expected, int32_t a, int32_t b) { ...@@ -171,7 +171,7 @@ void TestInt32Binop(WasmOpcode opcode, int32_t expected, int32_t a, int32_t b) {
} }
} }
TEST(Run_WasmInt32Binops) { WASM_EXEC_TEST(Int32Binops) {
TestInt32Binop(kExprI32Add, 88888888, 33333333, 55555555); TestInt32Binop(kExprI32Add, 88888888, 33333333, 55555555);
TestInt32Binop(kExprI32Sub, -1111111, 7777777, 8888888); TestInt32Binop(kExprI32Sub, -1111111, 7777777, 8888888);
TestInt32Binop(kExprI32Mul, 65130756, 88734, 734); TestInt32Binop(kExprI32Mul, 65130756, 88734, 734);
...@@ -218,7 +218,7 @@ void TestInt32Unop(WasmOpcode opcode, int32_t expected, int32_t a) { ...@@ -218,7 +218,7 @@ void TestInt32Unop(WasmOpcode opcode, int32_t expected, int32_t a) {
} }
} }
TEST(Run_WasmInt32Clz) { WASM_EXEC_TEST(Int32Clz) {
TestInt32Unop(kExprI32Clz, 0, 0x80001000); TestInt32Unop(kExprI32Clz, 0, 0x80001000);
TestInt32Unop(kExprI32Clz, 1, 0x40000500); TestInt32Unop(kExprI32Clz, 1, 0x40000500);
TestInt32Unop(kExprI32Clz, 2, 0x20000300); TestInt32Unop(kExprI32Clz, 2, 0x20000300);
...@@ -254,7 +254,7 @@ TEST(Run_WasmInt32Clz) { ...@@ -254,7 +254,7 @@ TEST(Run_WasmInt32Clz) {
TestInt32Unop(kExprI32Clz, 32, 0x00000000); TestInt32Unop(kExprI32Clz, 32, 0x00000000);
} }
TEST(Run_WasmInt32Ctz) { WASM_EXEC_TEST(Int32Ctz) {
TestInt32Unop(kExprI32Ctz, 32, 0x00000000); TestInt32Unop(kExprI32Ctz, 32, 0x00000000);
TestInt32Unop(kExprI32Ctz, 31, 0x80000000); TestInt32Unop(kExprI32Ctz, 31, 0x80000000);
TestInt32Unop(kExprI32Ctz, 30, 0x40000000); TestInt32Unop(kExprI32Ctz, 30, 0x40000000);
...@@ -290,7 +290,7 @@ TEST(Run_WasmInt32Ctz) { ...@@ -290,7 +290,7 @@ TEST(Run_WasmInt32Ctz) {
TestInt32Unop(kExprI32Ctz, 0, 0x9afdbc81); TestInt32Unop(kExprI32Ctz, 0, 0x9afdbc81);
} }
TEST(Run_WasmInt32Popcnt) { WASM_EXEC_TEST(Int32Popcnt) {
TestInt32Unop(kExprI32Popcnt, 32, 0xffffffff); TestInt32Unop(kExprI32Popcnt, 32, 0xffffffff);
TestInt32Unop(kExprI32Popcnt, 0, 0x00000000); TestInt32Unop(kExprI32Popcnt, 0, 0x00000000);
TestInt32Unop(kExprI32Popcnt, 1, 0x00008000); TestInt32Unop(kExprI32Popcnt, 1, 0x00008000);
...@@ -298,7 +298,7 @@ TEST(Run_WasmInt32Popcnt) { ...@@ -298,7 +298,7 @@ TEST(Run_WasmInt32Popcnt) {
TestInt32Unop(kExprI32Popcnt, 19, 0xfedcba09); TestInt32Unop(kExprI32Popcnt, 19, 0xfedcba09);
} }
TEST(Run_WasmI32Eqz) { WASM_EXEC_TEST(I32Eqz) {
TestInt32Unop(kExprI32Eqz, 0, 1); TestInt32Unop(kExprI32Eqz, 0, 1);
TestInt32Unop(kExprI32Eqz, 0, -1); TestInt32Unop(kExprI32Eqz, 0, -1);
TestInt32Unop(kExprI32Eqz, 0, -827343); TestInt32Unop(kExprI32Eqz, 0, -827343);
...@@ -306,7 +306,7 @@ TEST(Run_WasmI32Eqz) { ...@@ -306,7 +306,7 @@ TEST(Run_WasmI32Eqz) {
TestInt32Unop(kExprI32Eqz, 1, 0); TestInt32Unop(kExprI32Eqz, 1, 0);
} }
TEST(Run_WasmI32Shl) { WASM_EXEC_TEST(I32Shl) {
WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
BUILD(r, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -318,7 +318,7 @@ TEST(Run_WasmI32Shl) { ...@@ -318,7 +318,7 @@ TEST(Run_WasmI32Shl) {
} }
} }
TEST(Run_WasmI32Shr) { WASM_EXEC_TEST(I32Shr) {
WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
BUILD(r, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -330,7 +330,7 @@ TEST(Run_WasmI32Shr) { ...@@ -330,7 +330,7 @@ TEST(Run_WasmI32Shr) {
} }
} }
TEST(Run_WasmI32Sar) { WASM_EXEC_TEST(I32Sar) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -342,7 +342,7 @@ TEST(Run_WasmI32Sar) { ...@@ -342,7 +342,7 @@ TEST(Run_WasmI32Sar) {
} }
} }
TEST(Run_WASM_Int32DivS_trap) { WASM_EXEC_TEST(Int32DivS_trap) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
...@@ -353,7 +353,7 @@ TEST(Run_WASM_Int32DivS_trap) { ...@@ -353,7 +353,7 @@ TEST(Run_WASM_Int32DivS_trap) {
CHECK_TRAP(r.Call(kMin, 0)); CHECK_TRAP(r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32RemS_trap) { WASM_EXEC_TEST(Int32RemS_trap) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
...@@ -364,7 +364,7 @@ TEST(Run_WASM_Int32RemS_trap) { ...@@ -364,7 +364,7 @@ TEST(Run_WASM_Int32RemS_trap) {
CHECK_TRAP(r.Call(kMin, 0)); CHECK_TRAP(r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32DivU_trap) { WASM_EXEC_TEST(Int32DivU_trap) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
...@@ -375,7 +375,7 @@ TEST(Run_WASM_Int32DivU_trap) { ...@@ -375,7 +375,7 @@ TEST(Run_WASM_Int32DivU_trap) {
CHECK_TRAP(r.Call(kMin, 0)); CHECK_TRAP(r.Call(kMin, 0));
} }
TEST(Run_WASM_Int32RemU_trap) { WASM_EXEC_TEST(Int32RemU_trap) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(17, r.Call(217, 100)); CHECK_EQ(17, r.Call(217, 100));
...@@ -386,7 +386,7 @@ TEST(Run_WASM_Int32RemU_trap) { ...@@ -386,7 +386,7 @@ TEST(Run_WASM_Int32RemU_trap) {
CHECK_EQ(kMin, r.Call(kMin, -1)); CHECK_EQ(kMin, r.Call(kMin, -1));
} }
TEST(Run_WASM_Int32DivS_byzero_const) { WASM_EXEC_TEST(Int32DivS_byzero_const) {
for (int8_t denom = -2; denom < 8; denom++) { for (int8_t denom = -2; denom < 8; denom++) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I8(denom))); BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I8(denom)));
...@@ -400,7 +400,7 @@ TEST(Run_WASM_Int32DivS_byzero_const) { ...@@ -400,7 +400,7 @@ TEST(Run_WASM_Int32DivS_byzero_const) {
} }
} }
TEST(Run_WASM_Int32DivU_byzero_const) { WASM_EXEC_TEST(Int32DivU_byzero_const) {
for (uint32_t denom = 0xfffffffe; denom < 8; denom++) { for (uint32_t denom = 0xfffffffe; denom < 8; denom++) {
WasmRunner<uint32_t> r(MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32());
BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(denom))); BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
...@@ -415,7 +415,7 @@ TEST(Run_WASM_Int32DivU_byzero_const) { ...@@ -415,7 +415,7 @@ TEST(Run_WASM_Int32DivU_byzero_const) {
} }
} }
TEST(Run_WASM_Int32DivS_trap_effect) { WASM_EXEC_TEST(Int32DivS_trap_effect) {
TestingModule module; TestingModule module;
module.AddMemoryElems<int32_t>(8); module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32());
...@@ -529,7 +529,7 @@ void TestFloat64UnopWithConvert(WasmOpcode opcode, int32_t expected, double a) { ...@@ -529,7 +529,7 @@ void TestFloat64UnopWithConvert(WasmOpcode opcode, int32_t expected, double a) {
} }
} }
TEST(Run_WasmFloat32Binops) { WASM_EXEC_TEST(Float32Binops) {
TestFloat32Binop(kExprF32Eq, 1, 8.125f, 8.125f); TestFloat32Binop(kExprF32Eq, 1, 8.125f, 8.125f);
TestFloat32Binop(kExprF32Ne, 1, 8.125f, 8.127f); TestFloat32Binop(kExprF32Ne, 1, 8.125f, 8.127f);
TestFloat32Binop(kExprF32Lt, 1, -9.5f, -9.0f); TestFloat32Binop(kExprF32Lt, 1, -9.5f, -9.0f);
...@@ -543,14 +543,14 @@ TEST(Run_WasmFloat32Binops) { ...@@ -543,14 +543,14 @@ TEST(Run_WasmFloat32Binops) {
TestFloat32BinopWithConvert(kExprF32Div, 11, 22.1f, 2.0f); TestFloat32BinopWithConvert(kExprF32Div, 11, 22.1f, 2.0f);
} }
TEST(Run_WasmFloat32Unops) { WASM_EXEC_TEST(Float32Unops) {
TestFloat32UnopWithConvert(kExprF32Abs, 8, 8.125f); TestFloat32UnopWithConvert(kExprF32Abs, 8, 8.125f);
TestFloat32UnopWithConvert(kExprF32Abs, 9, -9.125f); TestFloat32UnopWithConvert(kExprF32Abs, 9, -9.125f);
TestFloat32UnopWithConvert(kExprF32Neg, -213, 213.125f); TestFloat32UnopWithConvert(kExprF32Neg, -213, 213.125f);
TestFloat32UnopWithConvert(kExprF32Sqrt, 12, 144.4f); TestFloat32UnopWithConvert(kExprF32Sqrt, 12, 144.4f);
} }
TEST(Run_WasmFloat64Binops) { WASM_EXEC_TEST(Float64Binops) {
TestFloat64Binop(kExprF64Eq, 1, 16.25, 16.25); TestFloat64Binop(kExprF64Eq, 1, 16.25, 16.25);
TestFloat64Binop(kExprF64Ne, 1, 16.25, 16.15); TestFloat64Binop(kExprF64Ne, 1, 16.25, 16.15);
TestFloat64Binop(kExprF64Lt, 1, -32.4, 11.7); TestFloat64Binop(kExprF64Lt, 1, -32.4, 11.7);
...@@ -564,14 +564,14 @@ TEST(Run_WasmFloat64Binops) { ...@@ -564,14 +564,14 @@ TEST(Run_WasmFloat64Binops) {
TestFloat64BinopWithConvert(kExprF64Div, -1111, -2222.3, 2); TestFloat64BinopWithConvert(kExprF64Div, -1111, -2222.3, 2);
} }
TEST(Run_WasmFloat64Unops) { WASM_EXEC_TEST(Float64Unops) {
TestFloat64UnopWithConvert(kExprF64Abs, 108, 108.125); TestFloat64UnopWithConvert(kExprF64Abs, 108, 108.125);
TestFloat64UnopWithConvert(kExprF64Abs, 209, -209.125); TestFloat64UnopWithConvert(kExprF64Abs, 209, -209.125);
TestFloat64UnopWithConvert(kExprF64Neg, -209, 209.125); TestFloat64UnopWithConvert(kExprF64Neg, -209, 209.125);
TestFloat64UnopWithConvert(kExprF64Sqrt, 13, 169.4); TestFloat64UnopWithConvert(kExprF64Sqrt, 13, 169.4);
} }
TEST(Run_WasmFloat32Neg) { WASM_EXEC_TEST(Float32Neg) {
WasmRunner<float> r(MachineType::Float32()); WasmRunner<float> r(MachineType::Float32());
BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0))); BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0)));
...@@ -581,14 +581,14 @@ TEST(Run_WasmFloat32Neg) { ...@@ -581,14 +581,14 @@ TEST(Run_WasmFloat32Neg) {
} }
} }
TEST(Run_WasmFloat32SubMinusZero) { WASM_EXEC_TEST(Float32SubMinusZero) {
WasmRunner<float> r(MachineType::Float32()); WasmRunner<float> r(MachineType::Float32());
BUILD(r, WASM_F32_SUB(WASM_F32(-0.0), WASM_GET_LOCAL(0))); BUILD(r, WASM_F32_SUB(WASM_F32(-0.0), WASM_GET_LOCAL(0)));
CHECK_EQ(0x7fe00000, bit_cast<uint32_t>(r.Call(bit_cast<float>(0x7fa00000)))); CHECK_EQ(0x7fe00000, bit_cast<uint32_t>(r.Call(bit_cast<float>(0x7fa00000))));
} }
TEST(Run_WasmFloat64SubMinusZero) { WASM_EXEC_TEST(Float64SubMinusZero) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0))); BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0)));
...@@ -596,7 +596,7 @@ TEST(Run_WasmFloat64SubMinusZero) { ...@@ -596,7 +596,7 @@ TEST(Run_WasmFloat64SubMinusZero) {
bit_cast<uint64_t>(r.Call(bit_cast<double>(0x7ff0123456789abc)))); bit_cast<uint64_t>(r.Call(bit_cast<double>(0x7ff0123456789abc))));
} }
TEST(Run_WasmFloat64Neg) { WASM_EXEC_TEST(Float64Neg) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0)));
...@@ -606,7 +606,7 @@ TEST(Run_WasmFloat64Neg) { ...@@ -606,7 +606,7 @@ TEST(Run_WasmFloat64Neg) {
} }
} }
TEST(Run_Wasm_IfElse_P) { WASM_EXEC_TEST(IfElse_P) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// if (p0) return 11; else return 22; // if (p0) return 11; else return 22;
BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
...@@ -618,33 +618,33 @@ TEST(Run_Wasm_IfElse_P) { ...@@ -618,33 +618,33 @@ TEST(Run_Wasm_IfElse_P) {
} }
} }
TEST(Run_Wasm_If_empty1) { WASM_EXEC_TEST(If_empty1) {
WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprEnd, WASM_GET_LOCAL(1)); BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprEnd, WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 9, *i)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 9, *i)); }
} }
TEST(Run_Wasm_IfElse_empty1) { WASM_EXEC_TEST(IfElse_empty1) {
WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprElse, kExprEnd, WASM_GET_LOCAL(1)); BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprElse, kExprEnd, WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 8, *i)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 8, *i)); }
} }
TEST(Run_Wasm_IfElse_empty2) { WASM_EXEC_TEST(IfElse_empty2) {
WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
BUILD(r, WASM_GET_LOCAL(0), kExprIf, WASM_ZERO, kExprElse, kExprEnd, BUILD(r, WASM_GET_LOCAL(0), kExprIf, WASM_ZERO, kExprElse, kExprEnd,
WASM_GET_LOCAL(1)); WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 7, *i)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 7, *i)); }
} }
TEST(Run_Wasm_IfElse_empty3) { WASM_EXEC_TEST(IfElse_empty3) {
WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprElse, WASM_ZERO, kExprEnd, BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprElse, WASM_ZERO, kExprEnd,
WASM_GET_LOCAL(1)); WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 6, *i)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 6, *i)); }
} }
TEST(Run_Wasm_If_chain) { WASM_EXEC_TEST(If_chain) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// if (p0) 13; if (p0) 14; 15 // if (p0) 13; if (p0) 14; 15
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_I8(13)), BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_I8(13)),
...@@ -652,7 +652,7 @@ TEST(Run_Wasm_If_chain) { ...@@ -652,7 +652,7 @@ TEST(Run_Wasm_If_chain) {
FOR_INT32_INPUTS(i) { CHECK_EQ(15, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(15, r.Call(*i)); }
} }
TEST(Run_Wasm_If_chain_set) { WASM_EXEC_TEST(If_chain_set) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
// if (p0) p1 = 73; if (p0) p1 = 74; p1 // if (p0) p1 = 73; if (p0) p1 = 74; p1
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I8(73))), BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I8(73))),
...@@ -664,7 +664,7 @@ TEST(Run_Wasm_If_chain_set) { ...@@ -664,7 +664,7 @@ TEST(Run_Wasm_If_chain_set) {
} }
} }
TEST(Run_Wasm_IfElse_Unreachable1) { WASM_EXEC_TEST(IfElse_Unreachable1) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
// if (0) unreachable; else return 22; // if (0) unreachable; else return 22;
BUILD(r, WASM_IF_ELSE(WASM_ZERO, // -- BUILD(r, WASM_IF_ELSE(WASM_ZERO, // --
...@@ -673,21 +673,21 @@ TEST(Run_Wasm_IfElse_Unreachable1) { ...@@ -673,21 +673,21 @@ TEST(Run_Wasm_IfElse_Unreachable1) {
CHECK_EQ(27, r.Call()); CHECK_EQ(27, r.Call());
} }
TEST(Run_Wasm_Return12) { WASM_EXEC_TEST(Return12) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
BUILD(r, RET_I8(12)); BUILD(r, RET_I8(12));
CHECK_EQ(12, r.Call()); CHECK_EQ(12, r.Call());
} }
TEST(Run_Wasm_Return17) { WASM_EXEC_TEST(Return17) {
WasmRunner<int32_t> r; WasmRunner<int32_t> r;
BUILD(r, B1(RET_I8(17))); BUILD(r, B1(RET_I8(17)));
CHECK_EQ(17, r.Call()); CHECK_EQ(17, r.Call());
} }
TEST(Run_Wasm_Return_I32) { WASM_EXEC_TEST(Return_I32) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, RET(WASM_GET_LOCAL(0))); BUILD(r, RET(WASM_GET_LOCAL(0)));
...@@ -695,7 +695,7 @@ TEST(Run_Wasm_Return_I32) { ...@@ -695,7 +695,7 @@ TEST(Run_Wasm_Return_I32) {
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Return_F32) { WASM_EXEC_TEST(Return_F32) {
WasmRunner<float> r(MachineType::Float32()); WasmRunner<float> r(MachineType::Float32());
BUILD(r, RET(WASM_GET_LOCAL(0))); BUILD(r, RET(WASM_GET_LOCAL(0)));
...@@ -711,7 +711,7 @@ TEST(Run_Wasm_Return_F32) { ...@@ -711,7 +711,7 @@ TEST(Run_Wasm_Return_F32) {
} }
} }
TEST(Run_Wasm_Return_F64) { WASM_EXEC_TEST(Return_F64) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
BUILD(r, RET(WASM_GET_LOCAL(0))); BUILD(r, RET(WASM_GET_LOCAL(0)));
...@@ -727,7 +727,7 @@ TEST(Run_Wasm_Return_F64) { ...@@ -727,7 +727,7 @@ TEST(Run_Wasm_Return_F64) {
} }
} }
TEST(Run_Wasm_Select) { WASM_EXEC_TEST(Select) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// return select(11, 22, a); // return select(11, 22, a);
BUILD(r, WASM_SELECT(WASM_I8(11), WASM_I8(22), WASM_GET_LOCAL(0))); BUILD(r, WASM_SELECT(WASM_I8(11), WASM_I8(22), WASM_GET_LOCAL(0)));
...@@ -737,7 +737,7 @@ TEST(Run_Wasm_Select) { ...@@ -737,7 +737,7 @@ TEST(Run_Wasm_Select) {
} }
} }
TEST(Run_Wasm_Select_strict1) { WASM_EXEC_TEST(Select_strict1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// select(a=0, a=1, a=2); return a // select(a=0, a=1, a=2); return a
BUILD(r, B2(WASM_SELECT(WASM_SET_LOCAL(0, WASM_I8(0)), BUILD(r, B2(WASM_SELECT(WASM_SET_LOCAL(0, WASM_I8(0)),
...@@ -747,7 +747,7 @@ TEST(Run_Wasm_Select_strict1) { ...@@ -747,7 +747,7 @@ TEST(Run_Wasm_Select_strict1) {
FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); }
} }
TEST(Run_Wasm_Select_strict2) { WASM_EXEC_TEST(Select_strict2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32);
r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32);
...@@ -760,7 +760,7 @@ TEST(Run_Wasm_Select_strict2) { ...@@ -760,7 +760,7 @@ TEST(Run_Wasm_Select_strict2) {
} }
} }
TEST(Run_Wasm_Select_strict3) { WASM_EXEC_TEST(Select_strict3) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32);
r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32);
...@@ -774,7 +774,7 @@ TEST(Run_Wasm_Select_strict3) { ...@@ -774,7 +774,7 @@ TEST(Run_Wasm_Select_strict3) {
} }
} }
TEST(Run_Wasm_BrIf_strict) { WASM_EXEC_TEST(BrIf_strict) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD( BUILD(
r, r,
...@@ -784,14 +784,14 @@ TEST(Run_Wasm_BrIf_strict) { ...@@ -784,14 +784,14 @@ TEST(Run_Wasm_BrIf_strict) {
FOR_INT32_INPUTS(i) { CHECK_EQ(99, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(99, r.Call(*i)); }
} }
TEST(Run_Wasm_BrTable0a) { WASM_EXEC_TEST(BrTable0a) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), WASM_I8(91))); B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), WASM_I8(91)));
FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); }
} }
TEST(Run_Wasm_BrTable0b) { WASM_EXEC_TEST(BrTable0b) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0))), B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0))),
...@@ -799,7 +799,7 @@ TEST(Run_Wasm_BrTable0b) { ...@@ -799,7 +799,7 @@ TEST(Run_Wasm_BrTable0b) {
FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(*i)); }
} }
TEST(Run_Wasm_BrTable0c) { WASM_EXEC_TEST(BrTable0c) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD( BUILD(
r, r,
...@@ -812,13 +812,13 @@ TEST(Run_Wasm_BrTable0c) { ...@@ -812,13 +812,13 @@ TEST(Run_Wasm_BrTable0c) {
} }
} }
TEST(Run_Wasm_BrTable1) { WASM_EXEC_TEST(BrTable1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), RET_I8(93)); BUILD(r, B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), RET_I8(93));
FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(*i)); }
} }
TEST(Run_Wasm_BrTable_loop) { WASM_EXEC_TEST(BrTable_loop) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
B2(WASM_LOOP(1, WASM_BR_TABLE(WASM_INC_LOCAL_BY(0, 1), 2, BR_TARGET(2), B2(WASM_LOOP(1, WASM_BR_TABLE(WASM_INC_LOCAL_BY(0, 1), 2, BR_TARGET(2),
...@@ -832,7 +832,7 @@ TEST(Run_Wasm_BrTable_loop) { ...@@ -832,7 +832,7 @@ TEST(Run_Wasm_BrTable_loop) {
CHECK_EQ(98, r.Call(-100)); CHECK_EQ(98, r.Call(-100));
} }
TEST(Run_Wasm_BrTable_br) { WASM_EXEC_TEST(BrTable_br) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(1), BR_TARGET(0))), B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(1), BR_TARGET(0))),
...@@ -844,7 +844,7 @@ TEST(Run_Wasm_BrTable_br) { ...@@ -844,7 +844,7 @@ TEST(Run_Wasm_BrTable_br) {
CHECK_EQ(91, r.Call(3)); CHECK_EQ(91, r.Call(3));
} }
TEST(Run_Wasm_BrTable_br2) { WASM_EXEC_TEST(BrTable_br2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(1), BUILD(r, B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(1),
...@@ -861,7 +861,7 @@ TEST(Run_Wasm_BrTable_br2) { ...@@ -861,7 +861,7 @@ TEST(Run_Wasm_BrTable_br2) {
CHECK_EQ(85, r.Call(5)); CHECK_EQ(85, r.Call(5));
} }
TEST(Run_Wasm_BrTable4) { WASM_EXEC_TEST(BrTable4) {
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
for (int t = 0; t < 4; t++) { for (int t = 0; t < 4; t++) {
uint32_t cases[] = {0, 1, 2, 3}; uint32_t cases[] = {0, 1, 2, 3};
...@@ -888,7 +888,7 @@ TEST(Run_Wasm_BrTable4) { ...@@ -888,7 +888,7 @@ TEST(Run_Wasm_BrTable4) {
} }
} }
TEST(Run_Wasm_BrTable4x4) { WASM_EXEC_TEST(BrTable4x4) {
for (byte a = 0; a < 4; a++) { for (byte a = 0; a < 4; a++) {
for (byte b = 0; b < 4; b++) { for (byte b = 0; b < 4; b++) {
for (byte c = 0; c < 4; c++) { for (byte c = 0; c < 4; c++) {
...@@ -921,7 +921,7 @@ TEST(Run_Wasm_BrTable4x4) { ...@@ -921,7 +921,7 @@ TEST(Run_Wasm_BrTable4x4) {
} }
} }
TEST(Run_Wasm_BrTable4_fallthru) { WASM_EXEC_TEST(BrTable4_fallthru) {
byte code[] = { byte code[] = {
B2(B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(0), B2(B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(0),
BR_TARGET(1), BR_TARGET(2), BR_TARGET(3))), BR_TARGET(1), BR_TARGET(2), BR_TARGET(3))),
...@@ -947,7 +947,7 @@ TEST(Run_Wasm_BrTable4_fallthru) { ...@@ -947,7 +947,7 @@ TEST(Run_Wasm_BrTable4_fallthru) {
CHECK_EQ(108, r.Call(4, 100)); CHECK_EQ(108, r.Call(4, 100));
} }
TEST(Run_Wasm_F32ReinterpretI32) { WASM_EXEC_TEST(F32ReinterpretI32) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module); WasmRunner<int32_t> r(&module);
...@@ -962,7 +962,7 @@ TEST(Run_Wasm_F32ReinterpretI32) { ...@@ -962,7 +962,7 @@ TEST(Run_Wasm_F32ReinterpretI32) {
} }
} }
TEST(Run_Wasm_I32ReinterpretF32) { WASM_EXEC_TEST(I32ReinterpretF32) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module, MachineType::Int32()); WasmRunner<int32_t> r(&module, MachineType::Int32());
...@@ -979,7 +979,7 @@ TEST(Run_Wasm_I32ReinterpretF32) { ...@@ -979,7 +979,7 @@ TEST(Run_Wasm_I32ReinterpretF32) {
} }
} }
TEST(Run_Wasm_ReturnStore) { WASM_EXEC_TEST(ReturnStore) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module); WasmRunner<int32_t> r(&module);
...@@ -994,7 +994,7 @@ TEST(Run_Wasm_ReturnStore) { ...@@ -994,7 +994,7 @@ TEST(Run_Wasm_ReturnStore) {
} }
} }
TEST(Run_Wasm_VoidReturn1) { WASM_EXEC_TEST(VoidReturn1) {
// We use a wrapper function because WasmRunner<void> does not exist. // We use a wrapper function because WasmRunner<void> does not exist.
// Build the test function. // Build the test function.
...@@ -1013,7 +1013,7 @@ TEST(Run_Wasm_VoidReturn1) { ...@@ -1013,7 +1013,7 @@ TEST(Run_Wasm_VoidReturn1) {
CHECK_EQ(kExpected, result); CHECK_EQ(kExpected, result);
} }
TEST(Run_Wasm_VoidReturn2) { WASM_EXEC_TEST(VoidReturn2) {
// We use a wrapper function because WasmRunner<void> does not exist. // We use a wrapper function because WasmRunner<void> does not exist.
// Build the test function. // Build the test function.
TestSignatures sigs; TestSignatures sigs;
...@@ -1031,37 +1031,37 @@ TEST(Run_Wasm_VoidReturn2) { ...@@ -1031,37 +1031,37 @@ TEST(Run_Wasm_VoidReturn2) {
CHECK_EQ(kExpected, result); CHECK_EQ(kExpected, result);
} }
TEST(Run_Wasm_Block_empty) { WASM_EXEC_TEST(Block_empty) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, kExprBlock, kExprEnd, WASM_GET_LOCAL(0)); BUILD(r, kExprBlock, kExprEnd, WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Block_empty_br1) { WASM_EXEC_TEST(Block_empty_br1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_BR(0)), WASM_GET_LOCAL(0)); BUILD(r, B1(WASM_BR(0)), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Block_empty_brif1) { WASM_EXEC_TEST(Block_empty_brif1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_BR_IF(0, WASM_ZERO)), WASM_GET_LOCAL(0)); BUILD(r, B1(WASM_BR_IF(0, WASM_ZERO)), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Block_empty_brif2) { WASM_EXEC_TEST(Block_empty_brif2) {
WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
BUILD(r, B1(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); BUILD(r, B1(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
} }
TEST(Run_Wasm_Block_br2) { WASM_EXEC_TEST(Block_br2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_BRV(0, WASM_GET_LOCAL(0)))); BUILD(r, B1(WASM_BRV(0, WASM_GET_LOCAL(0))));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Block_If_P) { WASM_EXEC_TEST(Block_If_P) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// { if (p0) return 51; return 52; } // { if (p0) return 51; return 52; }
BUILD(r, B2( // -- BUILD(r, B2( // --
...@@ -1074,31 +1074,31 @@ TEST(Run_Wasm_Block_If_P) { ...@@ -1074,31 +1074,31 @@ TEST(Run_Wasm_Block_If_P) {
} }
} }
TEST(Run_Wasm_Loop_empty) { WASM_EXEC_TEST(Loop_empty) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, kExprLoop, kExprEnd, WASM_GET_LOCAL(0)); BUILD(r, kExprLoop, kExprEnd, WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Loop_empty_br1) { WASM_EXEC_TEST(Loop_empty_br1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_LOOP(1, WASM_BR(1)), WASM_GET_LOCAL(0)); BUILD(r, WASM_LOOP(1, WASM_BR(1)), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Loop_empty_brif1) { WASM_EXEC_TEST(Loop_empty_brif1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_LOOP(1, WASM_BR_IF(1, WASM_ZERO)), WASM_GET_LOCAL(0)); BUILD(r, WASM_LOOP(1, WASM_BR_IF(1, WASM_ZERO)), WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
} }
TEST(Run_Wasm_Loop_empty_brif2) { WASM_EXEC_TEST(Loop_empty_brif2) {
WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32()); WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
BUILD(r, WASM_LOOP(1, WASM_BR_IF(1, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); BUILD(r, WASM_LOOP(1, WASM_BR_IF(1, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0));
FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
} }
TEST(Run_Wasm_Block_BrIf_P) { WASM_EXEC_TEST(Block_BrIf_P) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(51), WASM_GET_LOCAL(0)), WASM_I8(52))); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(51), WASM_GET_LOCAL(0)), WASM_I8(52)));
FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(i) {
...@@ -1107,7 +1107,7 @@ TEST(Run_Wasm_Block_BrIf_P) { ...@@ -1107,7 +1107,7 @@ TEST(Run_Wasm_Block_BrIf_P) {
} }
} }
TEST(Run_Wasm_Block_IfElse_P_assign) { WASM_EXEC_TEST(Block_IfElse_P_assign) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// { if (p0) p0 = 71; else p0 = 72; return p0; } // { if (p0) p0 = 71; else p0 = 72; return p0; }
BUILD(r, B2( // -- BUILD(r, B2( // --
...@@ -1121,7 +1121,7 @@ TEST(Run_Wasm_Block_IfElse_P_assign) { ...@@ -1121,7 +1121,7 @@ TEST(Run_Wasm_Block_IfElse_P_assign) {
} }
} }
TEST(Run_Wasm_Block_IfElse_P_return) { WASM_EXEC_TEST(Block_IfElse_P_return) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// if (p0) return 81; else return 82; // if (p0) return 81; else return 82;
BUILD(r, // -- BUILD(r, // --
...@@ -1134,7 +1134,7 @@ TEST(Run_Wasm_Block_IfElse_P_return) { ...@@ -1134,7 +1134,7 @@ TEST(Run_Wasm_Block_IfElse_P_return) {
} }
} }
TEST(Run_Wasm_Block_If_P_assign) { WASM_EXEC_TEST(Block_If_P_assign) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// { if (p0) p0 = 61; p0; } // { if (p0) p0 = 61; p0; }
BUILD(r, WASM_BLOCK( BUILD(r, WASM_BLOCK(
...@@ -1146,14 +1146,14 @@ TEST(Run_Wasm_Block_If_P_assign) { ...@@ -1146,14 +1146,14 @@ TEST(Run_Wasm_Block_If_P_assign) {
} }
} }
TEST(Run_Wasm_DanglingAssign) { WASM_EXEC_TEST(DanglingAssign) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// { return 0; p0 = 0; } // { return 0; p0 = 0; }
BUILD(r, B2(RET_I8(99), WASM_SET_LOCAL(0, WASM_ZERO))); BUILD(r, B2(RET_I8(99), WASM_SET_LOCAL(0, WASM_ZERO)));
CHECK_EQ(99, r.Call(1)); CHECK_EQ(99, r.Call(1));
} }
TEST(Run_Wasm_ExprIf_P) { WASM_EXEC_TEST(ExprIf_P) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// p0 ? 11 : 22; // p0 ? 11 : 22;
BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
...@@ -1165,7 +1165,7 @@ TEST(Run_Wasm_ExprIf_P) { ...@@ -1165,7 +1165,7 @@ TEST(Run_Wasm_ExprIf_P) {
} }
} }
TEST(Run_Wasm_ExprIf_P_fallthru) { WASM_EXEC_TEST(ExprIf_P_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
// p0 ? 11 : 22; // p0 ? 11 : 22;
BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
...@@ -1177,7 +1177,7 @@ TEST(Run_Wasm_ExprIf_P_fallthru) { ...@@ -1177,7 +1177,7 @@ TEST(Run_Wasm_ExprIf_P_fallthru) {
} }
} }
TEST(Run_Wasm_CountDown) { WASM_EXEC_TEST(CountDown) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
WASM_BLOCK( WASM_BLOCK(
...@@ -1192,7 +1192,7 @@ TEST(Run_Wasm_CountDown) { ...@@ -1192,7 +1192,7 @@ TEST(Run_Wasm_CountDown) {
CHECK_EQ(0, r.Call(100)); CHECK_EQ(0, r.Call(100));
} }
TEST(Run_Wasm_CountDown_fallthru) { WASM_EXEC_TEST(CountDown_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
WASM_BLOCK( WASM_BLOCK(
...@@ -1206,7 +1206,7 @@ TEST(Run_Wasm_CountDown_fallthru) { ...@@ -1206,7 +1206,7 @@ TEST(Run_Wasm_CountDown_fallthru) {
CHECK_EQ(0, r.Call(100)); CHECK_EQ(0, r.Call(100));
} }
TEST(Run_Wasm_WhileCountDown) { WASM_EXEC_TEST(WhileCountDown) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_BLOCK( BUILD(r, WASM_BLOCK(
2, WASM_WHILE(WASM_GET_LOCAL(0), 2, WASM_WHILE(WASM_GET_LOCAL(0),
...@@ -1218,7 +1218,7 @@ TEST(Run_Wasm_WhileCountDown) { ...@@ -1218,7 +1218,7 @@ TEST(Run_Wasm_WhileCountDown) {
CHECK_EQ(0, r.Call(100)); CHECK_EQ(0, r.Call(100));
} }
TEST(Run_Wasm_Loop_if_break1) { WASM_EXEC_TEST(Loop_if_break1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), BUILD(r, B2(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)),
WASM_SET_LOCAL(0, WASM_I8(99))), WASM_SET_LOCAL(0, WASM_I8(99))),
...@@ -1229,7 +1229,7 @@ TEST(Run_Wasm_Loop_if_break1) { ...@@ -1229,7 +1229,7 @@ TEST(Run_Wasm_Loop_if_break1) {
CHECK_EQ(-29, r.Call(-29)); CHECK_EQ(-29, r.Call(-29));
} }
TEST(Run_Wasm_Loop_if_break2) { WASM_EXEC_TEST(Loop_if_break2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_LOOP(2, WASM_BR_IF(1, WASM_GET_LOCAL(0)), BUILD(r, B2(WASM_LOOP(2, WASM_BR_IF(1, WASM_GET_LOCAL(0)),
WASM_SET_LOCAL(0, WASM_I8(99))), WASM_SET_LOCAL(0, WASM_I8(99))),
...@@ -1240,7 +1240,7 @@ TEST(Run_Wasm_Loop_if_break2) { ...@@ -1240,7 +1240,7 @@ TEST(Run_Wasm_Loop_if_break2) {
CHECK_EQ(-29, r.Call(-29)); CHECK_EQ(-29, r.Call(-29));
} }
TEST(Run_Wasm_Loop_if_break_fallthru) { WASM_EXEC_TEST(Loop_if_break_fallthru) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), BUILD(r, B1(WASM_LOOP(2, WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)),
WASM_SET_LOCAL(0, WASM_I8(93)))), WASM_SET_LOCAL(0, WASM_I8(93)))),
...@@ -1251,7 +1251,7 @@ TEST(Run_Wasm_Loop_if_break_fallthru) { ...@@ -1251,7 +1251,7 @@ TEST(Run_Wasm_Loop_if_break_fallthru) {
CHECK_EQ(-22, r.Call(-22)); CHECK_EQ(-22, r.Call(-22));
} }
TEST(Run_Wasm_IfBreak1) { WASM_EXEC_TEST(IfBreak1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)), BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)),
WASM_I8(91)); WASM_I8(91));
...@@ -1260,7 +1260,7 @@ TEST(Run_Wasm_IfBreak1) { ...@@ -1260,7 +1260,7 @@ TEST(Run_Wasm_IfBreak1) {
CHECK_EQ(91, r.Call(-8734)); CHECK_EQ(91, r.Call(-8734));
} }
TEST(Run_Wasm_IfBreak2) { WASM_EXEC_TEST(IfBreak2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), RET_I8(77))), BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), RET_I8(77))),
WASM_I8(81)); WASM_I8(81));
...@@ -1269,7 +1269,7 @@ TEST(Run_Wasm_IfBreak2) { ...@@ -1269,7 +1269,7 @@ TEST(Run_Wasm_IfBreak2) {
CHECK_EQ(81, r.Call(-8734)); CHECK_EQ(81, r.Call(-8734));
} }
TEST(Run_Wasm_LoadMemI32) { WASM_EXEC_TEST(LoadMemI32) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module, MachineType::Int32()); WasmRunner<int32_t> r(&module, MachineType::Int32());
...@@ -1287,7 +1287,7 @@ TEST(Run_Wasm_LoadMemI32) { ...@@ -1287,7 +1287,7 @@ TEST(Run_Wasm_LoadMemI32) {
CHECK_EQ(77777777, r.Call(0)); CHECK_EQ(77777777, r.Call(0));
} }
TEST(Run_Wasm_LoadMemI32_oob) { WASM_EXEC_TEST(LoadMemI32_oob) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(8); int32_t* memory = module.AddMemoryElems<int32_t>(8);
WasmRunner<int32_t> r(&module, MachineType::Uint32()); WasmRunner<int32_t> r(&module, MachineType::Uint32());
...@@ -1306,7 +1306,7 @@ TEST(Run_Wasm_LoadMemI32_oob) { ...@@ -1306,7 +1306,7 @@ TEST(Run_Wasm_LoadMemI32_oob) {
} }
} }
TEST(Run_Wasm_LoadMem_offset_oob) { WASM_EXEC_TEST(LoadMem_offset_oob) {
TestingModule module; TestingModule module;
module.AddMemoryElems<int32_t>(8); module.AddMemoryElems<int32_t>(8);
...@@ -1332,7 +1332,7 @@ TEST(Run_Wasm_LoadMem_offset_oob) { ...@@ -1332,7 +1332,7 @@ TEST(Run_Wasm_LoadMem_offset_oob) {
} }
} }
TEST(Run_Wasm_LoadMemI32_offset) { WASM_EXEC_TEST(LoadMemI32_offset) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(4); int32_t* memory = module.AddMemoryElems<int32_t>(4);
WasmRunner<int32_t> r(&module, MachineType::Int32()); WasmRunner<int32_t> r(&module, MachineType::Int32());
...@@ -1359,7 +1359,7 @@ TEST(Run_Wasm_LoadMemI32_offset) { ...@@ -1359,7 +1359,7 @@ TEST(Run_Wasm_LoadMemI32_offset) {
#if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64 #if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64
TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) { WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) {
const int kMemSize = 12; const int kMemSize = 12;
// TODO(titzer): Fix misaligned accesses on MIPS and re-enable. // TODO(titzer): Fix misaligned accesses on MIPS and re-enable.
for (int offset = 0; offset < kMemSize + 5; offset++) { for (int offset = 0; offset < kMemSize + 5; offset++) {
...@@ -1384,7 +1384,7 @@ TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) { ...@@ -1384,7 +1384,7 @@ TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) {
#endif #endif
TEST(Run_Wasm_LoadMemI32_const_oob) { WASM_EXEC_TEST(LoadMemI32_const_oob) {
const int kMemSize = 24; const int kMemSize = 24;
for (int offset = 0; offset < kMemSize + 5; offset += 4) { for (int offset = 0; offset < kMemSize + 5; offset += 4) {
for (int index = 0; index < kMemSize + 5; index += 4) { for (int index = 0; index < kMemSize + 5; index += 4) {
...@@ -1406,7 +1406,7 @@ TEST(Run_Wasm_LoadMemI32_const_oob) { ...@@ -1406,7 +1406,7 @@ TEST(Run_Wasm_LoadMemI32_const_oob) {
} }
} }
TEST(Run_Wasm_StoreMemI32_offset) { WASM_EXEC_TEST(StoreMemI32_offset) {
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(4); int32_t* memory = module.AddMemoryElems<int32_t>(4);
WasmRunner<int32_t> r(&module, MachineType::Int32()); WasmRunner<int32_t> r(&module, MachineType::Int32());
...@@ -1429,7 +1429,7 @@ TEST(Run_Wasm_StoreMemI32_offset) { ...@@ -1429,7 +1429,7 @@ TEST(Run_Wasm_StoreMemI32_offset) {
} }
} }
TEST(Run_Wasm_StoreMem_offset_oob) { WASM_EXEC_TEST(StoreMem_offset_oob) {
TestingModule module; TestingModule module;
byte* memory = module.AddMemoryElems<byte>(32); byte* memory = module.AddMemoryElems<byte>(32);
...@@ -1465,7 +1465,7 @@ TEST(Run_Wasm_StoreMem_offset_oob) { ...@@ -1465,7 +1465,7 @@ TEST(Run_Wasm_StoreMem_offset_oob) {
} }
} }
TEST(Run_Wasm_LoadMemI32_P) { WASM_EXEC_TEST(LoadMemI32_P) {
const int kNumElems = 8; const int kNumElems = 8;
TestingModule module; TestingModule module;
int32_t* memory = module.AddMemoryElems<int32_t>(kNumElems); int32_t* memory = module.AddMemoryElems<int32_t>(kNumElems);
...@@ -1479,7 +1479,7 @@ TEST(Run_Wasm_LoadMemI32_P) { ...@@ -1479,7 +1479,7 @@ TEST(Run_Wasm_LoadMemI32_P) {
} }
} }
TEST(Run_Wasm_MemI32_Sum) { WASM_EXEC_TEST(MemI32_Sum) {
const int kNumElems = 20; const int kNumElems = 20;
TestingModule module; TestingModule module;
uint32_t* memory = module.AddMemoryElems<uint32_t>(kNumElems); uint32_t* memory = module.AddMemoryElems<uint32_t>(kNumElems);
...@@ -1511,7 +1511,7 @@ TEST(Run_Wasm_MemI32_Sum) { ...@@ -1511,7 +1511,7 @@ TEST(Run_Wasm_MemI32_Sum) {
} }
} }
TEST(Run_Wasm_CheckMachIntsZero) { WASM_EXEC_TEST(CheckMachIntsZero) {
const int kNumElems = 55; const int kNumElems = 55;
TestingModule module; TestingModule module;
module.AddMemoryElems<uint32_t>(kNumElems); module.AddMemoryElems<uint32_t>(kNumElems);
...@@ -1526,7 +1526,7 @@ TEST(Run_Wasm_CheckMachIntsZero) { ...@@ -1526,7 +1526,7 @@ TEST(Run_Wasm_CheckMachIntsZero) {
CHECK_EQ(0, r.Call((kNumElems - 1) * 4)); CHECK_EQ(0, r.Call((kNumElems - 1) * 4));
} }
TEST(Run_Wasm_MemF32_Sum) { WASM_EXEC_TEST(MemF32_Sum) {
const int kSize = 5; const int kSize = 5;
TestingModule module; TestingModule module;
module.AddMemoryElems<float>(kSize); module.AddMemoryElems<float>(kSize);
...@@ -1589,7 +1589,7 @@ T GenerateAndRunFold(WasmOpcode binop, T* buffer, size_t size, ...@@ -1589,7 +1589,7 @@ T GenerateAndRunFold(WasmOpcode binop, T* buffer, size_t size,
return module.raw_mem_at<double>(0); return module.raw_mem_at<double>(0);
} }
TEST(Run_Wasm_MemF64_Mul) { WASM_EXEC_TEST(MemF64_Mul) {
const size_t kSize = 6; const size_t kSize = 6;
double buffer[kSize] = {1, 2, 2, 2, 2, 2}; double buffer[kSize] = {1, 2, 2, 2, 2, 2};
double result = GenerateAndRunFold<double>(kExprF64Mul, buffer, kSize, double result = GenerateAndRunFold<double>(kExprF64Mul, buffer, kSize,
...@@ -1612,14 +1612,14 @@ TEST(Build_Wasm_Infinite_Loop_effect) { ...@@ -1612,14 +1612,14 @@ TEST(Build_Wasm_Infinite_Loop_effect) {
BUILD(r, WASM_LOOP(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))); BUILD(r, WASM_LOOP(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)));
} }
TEST(Run_Wasm_Unreachable0a) { WASM_EXEC_TEST(Unreachable0a) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV(0, WASM_I8(9)), RET(WASM_GET_LOCAL(0)))); BUILD(r, B2(WASM_BRV(0, WASM_I8(9)), RET(WASM_GET_LOCAL(0))));
CHECK_EQ(9, r.Call(0)); CHECK_EQ(9, r.Call(0));
CHECK_EQ(9, r.Call(1)); CHECK_EQ(9, r.Call(1));
} }
TEST(Run_Wasm_Unreachable0b) { WASM_EXEC_TEST(Unreachable0b) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV(0, WASM_I8(7)), WASM_UNREACHABLE)); BUILD(r, B2(WASM_BRV(0, WASM_I8(7)), WASM_UNREACHABLE));
CHECK_EQ(7, r.Call(0)); CHECK_EQ(7, r.Call(0));
...@@ -1652,7 +1652,7 @@ TEST(Build_Wasm_UnreachableIf2) { ...@@ -1652,7 +1652,7 @@ TEST(Build_Wasm_UnreachableIf2) {
WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)); WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE));
} }
TEST(Run_Wasm_Unreachable_Load) { WASM_EXEC_TEST(Unreachable_Load) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV(0, WASM_GET_LOCAL(0)), BUILD(r, B2(WASM_BRV(0, WASM_GET_LOCAL(0)),
WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0)))); WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0))));
...@@ -1660,14 +1660,14 @@ TEST(Run_Wasm_Unreachable_Load) { ...@@ -1660,14 +1660,14 @@ TEST(Run_Wasm_Unreachable_Load) {
CHECK_EQ(21, r.Call(21)); CHECK_EQ(21, r.Call(21));
} }
TEST(Run_Wasm_Infinite_Loop_not_taken1) { WASM_EXEC_TEST(Infinite_Loop_not_taken1) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I8(45))); BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I8(45)));
// Run the code, but don't go into the infinite loop. // Run the code, but don't go into the infinite loop.
CHECK_EQ(45, r.Call(0)); CHECK_EQ(45, r.Call(0));
} }
TEST(Run_Wasm_Infinite_Loop_not_taken2) { WASM_EXEC_TEST(Infinite_Loop_not_taken2) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(45)), BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(45)),
WASM_INFINITE_LOOP))); WASM_INFINITE_LOOP)));
...@@ -1675,7 +1675,7 @@ TEST(Run_Wasm_Infinite_Loop_not_taken2) { ...@@ -1675,7 +1675,7 @@ TEST(Run_Wasm_Infinite_Loop_not_taken2) {
CHECK_EQ(45, r.Call(1)); CHECK_EQ(45, r.Call(1));
} }
TEST(Run_Wasm_Infinite_Loop_not_taken2_brif) { WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
B2(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), WASM_INFINITE_LOOP)); B2(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), WASM_INFINITE_LOOP));
...@@ -1718,7 +1718,7 @@ TEST(Build_Wasm_SimpleExprs) { ...@@ -1718,7 +1718,7 @@ TEST(Build_Wasm_SimpleExprs) {
#undef GRAPH_BUILD_TEST #undef GRAPH_BUILD_TEST
} }
TEST(Run_Wasm_Int32LoadInt8_signext) { WASM_EXEC_TEST(Int32LoadInt8_signext) {
TestingModule module; TestingModule module;
const int kNumElems = 16; const int kNumElems = 16;
int8_t* memory = module.AddMemoryElems<int8_t>(kNumElems); int8_t* memory = module.AddMemoryElems<int8_t>(kNumElems);
...@@ -1732,7 +1732,7 @@ TEST(Run_Wasm_Int32LoadInt8_signext) { ...@@ -1732,7 +1732,7 @@ TEST(Run_Wasm_Int32LoadInt8_signext) {
} }
} }
TEST(Run_Wasm_Int32LoadInt8_zeroext) { WASM_EXEC_TEST(Int32LoadInt8_zeroext) {
TestingModule module; TestingModule module;
const int kNumElems = 16; const int kNumElems = 16;
byte* memory = module.AddMemory(kNumElems); byte* memory = module.AddMemory(kNumElems);
...@@ -1746,7 +1746,7 @@ TEST(Run_Wasm_Int32LoadInt8_zeroext) { ...@@ -1746,7 +1746,7 @@ TEST(Run_Wasm_Int32LoadInt8_zeroext) {
} }
} }
TEST(Run_Wasm_Int32LoadInt16_signext) { WASM_EXEC_TEST(Int32LoadInt16_signext) {
TestingModule module; TestingModule module;
const int kNumBytes = 16; const int kNumBytes = 16;
byte* memory = module.AddMemory(kNumBytes); byte* memory = module.AddMemory(kNumBytes);
...@@ -1761,7 +1761,7 @@ TEST(Run_Wasm_Int32LoadInt16_signext) { ...@@ -1761,7 +1761,7 @@ TEST(Run_Wasm_Int32LoadInt16_signext) {
} }
} }
TEST(Run_Wasm_Int32LoadInt16_zeroext) { WASM_EXEC_TEST(Int32LoadInt16_zeroext) {
TestingModule module; TestingModule module;
const int kNumBytes = 16; const int kNumBytes = 16;
byte* memory = module.AddMemory(kNumBytes); byte* memory = module.AddMemory(kNumBytes);
...@@ -1776,7 +1776,7 @@ TEST(Run_Wasm_Int32LoadInt16_zeroext) { ...@@ -1776,7 +1776,7 @@ TEST(Run_Wasm_Int32LoadInt16_zeroext) {
} }
} }
TEST(Run_WasmInt32Global) { WASM_EXEC_TEST(Int32Global) {
TestingModule module; TestingModule module;
int32_t* global = module.AddGlobal<int32_t>(MachineType::Int32()); int32_t* global = module.AddGlobal<int32_t>(MachineType::Int32());
WasmRunner<int32_t> r(&module, MachineType::Int32()); WasmRunner<int32_t> r(&module, MachineType::Int32());
...@@ -1792,7 +1792,7 @@ TEST(Run_WasmInt32Global) { ...@@ -1792,7 +1792,7 @@ TEST(Run_WasmInt32Global) {
} }
} }
TEST(Run_WasmInt32Globals_DontAlias) { WASM_EXEC_TEST(Int32Globals_DontAlias) {
const int kNumGlobals = 3; const int kNumGlobals = 3;
TestingModule module; TestingModule module;
int32_t* globals[] = {module.AddGlobal<int32_t>(MachineType::Int32()), int32_t* globals[] = {module.AddGlobal<int32_t>(MachineType::Int32()),
...@@ -1820,7 +1820,7 @@ TEST(Run_WasmInt32Globals_DontAlias) { ...@@ -1820,7 +1820,7 @@ TEST(Run_WasmInt32Globals_DontAlias) {
} }
} }
TEST(Run_WasmFloat32Global) { WASM_EXEC_TEST(Float32Global) {
TestingModule module; TestingModule module;
float* global = module.AddGlobal<float>(MachineType::Float32()); float* global = module.AddGlobal<float>(MachineType::Float32());
WasmRunner<int32_t> r(&module, MachineType::Int32()); WasmRunner<int32_t> r(&module, MachineType::Int32());
...@@ -1838,7 +1838,7 @@ TEST(Run_WasmFloat32Global) { ...@@ -1838,7 +1838,7 @@ TEST(Run_WasmFloat32Global) {
} }
} }
TEST(Run_WasmFloat64Global) { WASM_EXEC_TEST(Float64Global) {
TestingModule module; TestingModule module;
double* global = module.AddGlobal<double>(MachineType::Float64()); double* global = module.AddGlobal<double>(MachineType::Float64());
WasmRunner<int32_t> r(&module, MachineType::Int32()); WasmRunner<int32_t> r(&module, MachineType::Int32());
...@@ -1856,7 +1856,7 @@ TEST(Run_WasmFloat64Global) { ...@@ -1856,7 +1856,7 @@ TEST(Run_WasmFloat64Global) {
} }
} }
TEST(Run_WasmMixedGlobals) { WASM_EXEC_TEST(MixedGlobals) {
TestingModule module; TestingModule module;
int32_t* unused = module.AddGlobal<int32_t>(MachineType::Int32()); int32_t* unused = module.AddGlobal<int32_t>(MachineType::Int32());
byte* memory = module.AddMemory(32); byte* memory = module.AddMemory(32);
...@@ -1910,7 +1910,7 @@ TEST(Run_WasmMixedGlobals) { ...@@ -1910,7 +1910,7 @@ TEST(Run_WasmMixedGlobals) {
USE(unused); USE(unused);
} }
TEST(Run_WasmCallEmpty) { WASM_EXEC_TEST(CallEmpty) {
const int32_t kExpected = -414444; const int32_t kExpected = -414444;
// Build the target function. // Build the target function.
TestSignatures sigs; TestSignatures sigs;
...@@ -1927,7 +1927,7 @@ TEST(Run_WasmCallEmpty) { ...@@ -1927,7 +1927,7 @@ TEST(Run_WasmCallEmpty) {
CHECK_EQ(kExpected, result); CHECK_EQ(kExpected, result);
} }
TEST(Run_WasmCallF32StackParameter) { WASM_EXEC_TEST(CallF32StackParameter) {
// Build the target function. // Build the target function.
LocalType param_types[20]; LocalType param_types[20];
for (int i = 0; i < 20; i++) param_types[i] = kAstF32; for (int i = 0; i < 20; i++) param_types[i] = kAstF32;
...@@ -1951,7 +1951,7 @@ TEST(Run_WasmCallF32StackParameter) { ...@@ -1951,7 +1951,7 @@ TEST(Run_WasmCallF32StackParameter) {
CHECK_EQ(256.5f, result); CHECK_EQ(256.5f, result);
} }
TEST(Run_WasmCallF64StackParameter) { WASM_EXEC_TEST(CallF64StackParameter) {
// Build the target function. // Build the target function.
LocalType param_types[20]; LocalType param_types[20];
for (int i = 0; i < 20; i++) param_types[i] = kAstF64; for (int i = 0; i < 20; i++) param_types[i] = kAstF64;
...@@ -1975,7 +1975,7 @@ TEST(Run_WasmCallF64StackParameter) { ...@@ -1975,7 +1975,7 @@ TEST(Run_WasmCallF64StackParameter) {
CHECK_EQ(256.5, result); CHECK_EQ(256.5, result);
} }
TEST(Run_WasmCallVoid) { WASM_EXEC_TEST(CallVoid) {
const byte kMemOffset = 8; const byte kMemOffset = 8;
const int32_t kElemNum = kMemOffset / sizeof(int32_t); const int32_t kElemNum = kMemOffset / sizeof(int32_t);
const int32_t kExpected = -414444; const int32_t kExpected = -414444;
...@@ -1999,7 +1999,7 @@ TEST(Run_WasmCallVoid) { ...@@ -1999,7 +1999,7 @@ TEST(Run_WasmCallVoid) {
CHECK_EQ(kExpected, module.raw_mem_start<int32_t>()[kElemNum]); CHECK_EQ(kExpected, module.raw_mem_start<int32_t>()[kElemNum]);
} }
TEST(Run_WasmCall_Int32Add) { WASM_EXEC_TEST(Call_Int32Add) {
// Build the target function. // Build the target function.
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -2020,7 +2020,7 @@ TEST(Run_WasmCall_Int32Add) { ...@@ -2020,7 +2020,7 @@ TEST(Run_WasmCall_Int32Add) {
} }
} }
TEST(Run_WasmCall_Float32Sub) { WASM_EXEC_TEST(Call_Float32Sub) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
WasmFunctionCompiler t(sigs.f_ff(), &module); WasmFunctionCompiler t(sigs.f_ff(), &module);
...@@ -2038,7 +2038,7 @@ TEST(Run_WasmCall_Float32Sub) { ...@@ -2038,7 +2038,7 @@ TEST(Run_WasmCall_Float32Sub) {
} }
} }
TEST(Run_WasmCall_Float64Sub) { WASM_EXEC_TEST(Call_Float64Sub) {
TestingModule module; TestingModule module;
double* memory = module.AddMemoryElems<double>(16); double* memory = module.AddMemoryElems<double>(16);
WasmRunner<int32_t> r(&module); WasmRunner<int32_t> r(&module);
...@@ -2159,12 +2159,12 @@ static void Run_WasmMixedCall_N(int start) { ...@@ -2159,12 +2159,12 @@ static void Run_WasmMixedCall_N(int start) {
} }
} }
TEST(Run_WasmMixedCall_0) { Run_WasmMixedCall_N(0); } WASM_EXEC_TEST(MixedCall_0) { Run_WasmMixedCall_N(0); }
TEST(Run_WasmMixedCall_1) { Run_WasmMixedCall_N(1); } WASM_EXEC_TEST(MixedCall_1) { Run_WasmMixedCall_N(1); }
TEST(Run_WasmMixedCall_2) { Run_WasmMixedCall_N(2); } WASM_EXEC_TEST(MixedCall_2) { Run_WasmMixedCall_N(2); }
TEST(Run_WasmMixedCall_3) { Run_WasmMixedCall_N(3); } WASM_EXEC_TEST(MixedCall_3) { Run_WasmMixedCall_N(3); }
TEST(Run_Wasm_AddCall) { WASM_EXEC_TEST(AddCall) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
WasmFunctionCompiler t1(sigs.i_ii(), &module); WasmFunctionCompiler t1(sigs.i_ii(), &module);
...@@ -2185,7 +2185,7 @@ TEST(Run_Wasm_AddCall) { ...@@ -2185,7 +2185,7 @@ TEST(Run_Wasm_AddCall) {
CHECK_EQ(100, r.Call(-49)); CHECK_EQ(100, r.Call(-49));
} }
TEST(Run_Wasm_CountDown_expr) { WASM_EXEC_TEST(CountDown_expr) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_LOOP( BUILD(r, WASM_LOOP(
3, WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), 3, WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)),
...@@ -2197,35 +2197,35 @@ TEST(Run_Wasm_CountDown_expr) { ...@@ -2197,35 +2197,35 @@ TEST(Run_Wasm_CountDown_expr) {
CHECK_EQ(0, r.Call(100)); CHECK_EQ(0, r.Call(100));
} }
TEST(Run_Wasm_ExprBlock2a) { WASM_EXEC_TEST(ExprBlock2a) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(1))); BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(1)));
CHECK_EQ(1, r.Call(0)); CHECK_EQ(1, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
TEST(Run_Wasm_ExprBlock2b) { WASM_EXEC_TEST(ExprBlock2b) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(2))); BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(2)));
CHECK_EQ(2, r.Call(0)); CHECK_EQ(2, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
TEST(Run_Wasm_ExprBlock2c) { WASM_EXEC_TEST(ExprBlock2c) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(1))); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(1)));
CHECK_EQ(1, r.Call(0)); CHECK_EQ(1, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
TEST(Run_Wasm_ExprBlock2d) { WASM_EXEC_TEST(ExprBlock2d) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(2))); BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(2)));
CHECK_EQ(2, r.Call(0)); CHECK_EQ(2, r.Call(0));
CHECK_EQ(1, r.Call(1)); CHECK_EQ(1, r.Call(1));
} }
TEST(Run_Wasm_ExprBlock_ManualSwitch) { WASM_EXEC_TEST(ExprBlock_ManualSwitch) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, WASM_BLOCK(6, WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)), BUILD(r, WASM_BLOCK(6, WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)),
WASM_BRV(1, WASM_I8(11))), WASM_BRV(1, WASM_I8(11))),
...@@ -2247,7 +2247,7 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch) { ...@@ -2247,7 +2247,7 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch) {
CHECK_EQ(99, r.Call(6)); CHECK_EQ(99, r.Call(6));
} }
TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) { WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, BUILD(r,
WASM_BLOCK(6, WASM_BRV_IF(0, WASM_I8(11), WASM_BLOCK(6, WASM_BRV_IF(0, WASM_I8(11),
...@@ -2270,7 +2270,7 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) { ...@@ -2270,7 +2270,7 @@ TEST(Run_Wasm_ExprBlock_ManualSwitch_brif) {
CHECK_EQ(99, r.Call(6)); CHECK_EQ(99, r.Call(6));
} }
TEST(Run_Wasm_nested_ifs) { WASM_EXEC_TEST(nested_ifs) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_IF_ELSE( BUILD(r, WASM_IF_ELSE(
...@@ -2284,7 +2284,7 @@ TEST(Run_Wasm_nested_ifs) { ...@@ -2284,7 +2284,7 @@ TEST(Run_Wasm_nested_ifs) {
CHECK_EQ(14, r.Call(0, 0)); CHECK_EQ(14, r.Call(0, 0));
} }
TEST(Run_Wasm_ExprBlock_if) { WASM_EXEC_TEST(ExprBlock_if) {
WasmRunner<int32_t> r(MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32());
BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I8(11)), BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I8(11)),
...@@ -2294,7 +2294,7 @@ TEST(Run_Wasm_ExprBlock_if) { ...@@ -2294,7 +2294,7 @@ TEST(Run_Wasm_ExprBlock_if) {
CHECK_EQ(14, r.Call(0)); CHECK_EQ(14, r.Call(0));
} }
TEST(Run_Wasm_ExprBlock_nested_ifs) { WASM_EXEC_TEST(ExprBlock_nested_ifs) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_BLOCK( BUILD(r, WASM_BLOCK(
...@@ -2311,7 +2311,7 @@ TEST(Run_Wasm_ExprBlock_nested_ifs) { ...@@ -2311,7 +2311,7 @@ TEST(Run_Wasm_ExprBlock_nested_ifs) {
CHECK_EQ(14, r.Call(0, 0)); CHECK_EQ(14, r.Call(0, 0));
} }
TEST(Run_Wasm_ExprLoop_nested_ifs) { WASM_EXEC_TEST(ExprLoop_nested_ifs) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_LOOP( BUILD(r, WASM_LOOP(
...@@ -2328,7 +2328,7 @@ TEST(Run_Wasm_ExprLoop_nested_ifs) { ...@@ -2328,7 +2328,7 @@ TEST(Run_Wasm_ExprLoop_nested_ifs) {
CHECK_EQ(14, r.Call(0, 0)); CHECK_EQ(14, r.Call(0, 0));
} }
TEST(Run_Wasm_SimpleCallIndirect) { WASM_EXEC_TEST(SimpleCallIndirect) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -2359,7 +2359,7 @@ TEST(Run_Wasm_SimpleCallIndirect) { ...@@ -2359,7 +2359,7 @@ TEST(Run_Wasm_SimpleCallIndirect) {
CHECK_TRAP(r.Call(2)); CHECK_TRAP(r.Call(2));
} }
TEST(Run_Wasm_MultipleCallIndirect) { WASM_EXEC_TEST(MultipleCallIndirect) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -2401,7 +2401,7 @@ TEST(Run_Wasm_MultipleCallIndirect) { ...@@ -2401,7 +2401,7 @@ TEST(Run_Wasm_MultipleCallIndirect) {
CHECK_TRAP(r.Call(2, 1, 0)); CHECK_TRAP(r.Call(2, 1, 0));
} }
TEST(Run_Wasm_CallIndirect_NoTable) { WASM_EXEC_TEST(CallIndirect_NoTable) {
TestSignatures sigs; TestSignatures sigs;
TestingModule module; TestingModule module;
...@@ -2423,63 +2423,63 @@ TEST(Run_Wasm_CallIndirect_NoTable) { ...@@ -2423,63 +2423,63 @@ TEST(Run_Wasm_CallIndirect_NoTable) {
CHECK_TRAP(r.Call(2)); CHECK_TRAP(r.Call(2));
} }
TEST(Run_Wasm_F32Floor) { WASM_EXEC_TEST(F32Floor) {
WasmRunner<float> r(MachineType::Float32()); WasmRunner<float> r(MachineType::Float32());
BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0))); BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), r.Call(*i)); } FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F32Ceil) { WASM_EXEC_TEST(F32Ceil) {
WasmRunner<float> r(MachineType::Float32()); WasmRunner<float> r(MachineType::Float32());
BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0))); BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), r.Call(*i)); } FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F32Trunc) { WASM_EXEC_TEST(F32Trunc) {
WasmRunner<float> r(MachineType::Float32()); WasmRunner<float> r(MachineType::Float32());
BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0))); BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), r.Call(*i)); } FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F32NearestInt) { WASM_EXEC_TEST(F32NearestInt) {
WasmRunner<float> r(MachineType::Float32()); WasmRunner<float> r(MachineType::Float32());
BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0))); BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(*i), r.Call(*i)); } FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F64Floor) { WASM_EXEC_TEST(F64Floor) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
BUILD(r, WASM_F64_FLOOR(WASM_GET_LOCAL(0))); BUILD(r, WASM_F64_FLOOR(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), r.Call(*i)); } FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F64Ceil) { WASM_EXEC_TEST(F64Ceil) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
BUILD(r, WASM_F64_CEIL(WASM_GET_LOCAL(0))); BUILD(r, WASM_F64_CEIL(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), r.Call(*i)); } FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F64Trunc) { WASM_EXEC_TEST(F64Trunc) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
BUILD(r, WASM_F64_TRUNC(WASM_GET_LOCAL(0))); BUILD(r, WASM_F64_TRUNC(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(*i), r.Call(*i)); } FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F64NearestInt) { WASM_EXEC_TEST(F64NearestInt) {
WasmRunner<double> r(MachineType::Float64()); WasmRunner<double> r(MachineType::Float64());
BUILD(r, WASM_F64_NEARESTINT(WASM_GET_LOCAL(0))); BUILD(r, WASM_F64_NEARESTINT(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), r.Call(*i)); } FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), r.Call(*i)); }
} }
TEST(Run_Wasm_F32Min) { WASM_EXEC_TEST(F32Min) {
WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); WasmRunner<float> r(MachineType::Float32(), MachineType::Float32());
BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2502,7 +2502,7 @@ TEST(Run_Wasm_F32Min) { ...@@ -2502,7 +2502,7 @@ TEST(Run_Wasm_F32Min) {
} }
} }
TEST(Run_Wasm_F64Min) { WASM_EXEC_TEST(F64Min) {
WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); WasmRunner<double> r(MachineType::Float64(), MachineType::Float64());
BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2525,7 +2525,7 @@ TEST(Run_Wasm_F64Min) { ...@@ -2525,7 +2525,7 @@ TEST(Run_Wasm_F64Min) {
} }
} }
TEST(Run_Wasm_F32Max) { WASM_EXEC_TEST(F32Max) {
WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); WasmRunner<float> r(MachineType::Float32(), MachineType::Float32());
BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2548,7 +2548,7 @@ TEST(Run_Wasm_F32Max) { ...@@ -2548,7 +2548,7 @@ TEST(Run_Wasm_F32Max) {
} }
} }
TEST(Run_Wasm_F64Max) { WASM_EXEC_TEST(F64Max) {
WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); WasmRunner<double> r(MachineType::Float64(), MachineType::Float64());
BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2574,7 +2574,7 @@ TEST(Run_Wasm_F64Max) { ...@@ -2574,7 +2574,7 @@ TEST(Run_Wasm_F64Max) {
// TODO(ahaas): Fix on mips and reenable. // TODO(ahaas): Fix on mips and reenable.
#if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64 #if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64
TEST(Run_Wasm_F32Min_Snan) { WASM_EXEC_TEST(F32Min_Snan) {
// Test that the instruction does not return a signalling NaN. // Test that the instruction does not return a signalling NaN.
{ {
WasmRunner<float> r; WasmRunner<float> r;
...@@ -2590,7 +2590,7 @@ TEST(Run_Wasm_F32Min_Snan) { ...@@ -2590,7 +2590,7 @@ TEST(Run_Wasm_F32Min_Snan) {
} }
} }
TEST(Run_Wasm_F32Max_Snan) { WASM_EXEC_TEST(F32Max_Snan) {
// Test that the instruction does not return a signalling NaN. // Test that the instruction does not return a signalling NaN.
{ {
WasmRunner<float> r; WasmRunner<float> r;
...@@ -2606,7 +2606,7 @@ TEST(Run_Wasm_F32Max_Snan) { ...@@ -2606,7 +2606,7 @@ TEST(Run_Wasm_F32Max_Snan) {
} }
} }
TEST(Run_Wasm_F64Min_Snan) { WASM_EXEC_TEST(F64Min_Snan) {
// Test that the instruction does not return a signalling NaN. // Test that the instruction does not return a signalling NaN.
{ {
WasmRunner<double> r; WasmRunner<double> r;
...@@ -2622,7 +2622,7 @@ TEST(Run_Wasm_F64Min_Snan) { ...@@ -2622,7 +2622,7 @@ TEST(Run_Wasm_F64Min_Snan) {
} }
} }
TEST(Run_Wasm_F64Max_Snan) { WASM_EXEC_TEST(F64Max_Snan) {
// Test that the instruction does not return a signalling NaN. // Test that the instruction does not return a signalling NaN.
{ {
WasmRunner<double> r; WasmRunner<double> r;
...@@ -2640,7 +2640,7 @@ TEST(Run_Wasm_F64Max_Snan) { ...@@ -2640,7 +2640,7 @@ TEST(Run_Wasm_F64Max_Snan) {
#endif #endif
TEST(Run_Wasm_I32SConvertF32) { WASM_EXEC_TEST(I32SConvertF32) {
WasmRunner<int32_t> r(MachineType::Float32()); WasmRunner<int32_t> r(MachineType::Float32());
BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0)));
...@@ -2654,7 +2654,7 @@ TEST(Run_Wasm_I32SConvertF32) { ...@@ -2654,7 +2654,7 @@ TEST(Run_Wasm_I32SConvertF32) {
} }
} }
TEST(Run_Wasm_I32SConvertF64) { WASM_EXEC_TEST(I32SConvertF64) {
WasmRunner<int32_t> r(MachineType::Float64()); WasmRunner<int32_t> r(MachineType::Float64());
BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0)));
...@@ -2668,7 +2668,7 @@ TEST(Run_Wasm_I32SConvertF64) { ...@@ -2668,7 +2668,7 @@ TEST(Run_Wasm_I32SConvertF64) {
} }
} }
TEST(Run_Wasm_I32UConvertF32) { WASM_EXEC_TEST(I32UConvertF32) {
WasmRunner<uint32_t> r(MachineType::Float32()); WasmRunner<uint32_t> r(MachineType::Float32());
BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0)));
...@@ -2681,7 +2681,7 @@ TEST(Run_Wasm_I32UConvertF32) { ...@@ -2681,7 +2681,7 @@ TEST(Run_Wasm_I32UConvertF32) {
} }
} }
TEST(Run_Wasm_I32UConvertF64) { WASM_EXEC_TEST(I32UConvertF64) {
WasmRunner<uint32_t> r(MachineType::Float64()); WasmRunner<uint32_t> r(MachineType::Float64());
BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0))); BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0)));
...@@ -2694,7 +2694,7 @@ TEST(Run_Wasm_I32UConvertF64) { ...@@ -2694,7 +2694,7 @@ TEST(Run_Wasm_I32UConvertF64) {
} }
} }
TEST(Run_Wasm_F64CopySign) { WASM_EXEC_TEST(F64CopySign) {
WasmRunner<double> r(MachineType::Float64(), MachineType::Float64()); WasmRunner<double> r(MachineType::Float64(), MachineType::Float64());
BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2703,7 +2703,7 @@ TEST(Run_Wasm_F64CopySign) { ...@@ -2703,7 +2703,7 @@ TEST(Run_Wasm_F64CopySign) {
} }
} }
TEST(Run_Wasm_F32CopySign) { WASM_EXEC_TEST(F32CopySign) {
WasmRunner<float> r(MachineType::Float32(), MachineType::Float32()); WasmRunner<float> r(MachineType::Float32(), MachineType::Float32());
BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
...@@ -2751,7 +2751,7 @@ TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); } ...@@ -2751,7 +2751,7 @@ TEST(Compile_Wasm_CallIndirect_Many_f32) { CompileCallIndirectMany(kAstF32); }
TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); }
TEST(Run_WASM_Int32RemS_dead) { WASM_EXEC_TEST(Int32RemS_dead) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32()); WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO);
const int32_t kMin = std::numeric_limits<int32_t>::min(); const int32_t kMin = std::numeric_limits<int32_t>::min();
......
...@@ -658,6 +658,15 @@ class WasmRunner { ...@@ -658,6 +658,15 @@ class WasmRunner {
} }
}; };
// A macro to define tests that run in different engine configurations.
// Currently only supports compiled tests, but a future
// RunWasmInterpreted_##name version will allow each test to also run in the
// interpreter.
#define WASM_EXEC_TEST(name) \
void RunWasm_##name(); \
TEST(RunWasmCompiled_##name) { RunWasm_##name(); } \
void RunWasm_##name()
} // namespace } // namespace
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment