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

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

Issue 1845443003: [wasm] Mask shift counts on architectures that don't implicitly mask. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « src/compiler/wasm-compiler.cc ('k') | test/mjsunit/wasm/asm-wasm-i32.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/wasm/test-run-wasm.cc
diff --git a/test/cctest/wasm/test-run-wasm.cc b/test/cctest/wasm/test-run-wasm.cc
index 617cec6a0f291f8c5ceb7e06ac3c976c03160a81..7de39a27d22075fd58774eca5bd1bfdfaa7f362e 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -324,6 +324,78 @@ TEST(Run_WasmI32Eqz) {
TestInt32Unop(kExprI32Eqz, 1, 0);
}
+TEST(Run_WasmI32Shl) {
+ WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
+ BUILD(r, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
+ FOR_UINT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (*i) << (*j & 0x1f);
+ CHECK_EQ(expected, r.Call(*i, *j));
+ }
+ }
+}
+
+TEST(Run_WasmI32Shr) {
+ WasmRunner<uint32_t> r(MachineType::Uint32(), MachineType::Uint32());
+ BUILD(r, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
+ FOR_UINT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (*i) >> (*j & 0x1f);
+ CHECK_EQ(expected, r.Call(*i, *j));
+ }
+ }
+}
+
+TEST(Run_WasmI32Sar) {
+ WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
+ BUILD(r, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
+ FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(j) {
+ int32_t expected = (*i) >> (*j & 0x1f);
+ CHECK_EQ(expected, r.Call(*i, *j));
+ }
+ }
+}
+
+TEST(Run_WasmI64Shl) {
ahaas 2016/03/30 12:00:08 This test should be in test-run-wasm-64.cc
titzer 2016/03/30 12:10:26 Done.
+ WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
+ BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
+ FOR_UINT64_INPUTS(i) {
+ FOR_UINT64_INPUTS(j) {
+ uint64_t expected = (*i) << (*j & 0x3f);
+ CHECK_EQ(expected, r.Call(*i, *j));
+ }
+ }
+}
+
+TEST(Run_WasmI64Shr) {
+ WasmRunner<uint64_t> r(MachineType::Uint64(), MachineType::Uint64());
ahaas 2016/03/30 12:00:08 same here.
titzer 2016/03/30 12:10:26 Done.
+ BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
+ FOR_UINT64_INPUTS(i) {
+ FOR_UINT64_INPUTS(j) {
+ uint64_t expected = (*i) >> (*j & 0x3f);
+ CHECK_EQ(expected, r.Call(*i, *j));
+ }
+ }
+}
+
+TEST(Run_WasmI64Sar) {
ahaas 2016/03/30 12:00:09 same here.
titzer 2016/03/30 12:10:26 Done.
+ WasmRunner<int64_t> r(MachineType::Int64(), MachineType::Int64());
+ BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ int64_t expected = (*i) >> (*j & 0x3f);
+ CHECK_EQ(expected, r.Call(*i, *j));
+ }
+ }
+}
+
TEST(Run_WASM_Int32DivS_trap) {
WasmRunner<int32_t> r(MachineType::Int32(), MachineType::Int32());
BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
« no previous file with comments | « src/compiler/wasm-compiler.cc ('k') | test/mjsunit/wasm/asm-wasm-i32.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698