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

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

Issue 1928513002: Implement UnalignedLoad and UnalignedStore in WASM using LoadByte/Shift/Or and StoreByte/Shift/And. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Renamed UnalignedAccessConfig to AlignmentRequirements Created 4 years, 7 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
« test/cctest/wasm/test-run-wasm.cc ('K') | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | 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 395ae5cd1589115e1906aa791d327ba960b436d7..62c6f9c1b8d4928603ab0de9099710c62bbf1776 100644
--- a/test/cctest/wasm/test-run-wasm-64.cc
+++ b/test/cctest/wasm/test-run-wasm-64.cc
@@ -1247,6 +1247,28 @@ TEST(Run_Wasm_LoadMemI64) {
CHECK_EQ(77777777, r.Call());
}
+TEST(Run_Wasm_LoadMemI64_alignment) {
+ REQUIRE(I64LoadStore);
+ TestingModule module;
+ int64_t* memory = module.AddMemoryElems<int64_t>(8);
+ for (byte alignment = 0; alignment <= 3; alignment++) {
+ module.RandomizeMemory(1111);
+ WasmRunner<int64_t> r(&module);
+
+ BUILD(r,
+ WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_I8(0), alignment));
+
+ memory[0] = 0xaabbccdd00112233LL;
+ CHECK_EQ(0xaabbccdd00112233LL, r.Call());
+
+ memory[0] = 0x33aabbccdd001122LL;
+ CHECK_EQ(0x33aabbccdd001122LL, r.Call());
+
+ memory[0] = 77777777;
+ CHECK_EQ(77777777, r.Call());
+ }
+}
+
TEST(Run_Wasm_MemI64_Sum) {
REQUIRE(I64LoadStore);
REQUIRE(I64Add);
@@ -1283,6 +1305,23 @@ TEST(Run_Wasm_MemI64_Sum) {
}
}
+TEST(Run_Wasm_StoreMemI64_alignment) {
+ TestingModule module;
+ int64_t* memory = module.AddMemoryElems<int64_t>(4);
+ const int64_t kWritten = 0x12345678abcd0011ll;
+
+ for (byte i = 0; i <= 3; i++) {
+ WasmRunner<int64_t> r(&module, MachineType::Int64());
+ BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, i,
+ WASM_GET_LOCAL(0)));
+ module.RandomizeMemory(1111);
+ memory[0] = 0;
+
+ CHECK_EQ(kWritten, r.Call(kWritten));
+ CHECK_EQ(kWritten, memory[0]);
+ }
+}
+
TEST(Run_Wasm_I64Global) {
REQUIRE(I64LoadStore);
REQUIRE(I64SConvertI32);
« test/cctest/wasm/test-run-wasm.cc ('K') | « test/cctest/wasm/test-run-wasm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698