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

Unified Diff: test/cctest/wasm/test-run-wasm.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
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 3b7af54ca0901fe4d56823acb5321d171c4c961f..690bf023b5a11561142cd3457d69fdd328e15caa 100644
--- a/test/cctest/wasm/test-run-wasm.cc
+++ b/test/cctest/wasm/test-run-wasm.cc
@@ -1304,6 +1304,26 @@ TEST(Run_Wasm_LoadMemI32) {
CHECK_EQ(77777777, r.Call(0));
}
+TEST(Run_Wasm_LoadMemI32_alignment) {
titzer 2016/05/11 15:22:35 Can you move this into test-run-load-store.cc?
ivica.bogosavljevic 2016/05/12 12:09:55 This test cannot be moved to test-run-load-store.c
titzer 2016/05/17 11:57:39 Acknowledged.
+ TestingModule module;
+ int32_t* memory = module.AddMemoryElems<int32_t>(8);
+ for (byte alignment = 0; alignment <= 2; alignment++) {
+ WasmRunner<int32_t> r(&module, MachineType::Int32());
+ module.RandomizeMemory(1111);
+
+ BUILD(r,
+ WASM_LOAD_MEM_ALIGNMENT(MachineType::Int32(), WASM_I8(0), alignment));
+
+ memory[0] = 0x1a2b3c4d;
+ CHECK_EQ(0x1a2b3c4d, r.Call(0));
+
+ memory[0] = 0x5e6f7a8b;
+ CHECK_EQ(0x5e6f7a8b, r.Call(0));
+
+ memory[0] = 0x9ca0b1c2;
+ CHECK_EQ(0x9ca0b1c2, r.Call(0));
+ }
+}
TEST(Run_Wasm_LoadMemI32_oob) {
TestingModule module;
@@ -1400,8 +1420,6 @@ TEST(Run_Wasm_LoadMemI32_offset) {
}
-#if !V8_TARGET_ARCH_MIPS && !V8_TARGET_ARCH_MIPS64
-
TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) {
const int kMemSize = 12;
// TODO(titzer): Fix misaligned accesses on MIPS and re-enable.
@@ -1425,8 +1443,6 @@ TEST(Run_Wasm_LoadMemI32_const_oob_misaligned) {
}
}
-#endif
-
TEST(Run_Wasm_LoadMemI32_const_oob) {
const int kMemSize = 24;
@@ -1450,6 +1466,22 @@ TEST(Run_Wasm_LoadMemI32_const_oob) {
}
}
+TEST(Run_Wasm_StoreMemI32_alignment) {
+ TestingModule module;
+ int32_t* memory = module.AddMemoryElems<int32_t>(4);
+ const int32_t kWritten = 0x12345678;
+
+ for (byte i = 0; i <= 2; i++) {
+ WasmRunner<int32_t> r(&module, MachineType::Int32());
+ BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), 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_StoreMemI32_offset) {
TestingModule module;

Powered by Google App Engine
This is Rietveld 408576698