summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/lit/passes/memory64-lowering.wast283
-rw-r--r--test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.txt221
-rw-r--r--test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.wast43
3 files changed, 283 insertions, 264 deletions
diff --git a/test/lit/passes/memory64-lowering.wast b/test/lit/passes/memory64-lowering.wast
new file mode 100644
index 000000000..ced069401
--- /dev/null
+++ b/test/lit/passes/memory64-lowering.wast
@@ -0,0 +1,283 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+
+;; RUN: foreach %s %t wasm-opt --memory64-lowering --enable-memory64 --enable-threads --enable-bulk-memory -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (type $0 (func))
+
+ ;; CHECK: (import "env" "__memory_base" (global $__memory_base i64))
+ (import "env" "__memory_base" (global $__memory_base i64))
+ ;; CHECK: (import "env" "__memory_base32" (global $__memory_base32 i32))
+
+ ;; CHECK: (memory $0 1 1)
+ (memory $0 i64 1 1)
+ (data (i64.const 0) "\00\00\00\00\00\00\00\00\00\00")
+ (data (global.get $__memory_base) "foo")
+ ;; CHECK: (data $0 (i32.const 0) "\00\00\00\00\00\00\00\00\00\00")
+
+ ;; CHECK: (data $1 (global.get $__memory_base32) "foo")
+
+ ;; CHECK: (func $load
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load align=1
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load align=2
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load offset=100
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load offset=100 align=1
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load offset=100 align=2
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load offset=100
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.load offset=100 align=1
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $load
+ (drop (i32.load (i64.const 4)))
+ (drop (i32.load align=1 (i64.const 4)))
+ (drop (i32.load align=2 (i64.const 4)))
+ (drop (i32.load align=4 (i64.const 4)))
+ (drop (i32.load offset=100 (i64.const 4)))
+ (drop (i32.load offset=100 align=1 (i64.const 4)))
+ (drop (i32.load offset=100 align=2 (i64.const 4)))
+ (drop (i32.load offset=100 align=4 (i64.const 4)))
+ (drop (i32.load offset=100 align=1 (unreachable)))
+ )
+
+ ;; CHECK: (func $store
+ ;; CHECK-NEXT: (i32.store
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store align=1
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store align=2
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store offset=100
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store offset=100 align=1
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store offset=100 align=2
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store offset=100
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store offset=100 align=1
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.store offset=100 align=1
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (unreachable)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $store
+ (i32.store (i64.const 4) (i32.const 8))
+ (i32.store align=1 (i64.const 4) (i32.const 8))
+ (i32.store align=2 (i64.const 4) (i32.const 8))
+ (i32.store align=4 (i64.const 4) (i32.const 8))
+ (i32.store offset=100 (i64.const 4) (i32.const 8))
+ (i32.store offset=100 align=1 (i64.const 4) (i32.const 8))
+ (i32.store offset=100 align=2 (i64.const 4) (i32.const 8))
+ (i32.store offset=100 align=4 (i64.const 4) (i32.const 8))
+ (i32.store offset=100 align=1 (unreachable) (i32.const 8))
+ (i32.store offset=100 align=1 (i64.const 4) (unreachable))
+ )
+
+ ;; CHECK: (func $atomics
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.atomic.load
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.atomic.store
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 4)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 8)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.atomic.rmw8.add_u
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 2)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (i32.atomic.rmw8.cmpxchg_u
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 2)
+ ;; CHECK-NEXT: (i32.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (memory.atomic.wait32
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 2)
+ ;; CHECK-NEXT: (i64.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (drop
+ ;; CHECK-NEXT: (memory.atomic.notify
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 2)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $atomics
+ (drop (i32.atomic.load (i64.const 4)))
+ (i32.atomic.store (i64.const 4) (i32.const 8))
+ (drop (i32.atomic.rmw8.add_u (i64.const 1) (i32.const 2)))
+ (drop (i32.atomic.rmw8.cmpxchg_u (i64.const 1) (i32.const 2) (i32.const 3)))
+ (drop (memory.atomic.wait32 (i64.const 1) (i32.const 2) (i64.const 3)))
+ (drop (memory.atomic.notify (i64.const 1) (i32.const 2)))
+ )
+
+ ;; CHECK: (func $other
+ ;; CHECK-NEXT: (local $0 i64)
+ ;; CHECK-NEXT: (local.set $0
+ ;; CHECK-NEXT: (i64.extend_i32_u
+ ;; CHECK-NEXT: (memory.size)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (local.set $0
+ ;; CHECK-NEXT: (i64.extend_i32_u
+ ;; CHECK-NEXT: (memory.grow
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (memory.init $0
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 2)
+ ;; CHECK-NEXT: (i32.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (memory.fill
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.const 2)
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (memory.copy
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 1)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 2)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: (i32.wrap_i64
+ ;; CHECK-NEXT: (i64.const 3)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $other
+ (local i64)
+ (local.set 0 (memory.size))
+ (local.set 0 (memory.grow (i64.const 1)))
+ (memory.init 0 (i64.const 1) (i32.const 2) (i32.const 3))
+ (memory.fill (i64.const 1) (i32.const 2) (i64.const 3))
+ (memory.copy (i64.const 1) (i64.const 2) (i64.const 3))
+ )
+)
+
+(module
+ ;; CHECK: (memory $0 1 65536)
+ (memory $0 i64 1 65537)
+)
diff --git a/test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.txt b/test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.txt
deleted file mode 100644
index 122c7e889..000000000
--- a/test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.txt
+++ /dev/null
@@ -1,221 +0,0 @@
-(module
- (type $0 (func))
- (import "env" "__memory_base" (global $__memory_base i64))
- (import "env" "__memory_base32" (global $__memory_base32 i32))
- (memory $0 1 1)
- (data $0 (i32.const 0) "\00\00\00\00\00\00\00\00\00\00")
- (data $1 (global.get $__memory_base32) "foo")
- (func $func_1
- (local $0 i64)
- (drop
- (i32.load
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (drop
- (i32.load align=1
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (drop
- (i32.load align=2
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (drop
- (i32.load
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (drop
- (i32.load offset=100
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (drop
- (i32.load offset=100 align=1
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (drop
- (i32.load offset=100 align=2
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (drop
- (i32.load offset=100
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (drop
- (i32.load offset=100 align=1
- (unreachable)
- )
- )
- (i32.store
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (i32.store align=1
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (i32.store align=2
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (i32.store
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (i32.store offset=100
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (i32.store offset=100 align=1
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (i32.store offset=100 align=2
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (i32.store offset=100
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (i32.store offset=100 align=1
- (unreachable)
- (i32.const 8)
- )
- (i32.store offset=100 align=1
- (i32.wrap_i64
- (i64.const 4)
- )
- (unreachable)
- )
- (local.set $0
- (i64.extend_i32_u
- (memory.size)
- )
- )
- (local.set $0
- (i64.extend_i32_u
- (memory.grow
- (i32.wrap_i64
- (i64.const 1)
- )
- )
- )
- )
- (memory.init $0
- (i32.wrap_i64
- (i64.const 1)
- )
- (i32.const 2)
- (i32.const 3)
- )
- (memory.fill
- (i32.wrap_i64
- (i64.const 1)
- )
- (i32.const 2)
- (i32.wrap_i64
- (i64.const 3)
- )
- )
- (memory.copy
- (i32.wrap_i64
- (i64.const 1)
- )
- (i32.wrap_i64
- (i64.const 2)
- )
- (i32.wrap_i64
- (i64.const 3)
- )
- )
- (drop
- (i32.atomic.load
- (i32.wrap_i64
- (i64.const 4)
- )
- )
- )
- (i32.atomic.store
- (i32.wrap_i64
- (i64.const 4)
- )
- (i32.const 8)
- )
- (drop
- (i32.atomic.rmw8.add_u
- (i32.wrap_i64
- (i64.const 1)
- )
- (i32.const 2)
- )
- )
- (drop
- (i32.atomic.rmw8.cmpxchg_u
- (i32.wrap_i64
- (i64.const 1)
- )
- (i32.const 2)
- (i32.const 3)
- )
- )
- (drop
- (memory.atomic.wait32
- (i32.wrap_i64
- (i64.const 1)
- )
- (i32.const 2)
- (i64.const 3)
- )
- )
- (drop
- (memory.atomic.notify
- (i32.wrap_i64
- (i64.const 1)
- )
- (i32.const 2)
- )
- )
- )
-)
-(module
- (memory $0 1 65536)
-)
diff --git a/test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.wast b/test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.wast
deleted file mode 100644
index 7cb89599f..000000000
--- a/test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.wast
+++ /dev/null
@@ -1,43 +0,0 @@
-(module
- (import "env" "__memory_base" (global $__memory_base i64))
- (memory $0 i64 1 1)
- (data (i64.const 0) "\00\00\00\00\00\00\00\00\00\00")
- (data (global.get $__memory_base) "foo")
- (func $func_1
- (local i64)
- (drop (i32.load (i64.const 4)))
- (drop (i32.load align=1 (i64.const 4)))
- (drop (i32.load align=2 (i64.const 4)))
- (drop (i32.load align=4 (i64.const 4)))
- (drop (i32.load offset=100 (i64.const 4)))
- (drop (i32.load offset=100 align=1 (i64.const 4)))
- (drop (i32.load offset=100 align=2 (i64.const 4)))
- (drop (i32.load offset=100 align=4 (i64.const 4)))
- (drop (i32.load offset=100 align=1 (unreachable)))
- (i32.store (i64.const 4) (i32.const 8))
- (i32.store align=1 (i64.const 4) (i32.const 8))
- (i32.store align=2 (i64.const 4) (i32.const 8))
- (i32.store align=4 (i64.const 4) (i32.const 8))
- (i32.store offset=100 (i64.const 4) (i32.const 8))
- (i32.store offset=100 align=1 (i64.const 4) (i32.const 8))
- (i32.store offset=100 align=2 (i64.const 4) (i32.const 8))
- (i32.store offset=100 align=4 (i64.const 4) (i32.const 8))
- (i32.store offset=100 align=1 (unreachable) (i32.const 8))
- (i32.store offset=100 align=1 (i64.const 4) (unreachable))
- (local.set 0 (memory.size))
- (local.set 0 (memory.grow (i64.const 1)))
- (memory.init 0 (i64.const 1) (i32.const 2) (i32.const 3))
- (memory.fill (i64.const 1) (i32.const 2) (i64.const 3))
- (memory.copy (i64.const 1) (i64.const 2) (i64.const 3))
- (drop (i32.atomic.load (i64.const 4)))
- (i32.atomic.store (i64.const 4) (i32.const 8))
- (drop (i32.atomic.rmw8.add_u (i64.const 1) (i32.const 2)))
- (drop (i32.atomic.rmw8.cmpxchg_u (i64.const 1) (i32.const 2) (i32.const 3)))
- (drop (memory.atomic.wait32 (i64.const 1) (i32.const 2) (i64.const 3)))
- (drop (memory.atomic.notify (i64.const 1) (i32.const 2)))
- )
-)
-
-(module
- (memory $0 i64 1 65537)
-)