[wasm][mips] Enable i64.mul tests

i64.mul is supported by all platforms, remove obsolete checks.

R=ahaas@chromium.org,sreten.kovacevic@mips.com

Change-Id: Ief64fd2a5bc53f09e6404259a3f9aeea2ad1ac6a
Reviewed-on: https://chromium-review.googlesource.com/964821
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Reviewed-by: Sreten Kovacevic <sreten.kovacevic@mips.com>
Commit-Queue: Clemens Hammacher <clemensh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51981}
This commit is contained in:
Clemens Hammacher 2018-03-15 20:43:56 +01:00 committed by Commit Bot
parent 516c25b412
commit e649b8bded

View File

@ -21,43 +21,6 @@ namespace internal {
namespace wasm {
namespace test_run_wasm_64 {
// If the target architecture is 64-bit, enable all tests.
#if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64
#define WASM_64 1
#else
#define WASM_64 0
#endif
// Can't bridge macro land with nested macros.
#if V8_TARGET_ARCH_MIPS
#define MIPS true
#else
#define MIPS false
#endif
namespace {
#define FOREACH_UNSUPPORTED_OPCODE(V) V(I64Mul, !WASM_64 && MIPS)
bool SupportsOpcode(WasmOpcode opcode) {
switch (opcode) {
#define CASE_TEST(name, unsupported_test) \
case kExpr##name: \
return !(unsupported_test);
FOREACH_UNSUPPORTED_OPCODE(CASE_TEST)
#undef CASE_TEST
default:
return true;
}
}
#undef FOREACH_UNSUPPORTED_OPCODE
} // namespace
#define REQUIRE(name) \
if (!SupportsOpcode(kExpr##name)) return
WASM_EXEC_TEST(I64Const) {
WasmRunner<int64_t> r(execution_mode);
const int64_t kExpectedValue = 0x1122334455667788LL;
@ -148,7 +111,6 @@ WASM_EXEC_TEST(I64SubUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64MulUseOnlyLowWord) {
REQUIRE(I64Mul);
WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
@ -971,67 +933,70 @@ void TestI64Cmp(WasmExecutionMode execution_mode, WasmOpcode opcode,
}
}
#define TEST_I64_BINOP(name, expected, a, b) \
do { \
if (SupportsOpcode(kExpr##name)) \
TestI64Binop(execution_mode, kExpr##name, expected, a, b); \
} while (false)
WASM_EXEC_TEST(I64Binops) {
TEST_I64_BINOP(I64Add, -5586332274295447011, 0x501B72EBABC26847,
0x625DE9793D8F79D6);
TEST_I64_BINOP(I64Sub, 9001903251710731490, 0xF24FE6474640002E,
0x7562B6F711991B4C);
TEST_I64_BINOP(I64Mul, -4569547818546064176, 0x231A263C2CBC6451,
0xEAD44DE6BD3E23D0);
TEST_I64_BINOP(I64Mul, -25963122347507043, 0x4DA1FA47C9352B73,
0x91FE82317AA035AF);
TEST_I64_BINOP(I64Mul, 7640290486138131960, 0x185731ABE8EEA47C,
0x714EC59F1380D4C2);
TEST_I64_BINOP(I64DivS, -91517, 0x93B1190A34DE56A0, 0x00004D8F68863948);
TEST_I64_BINOP(I64DivU, 149016, 0xE15B3727E8A2080A, 0x0000631BFA72DB8B);
TEST_I64_BINOP(I64RemS, -664128064149968, 0x9A78B4E4FE708692,
0x0003E0B6B3BE7609);
TEST_I64_BINOP(I64RemU, 1742040017332765, 0x0CE84708C6258C81,
0x000A6FDE82016697);
TEST_I64_BINOP(I64And, 2531040582801836054, 0xAF257D1602644A16,
0x33B290A91A10D997);
TEST_I64_BINOP(I64Ior, 8556201506536114940, 0x169D9BE7BD3F0A5C,
0x66BCA28D77AF40E8);
TEST_I64_BINOP(I64Xor, -4605655183785456377, 0xB6EA20A5D48E85B8,
0x76FF4DA6C80688BF);
TEST_I64_BINOP(I64Shl, -7240704056088331264, 0xEF4DC1ED030E8FFE, 9);
TEST_I64_BINOP(I64ShrU, 12500673744059159, 0xB1A52FA7DEEC5D14, 10);
TEST_I64_BINOP(I64ShrS, 1725103446999874, 0x3107C791461A112B, 11);
TEST_I64_BINOP(I64Ror, -8960135652432576946, 0x73418D1717E4E83A, 12);
TEST_I64_BINOP(I64Ror, 7617662827409989779, 0xEBFF67CF0C126D36, 13);
TEST_I64_BINOP(I64Rol, -2097714064174346012, 0x43938B8DB0B0F230, 14);
TEST_I64_BINOP(I64Rol, 8728493013947314237, 0xE07AF243AC4D219D, 15);
TestI64Binop(execution_mode, kExprI64Add, -5586332274295447011,
0x501B72EBABC26847, 0x625DE9793D8F79D6);
TestI64Binop(execution_mode, kExprI64Sub, 9001903251710731490,
0xF24FE6474640002E, 0x7562B6F711991B4C);
TestI64Binop(execution_mode, kExprI64Mul, -4569547818546064176,
0x231A263C2CBC6451, 0xEAD44DE6BD3E23D0);
TestI64Binop(execution_mode, kExprI64Mul, -25963122347507043,
0x4DA1FA47C9352B73, 0x91FE82317AA035AF);
TestI64Binop(execution_mode, kExprI64Mul, 7640290486138131960,
0x185731ABE8EEA47C, 0x714EC59F1380D4C2);
TestI64Binop(execution_mode, kExprI64DivS, -91517, 0x93B1190A34DE56A0,
0x00004D8F68863948);
TestI64Binop(execution_mode, kExprI64DivU, 149016, 0xE15B3727E8A2080A,
0x0000631BFA72DB8B);
TestI64Binop(execution_mode, kExprI64RemS, -664128064149968,
0x9A78B4E4FE708692, 0x0003E0B6B3BE7609);
TestI64Binop(execution_mode, kExprI64RemU, 1742040017332765,
0x0CE84708C6258C81, 0x000A6FDE82016697);
TestI64Binop(execution_mode, kExprI64And, 2531040582801836054,
0xAF257D1602644A16, 0x33B290A91A10D997);
TestI64Binop(execution_mode, kExprI64Ior, 8556201506536114940,
0x169D9BE7BD3F0A5C, 0x66BCA28D77AF40E8);
TestI64Binop(execution_mode, kExprI64Xor, -4605655183785456377,
0xB6EA20A5D48E85B8, 0x76FF4DA6C80688BF);
TestI64Binop(execution_mode, kExprI64Shl, -7240704056088331264,
0xEF4DC1ED030E8FFE, 9);
TestI64Binop(execution_mode, kExprI64ShrU, 12500673744059159,
0xB1A52FA7DEEC5D14, 10);
TestI64Binop(execution_mode, kExprI64ShrS, 1725103446999874,
0x3107C791461A112B, 11);
TestI64Binop(execution_mode, kExprI64Ror, -8960135652432576946,
0x73418D1717E4E83A, 12);
TestI64Binop(execution_mode, kExprI64Ror, 7617662827409989779,
0xEBFF67CF0C126D36, 13);
TestI64Binop(execution_mode, kExprI64Rol, -2097714064174346012,
0x43938B8DB0B0F230, 14);
TestI64Binop(execution_mode, kExprI64Rol, 8728493013947314237,
0xE07AF243AC4D219D, 15);
}
#undef TEST_I64_BINOP
#define TEST_I64_CMP(name, expected, a, b) \
do { \
if (SupportsOpcode(kExpr##name)) \
TestI64Cmp(execution_mode, kExpr##name, expected, a, b); \
} while (false)
WASM_EXEC_TEST(I64Compare) {
TEST_I64_CMP(I64Eq, 0, 0xB915D8FA494064F0, 0x04D700B2536019A3);
TEST_I64_CMP(I64Ne, 1, 0xC2FAFAAAB0446CDC, 0x52A3328F780C97A3);
TEST_I64_CMP(I64LtS, 0, 0x673636E6306B0578, 0x028EC9ECA78F7227);
TEST_I64_CMP(I64LeS, 1, 0xAE5214114B86A0FA, 0x7C1D21DA3DFD0CCF);
TEST_I64_CMP(I64LtU, 0, 0x7D52166381EC1CE0, 0x59F4A6A9E78CD3D8);
TEST_I64_CMP(I64LeU, 1, 0xE4169A385C7EA0E0, 0xFBDBED2C8781E5BC);
TEST_I64_CMP(I64GtS, 0, 0x9D08FF8FB5F42E81, 0xD4E5C9D7FE09F621);
TEST_I64_CMP(I64GeS, 1, 0x78DA3B2F73264E0F, 0x6FE5E2A67C501CBE);
TEST_I64_CMP(I64GtU, 0, 0x8F691284E44F7DA9, 0xD5EA9BC1EE149192);
TEST_I64_CMP(I64GeU, 0, 0x0886A0C58C7AA224, 0x5DDBE5A81FD7EE47);
TestI64Cmp(execution_mode, kExprI64Eq, 0, 0xB915D8FA494064F0,
0x04D700B2536019A3);
TestI64Cmp(execution_mode, kExprI64Ne, 1, 0xC2FAFAAAB0446CDC,
0x52A3328F780C97A3);
TestI64Cmp(execution_mode, kExprI64LtS, 0, 0x673636E6306B0578,
0x028EC9ECA78F7227);
TestI64Cmp(execution_mode, kExprI64LeS, 1, 0xAE5214114B86A0FA,
0x7C1D21DA3DFD0CCF);
TestI64Cmp(execution_mode, kExprI64LtU, 0, 0x7D52166381EC1CE0,
0x59F4A6A9E78CD3D8);
TestI64Cmp(execution_mode, kExprI64LeU, 1, 0xE4169A385C7EA0E0,
0xFBDBED2C8781E5BC);
TestI64Cmp(execution_mode, kExprI64GtS, 0, 0x9D08FF8FB5F42E81,
0xD4E5C9D7FE09F621);
TestI64Cmp(execution_mode, kExprI64GeS, 1, 0x78DA3B2F73264E0F,
0x6FE5E2A67C501CBE);
TestI64Cmp(execution_mode, kExprI64GtU, 0, 0x8F691284E44F7DA9,
0xD5EA9BC1EE149192);
TestI64Cmp(execution_mode, kExprI64GeU, 0, 0x0886A0C58C7AA224,
0x5DDBE5A81FD7EE47);
}
#undef TEST_I64_CMP
WASM_EXEC_TEST(I64Clz) {
struct {
int64_t expected;
@ -1641,9 +1606,6 @@ WASM_EXEC_TEST(Regression_6858) {
CHECK_TRAP64(r.Call(dividend, divisor, filler, filler));
}
#undef WASM_64
#undef MIPS
#undef REQUIRE
#undef ADD_CODE
// clang-format gets confused about these closing parentheses (wants to change