Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1142)

Unified Diff: test/cctest/wasm/test-run-wasm-64.cc

Issue 1843123002: [wasm] Int64Lowering of Word64Ror and Word64Rol. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Better code is generated now. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/compiler/value-helper.h ('k') | test/unittests/compiler/int64-lowering-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm-64.cc
diff --git a/test/cctest/wasm/test-run-wasm-64.cc b/test/cctest/wasm/test-run-wasm-64.cc
index 634c41ff38f3bd60556b49f83010ab2519d2790c..e8af47b0917c8dac4e7c7962c323808bf6f2c18b 100644
--- a/test/cctest/wasm/test-run-wasm-64.cc
+++ b/test/cctest/wasm/test-run-wasm-64.cc
@@ -6,6 +6,7 @@
#include <stdlib.h>
#include <string.h>
+#include "src/base/bits.h"
#include "src/wasm/wasm-macro-gen.h"
#include "test/cctest/cctest.h"
@@ -85,8 +86,8 @@
V(F64UConvertI64, true) \
V(F64ReinterpretI64, true) \
V(I64ReinterpretF64, true) \
- V(I64Ror, false) \
- V(I64Rol, false)
+ V(I64Ror, true) \
+ V(I64Rol, true)
#define DECLARE_CONST(name, cond) static const bool kSupported_##name = cond;
FOREACH_I64_OPERATOR(DECLARE_CONST)
@@ -317,11 +318,13 @@ TEST(Run_Wasm_I64Xor) {
TEST(Run_Wasm_I64Shl) {
REQUIRE(I64Shl);
{
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
FOR_UINT64_INPUTS(i) {
- for (int64_t j = 1; j < 64; j++) {
- CHECK_EQ(*i << j, r.Call(*i, j));
+ FOR_UINT64_INPUTS(j) {
+ uint64_t expected = (*i) << (*j & 0x3f);
+ CHECK_EQ(expected, r.Call(*i, *j));
}
}
}
@@ -350,11 +353,13 @@ TEST(Run_Wasm_I64Shl) {
TEST(Run_Wasm_I64ShrU) {
REQUIRE(I64ShrU);
{
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
FOR_UINT64_INPUTS(i) {
- for (int64_t j = 1; j < 64; j++) {
- CHECK_EQ(*i >> j, r.Call(*i, j));
+ FOR_UINT64_INPUTS(j) {
+ uint64_t expected = (*i) >> (*j & 0x3f);
+ CHECK_EQ(expected, r.Call(*i, *j));
}
}
}
@@ -385,9 +390,11 @@ TEST(Run_Wasm_I64ShrS) {
{
WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
FOR_INT64_INPUTS(i) {
- for (int64_t j = 1; j < 64; j++) {
- CHECK_EQ(*i >> j, r.Call(*i, j));
+ FOR_INT64_INPUTS(j) {
+ int64_t expected = (*i) >> (*j & 0x3f);
+ CHECK_EQ(expected, r.Call(*i, *j));
}
}
}
@@ -1314,7 +1321,7 @@ TEST(Run_Wasm_I64Global) {
}
}
-TEST(Run_WasmI64Eqz) {
+TEST(Run_Wasm_I64Eqz) {
REQUIRE(I64Eq);
WasmRunner<int32_t> r(MachineType::Int64());
@@ -1326,40 +1333,27 @@ TEST(Run_WasmI64Eqz) {
}
}
-TEST(Run_WasmI64Shl) {
- REQUIRE(I64Shl);
- WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
- BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+TEST(Run_Wasm_I64Ror) {
+ REQUIRE(I64Ror);
+ WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ BUILD(r, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- uint64_t expected = (*i) << (*j & 0x3f);
+ int64_t expected = bits::RotateRight64(*i, *j & 0x3f);
CHECK_EQ(expected, r.Call(*i, *j));
}
}
}
-TEST(Run_WasmI64Shr) {
- REQUIRE(I64ShrU);
- WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
- BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+TEST(Run_Wasm_I64Rol) {
+ REQUIRE(I64Rol);
+ WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- uint64_t expected = (*i) >> (*j & 0x3f);
- CHECK_EQ(expected, r.Call(*i, *j));
- }
- }
-}
-
-TEST(Run_WasmI64Sar) {
- REQUIRE(I64ShrS);
- WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
- BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
-
- FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) {
- int64_t expected = (*i) >> (*j & 0x3f);
+ int64_t expected = bits::RotateRight64(*i, 64 - (*j & 0x3f));
CHECK_EQ(expected, r.Call(*i, *j));
}
}
« no previous file with comments | « test/cctest/compiler/value-helper.h ('k') | test/unittests/compiler/int64-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698