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); |