diff options
author | Ashley Nelson <nashley@google.com> | 2022-08-17 18:44:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-17 18:44:29 -0700 |
commit | 3aff4c6e85623c970280219c6699a66bc9de5f9b (patch) | |
tree | e5440bc966e523a7404ae2cec3458dacbe1281d1 /test/lit | |
parent | b70fe755aa4c90727edfd91dc0a9a51febf0239d (diff) | |
download | binaryen-3aff4c6e85623c970280219c6699a66bc9de5f9b.tar.gz binaryen-3aff4c6e85623c970280219c6699a66bc9de5f9b.tar.bz2 binaryen-3aff4c6e85623c970280219c6699a66bc9de5f9b.zip |
Mutli-Memories Support in IR (#4811)
This PR removes the single memory restriction in IR, adding support for a single module to reference multiple memories. To support this change, a new memory name field was added to 13 memory instructions in order to identify the memory for the instruction.
It is a goal of this PR to maintain backwards compatibility with existing text and binary wasm modules, so memory indexes remain optional for memory instructions. Similarly, the JS API makes assumptions about which memory is intended when only one memory is present in the module. Another goal of this PR is that existing tests behavior be unaffected. That said, tests must now explicitly define a memory before invoking memory instructions or exporting a memory, and memory names are now printed for each memory instruction in the text format.
There remain quite a few places where a hardcoded reference to the first memory persist (memory flattening, for example, will return early if more than one memory is present in the module). Many of these call-sites, particularly within passes, will require us to rethink how the optimization works in a multi-memories world. Other call-sites may necessitate more invasive code restructuring to fully convert away from relying on a globally available, single memory pointer.
Diffstat (limited to 'test/lit')
-rw-r--r-- | test/lit/multi-memories-atomics64.wast | 704 | ||||
-rw-r--r-- | test/lit/multi-memories-basics.wast | 175 | ||||
-rw-r--r-- | test/lit/multi-memories-simd.wast | 635 | ||||
-rw-r--r-- | test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast | 4 | ||||
-rw-r--r-- | test/lit/passes/O4_disable-bulk-memory.wast | 4 | ||||
-rw-r--r-- | test/lit/wasm-split/export-name-already-exists.wast | 1 | ||||
-rw-r--r-- | test/lit/wasm-split/instrument-in-memory.wast | 1 | ||||
-rw-r--r-- | test/lit/wasm-split/merge-profiles.wast | 1 | ||||
-rw-r--r-- | test/lit/wasm-split/mismatched-hashes.wast | 1 |
9 files changed, 1522 insertions, 4 deletions
diff --git a/test/lit/multi-memories-atomics64.wast b/test/lit/multi-memories-atomics64.wast new file mode 100644 index 000000000..15941b12a --- /dev/null +++ b/test/lit/multi-memories-atomics64.wast @@ -0,0 +1,704 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-as %s -all -g -o %t.wasm +;; RUN: wasm-dis %t.wasm -o - | filecheck %s + +(module + ;; CHECK: (type $0 (func)) + (type $0 (func)) + ;; CHECK: (memory $appMemory (shared i64 23 256)) + (memory $appMemory (shared i64 23 256)) + ;; CHECK: (memory $dataMemory (shared i64 23 256)) + (memory $dataMemory (shared i64 23 256)) + ;; CHECK: (memory $instrumentMemory (shared i64 23 256)) + (memory $instrumentMemory (shared i64 23 256)) + ;; CHECK: (func $atomic-loadstore + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (local $1 i64) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load8_u $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load8_u $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load16_u $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load16_u $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.load $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load8_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load8_u $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load16_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load16_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load32_u $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load32_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.load $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store8 $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store8 $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store16 $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.atomic.store16 $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store8 $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store8 $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store16 $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store16 $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store32 $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i64.atomic.store32 $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $atomic-loadstore (type $0) + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.load8_u 0 offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load8_u $appMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load16_u 1 offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load16_u $instrumentMemory offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load 1 offset=4 + (local.get $0) + ) + ) + (drop + (i32.atomic.load $appMemory offset=4 + (local.get $0) + ) + ) + (drop + (i64.atomic.load8_u + (local.get $0) + ) + ) + (drop + (i64.atomic.load8_u $dataMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load16_u + (local.get $0) + ) + ) + (drop + (i64.atomic.load16_u $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load32_u 2 + (local.get $0) + ) + ) + (drop + (i64.atomic.load32_u $appMemory + (local.get $0) + ) + ) + (drop + (i64.atomic.load + (local.get $0) + ) + ) + (drop + (i64.atomic.load $instrumentMemory + (local.get $0) + ) + ) + (i32.atomic.store 0 offset=4 align=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store $appMemory offset=4 align=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store8 2 offset=4 align=1 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store8 $dataMemory offset=4 align=1 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store16 0 offset=4 + (local.get $0) + (local.get $2) + ) + (i32.atomic.store16 $dataMemory offset=4 + (local.get $0) + (local.get $2) + ) + (i64.atomic.store offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store $appMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store8 1 offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store8 $instrumentMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store16 offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store16 $appMemory offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store32 2 offset=4 + (local.get $0) + (local.get $1) + ) + (i64.atomic.store32 $dataMemory offset=4 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $atomic-rmw + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (local $1 i64) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw.add $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw.add $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.add_u $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.add_u $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw16.and_u $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw16.and_u $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw32.or_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw32.or_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.xchg_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.xchg_u $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $atomic-rmw (type $0) + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.rmw.add $dataMemory offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw.add 2 offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.add_u 0 offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.add_u $appMemory offset=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw16.and_u 1 align=2 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw16.and_u $instrumentMemory align=2 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i64.atomic.rmw32.or_u 0 + (local.get $0) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.or_u $appMemory + (local.get $0) + (local.get $1) + ) + ) + (drop + (i32.atomic.rmw8.xchg_u 0 align=1 + (local.get $0) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.xchg_u $dataMemory align=1 + (local.get $0) + (local.get $2) + ) + ) + ) + ;; CHECK: (func $atomic-cmpxchg + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (local $1 i64) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw.cmpxchg $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw.cmpxchg $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.cmpxchg_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.atomic.rmw8.cmpxchg_u $appMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw.cmpxchg $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw.cmpxchg $dataMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw32.cmpxchg_u $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i64.atomic.rmw32.cmpxchg_u $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $atomic-cmpxchg (type $0) + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (i32.atomic.rmw.cmpxchg 0 offset=4 + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw.cmpxchg $instrumentMemory offset=4 + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.cmpxchg_u + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i32.atomic.rmw8.cmpxchg_u $appMemory + (local.get $0) + (local.get $2) + (local.get $2) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg offset=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw.cmpxchg $dataMemory offset=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.cmpxchg_u 2 align=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (i64.atomic.rmw32.cmpxchg_u $dataMemory align=4 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + ) + ;; CHECK: (func $atomic-wait-notify + ;; CHECK-NEXT: (local $0 i64) + ;; CHECK-NEXT: (local $1 i64) + ;; CHECK-NEXT: (local $2 i32) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait32 $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait32 $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait32 $appMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait32 $instrumentMemory offset=4 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.notify $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.notify $dataMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.notify $appMemory offset=24 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.notify $dataMemory offset=24 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait64 $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait64 $instrumentMemory + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait64 $appMemory offset=16 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (memory.atomic.wait64 $appMemory offset=16 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $atomic-wait-notify (type $0) + (local $0 i64) + (local $1 i64) + (local $2 i32) + (drop + (memory.atomic.wait32 $dataMemory + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 2 + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 $appMemory offset=4 align=4 + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait32 2 offset=4 align=4 + (local.get $0) + (local.get $2) + (local.get $1) + ) + ) + (drop + (memory.atomic.notify 1 + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify $dataMemory + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify $appMemory offset=24 align=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.notify 1 offset=24 align=4 + (local.get $0) + (local.get $2) + ) + ) + (drop + (memory.atomic.wait64 $instrumentMemory + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 2 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 $appMemory align=8 offset=16 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + (drop + (memory.atomic.wait64 0 align=8 offset=16 + (local.get $0) + (local.get $1) + (local.get $1) + ) + ) + ) + ;; CHECK: (func $atomic-fence + ;; CHECK-NEXT: (atomic.fence) + ;; CHECK-NEXT: ) + (func $atomic-fence (type $0) + (atomic.fence) + ) +) diff --git a/test/lit/multi-memories-basics.wast b/test/lit/multi-memories-basics.wast new file mode 100644 index 000000000..42b60915b --- /dev/null +++ b/test/lit/multi-memories-basics.wast @@ -0,0 +1,175 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-as %s -all -g -o %t.wasm +;; RUN: wasm-dis %t.wasm -o - | filecheck %s + +(module + ;; CHECK: (import "env" "memory" (memory $importedMemory 1 1)) + + ;; CHECK: (memory $memory1 1 500) + (memory $memory1 1 500) + ;; CHECK: (memory $memory2 1 800) + (memory $memory2 1 800) + ;; CHECK: (memory $memory3 1 400) + (memory $memory3 1 400) + (data (memory $memory1) (i32.const 0) "a" "" "bcd") + (import "env" "memory" (memory $importedMemory 1 1)) + ;; CHECK: (data (i32.const 0) "abcd") + + ;; CHECK: (func $memory.fill + ;; CHECK-NEXT: (memory.fill $memory2 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i32.const 1) + ;; CHECK-NEXT: (i32.const 2) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $memory.fill + (memory.fill 1 + (i32.const 0) + (i32.const 1) + (i32.const 2) + ) + ) + ;; CHECK: (func $memory.copy + ;; CHECK-NEXT: (memory.copy $memory2 $memory3 + ;; CHECK-NEXT: (i32.const 512) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $memory.copy + (memory.copy 1 2 + (i32.const 512) + (i32.const 0) + (i32.const 12) + ) + ) + ;; CHECK: (func $memory.init + ;; CHECK-NEXT: (memory.init $memory1 0 + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i32.const 0) + ;; CHECK-NEXT: (i32.const 45) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $memory.init + (memory.init 0 0 + (i32.const 0) + (i32.const 0) + (i32.const 45) + ) + ) + ;; CHECK: (func $memory.grow (result i32) + ;; CHECK-NEXT: (memory.grow $memory3 + ;; CHECK-NEXT: (i32.const 10) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $memory.grow (result i32) + (memory.grow 2 + (i32.const 10) + ) + ) + ;; CHECK: (func $memory.size (result i32) + ;; CHECK-NEXT: (memory.size $memory3) + ;; CHECK-NEXT: ) + (func $memory.size (result i32) + (memory.size 2) + ) + ;; CHECK: (func $loads + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load $memory3 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load16_s $memory2 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load16_s $memory2 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load8_s $memory3 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load8_s $memory3 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load16_u $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load16_u $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load8_u $memory2 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (drop + ;; CHECK-NEXT: (i32.load8_u $memory2 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $loads + (drop (i32.load 0 (i32.const 12))) + (drop (i32.load $memory3 (i32.const 12))) + (drop (i32.load16_s 1 (i32.const 12))) + (drop (i32.load16_s $memory2 (i32.const 12))) + (drop (i32.load8_s 2 (i32.const 12))) + (drop (i32.load8_s $memory3 (i32.const 12))) + (drop (i32.load16_u 0 (i32.const 12))) + (drop (i32.load16_u $memory1 (i32.const 12))) + (drop (i32.load8_u 1 (i32.const 12))) + (drop (i32.load8_u $memory2 (i32.const 12))) + ) + ;; CHECK: (func $stores + ;; CHECK-NEXT: (i32.store $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: (i32.const 115) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store $memory1 + ;; CHECK-NEXT: (i32.const 12) + ;; CHECK-NEXT: (i32.const 115) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store16 $memory2 + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: (i32.const 31353) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store16 $importedMemory + ;; CHECK-NEXT: (i32.const 20) + ;; CHECK-NEXT: (i32.const 31353) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 $memory3 + ;; CHECK-NEXT: (i32.const 23) + ;; CHECK-NEXT: (i32.const 120) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: (i32.store8 $memory3 + ;; CHECK-NEXT: (i32.const 23) + ;; CHECK-NEXT: (i32.const 120) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $stores + (i32.store 0 (i32.const 12) (i32.const 115)) + (i32.store $memory1 (i32.const 12) (i32.const 115)) + (i32.store16 1 (i32.const 20) (i32.const 31353)) + (i32.store16 $importedMemory (i32.const 20) (i32.const 31353)) + (i32.store8 2 (i32.const 23) (i32.const 120)) + (i32.store8 $memory3 (i32.const 23) (i32.const 120)) + ) +) + diff --git a/test/lit/multi-memories-simd.wast b/test/lit/multi-memories-simd.wast new file mode 100644 index 000000000..184d98876 --- /dev/null +++ b/test/lit/multi-memories-simd.wast @@ -0,0 +1,635 @@ +;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited. +;; RUN: wasm-as %s -all -g -o %t.wasm +;; RUN: wasm-dis %t.wasm -o - | filecheck %s + +(module + ;; CHECK: (memory $memorya 1 1) + (memory $memorya 1 1) + ;; CHECK: (memory $memoryb 1 1) + (memory $memoryb 1 1) + ;; CHECK: (memory $memoryc 1 1) + (memory $memoryc 1 1) + ;; CHECK: (memory $memoryd 1 1) + (memory $memoryd 1 1) + ;; CHECK: (func $v128.load (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load (param $0 i32) (result v128) + (v128.load offset=0 align=16 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load2 (param $0 i32) (result v128) + (v128.load $memoryb offset=0 align=16 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8x8_s (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8x8_s $memoryc + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8x8_s (param $0 i32) (result v128) + (v128.load8x8_s 2 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8x8_s2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8x8_s $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8x8_s2 (param $0 i32) (result v128) + (v128.load8x8_s 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8x8_u (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8x8_u $memoryd + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8x8_u (param $0 i32) (result v128) + (v128.load8x8_u 3 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8x8_u2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8x8_u $memoryd + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8x8_u2 (param $0 i32) (result v128) + (v128.load8x8_u $memoryd + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16x4_s (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16x4_s $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16x4_s (param $0 i32) (result v128) + (v128.load16x4_s 0 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16x4_s2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16x4_s $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16x4_s2 (param $0 i32) (result v128) + (v128.load16x4_s $memoryb + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16x4_u (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16x4_u $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16x4_u (param $0 i32) (result v128) + (v128.load16x4_u 0 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16x4_u2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16x4_u $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16x4_u2 (param $0 i32) (result v128) + (v128.load16x4_u $memorya + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32x2_s (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32x2_s $memoryc + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32x2_s (param $0 i32) (result v128) + (v128.load32x2_s 2 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32x2_s2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32x2_s $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32x2_s2 (param $0 i32) (result v128) + (v128.load32x2_s $memoryb + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32x2_u (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32x2_u $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32x2_u (param $0 i32) (result v128) + (v128.load32x2_u 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32x2_u2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32x2_u $memoryc + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32x2_u2 (param $0 i32) (result v128) + (v128.load32x2_u $memoryc + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8_splat (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8_splat $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8_splat (param $0 i32) (result v128) + (v128.load8_splat 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load8_splat2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load8_splat $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8_splat2 (param $0 i32) (result v128) + (v128.load8_splat $memoryb + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16_splat (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16_splat $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16_splat (param $0 i32) (result v128) + (v128.load16_splat $memorya + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load16_splat2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load16_splat $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16_splat2 (param $0 i32) (result v128) + (v128.load16_splat 0 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32_splat (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32_splat $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_splat (param $0 i32) (result v128) + (v128.load32_splat 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32_splat2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32_splat $memoryd + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_splat2 (param $0 i32) (result v128) + (v128.load32_splat $memoryd + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load64_splat (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load64_splat $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_splat (param $0 i32) (result v128) + (v128.load64_splat 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load64_splat2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load64_splat $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_splat2 (param $0 i32) (result v128) + (v128.load64_splat $memorya + (local.get $0) + ) + ) + ;; CHECK: (func $v128.store (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store (param $0 i32) (param $1 v128) + (v128.store 0 offset=0 align=16 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store2 (param $0 i32) (param $1 v128) + (v128.store 1 offset=0 align=16 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load8_lane (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load8_lane $memorya 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load8_lane 0 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load8_lane2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load8_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load8_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load8_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load16_lane (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load16_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load16_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load16_lane2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load16_lane $memoryd 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load16_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load16_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load32_lane (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load32_lane $memorya 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load32_lane $memorya 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load32_lane2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load32_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load32_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryd 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_align (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memorya align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_align (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane 0 align=1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_align2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryb align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_align2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryb align=1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_offset (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryc offset=32 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_offset (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane 2 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_offset2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryb offset=32 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_offset2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryb offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_align_offset (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memorya offset=32 align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_align_offset (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane align=1 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load64_lane_align_offset2 (param $0 i32) (param $1 v128) (result v128) + ;; CHECK-NEXT: (v128.load64_lane $memoryd offset=32 align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_lane_align_offset2 (param $0 i32) (param $1 v128) (result v128) + (v128.load64_lane $memoryd align=1 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store8_lane (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store8_lane $memorya 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store8_lane (param $0 i32) (param $1 v128) + (v128.store8_lane 0 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store8_lane2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store8_lane $memoryd 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store8_lane2 (param $0 i32) (param $1 v128) + (v128.store8_lane $memoryd 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store16_lane (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store16_lane $memorya 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store16_lane (param $0 i32) (param $1 v128) + (v128.store16_lane $memorya 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store16_lane2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store16_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store16_lane2 (param $0 i32) (param $1 v128) + (v128.store16_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store32_lane (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store32_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store32_lane (param $0 i32) (param $1 v128) + (v128.store32_lane $memoryb 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store32_lane2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store32_lane $memoryc 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store32_lane2 (param $0 i32) (param $1 v128) + (v128.store32_lane 2 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryc 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryc 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryb 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane2 (param $0 i32) (param $1 v128) + (v128.store64_lane 1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_align (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryb align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_align (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryb align=1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_align2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memorya align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_align2 (param $0 i32) (param $1 v128) + (v128.store64_lane 0 align=1 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_offset (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryd offset=32 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_offset (param $0 i32) (param $1 v128) + (v128.store64_lane 3 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_offset2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memorya offset=32 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_offset2 (param $0 i32) (param $1 v128) + (v128.store64_lane $memorya offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_align_offset (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryb offset=32 align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_align_offset (param $0 i32) (param $1 v128) + (v128.store64_lane 1 align=1 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.store64_lane_align_offset2 (param $0 i32) (param $1 v128) + ;; CHECK-NEXT: (v128.store64_lane $memoryd offset=32 align=1 0 + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: (local.get $1) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.store64_lane_align_offset2 (param $0 i32) (param $1 v128) + (v128.store64_lane $memoryd align=1 offset=32 0 + (local.get $0) + (local.get $1) + ) + ) + ;; CHECK: (func $v128.load32_zero (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32_zero $memorya + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_zero (param $0 i32) (result v128) + (v128.load32_zero 0 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load32_zero2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load32_zero $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load32_zero2 (param $0 i32) (result v128) + (v128.load32_zero $memoryb + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load64_zero (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load64_zero $memoryb + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_zero (param $0 i32) (result v128) + (v128.load64_zero 1 + (local.get $0) + ) + ) + ;; CHECK: (func $v128.load64_zero2 (param $0 i32) (result v128) + ;; CHECK-NEXT: (v128.load64_zero $memoryc + ;; CHECK-NEXT: (local.get $0) + ;; CHECK-NEXT: ) + ;; CHECK-NEXT: ) + (func $v128.load64_zero2 (param $0 i32) (result v128) + (v128.load64_zero $memoryc + (local.get $0) + ) + ) +) + diff --git a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast index 6c9a598bb..e0045579d 100644 --- a/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast +++ b/test/lit/passes/O3_inline-functions-with-loops_flexible-inline-max-function-size=30.wast @@ -8,6 +8,8 @@ (type $t0 (func (param i32) (result i32))) ;; CHECK: (memory $memory 0) + ;; CHECK: (export "memory" (memory $memory)) + ;; CHECK: (export "fib" (func $fib)) ;; CHECK: (export "looped" (func $looped)) @@ -20,8 +22,6 @@ ;; CHECK: (export "t3" (func $t3)) - ;; CHECK: (export "memory" (memory $memory)) - ;; CHECK: (func $fib (; has Stack IR ;) (param $0 i32) (result i32) ;; CHECK-NEXT: (if ;; CHECK-NEXT: (i32.le_s diff --git a/test/lit/passes/O4_disable-bulk-memory.wast b/test/lit/passes/O4_disable-bulk-memory.wast index 4a6293d65..8200df5a3 100644 --- a/test/lit/passes/O4_disable-bulk-memory.wast +++ b/test/lit/passes/O4_disable-bulk-memory.wast @@ -80,8 +80,8 @@ (global $global$6 i32 (i32.const 100)) ;; CHECK: (elem (i32.const 0) $null) - ;; CHECK: (export "memory" (memory $0)) - (export "memory" (memory $0)) + ;; CHECK: (export "memory" (memory $1)) + (export "memory" (memory $1)) ;; CHECK: (export "table" (table $0)) (export "table" (table $0)) ;; CHECK: (export "init" (func $assembly/index/init)) diff --git a/test/lit/wasm-split/export-name-already-exists.wast b/test/lit/wasm-split/export-name-already-exists.wast index 708929e98..83951795a 100644 --- a/test/lit/wasm-split/export-name-already-exists.wast +++ b/test/lit/wasm-split/export-name-already-exists.wast @@ -4,5 +4,6 @@ ;; CHECK: error: Export foo already exists. (module + (memory 0 0) (export "foo" (memory 0 0)) ) diff --git a/test/lit/wasm-split/instrument-in-memory.wast b/test/lit/wasm-split/instrument-in-memory.wast index 568ce2207..3a3c19d7f 100644 --- a/test/lit/wasm-split/instrument-in-memory.wast +++ b/test/lit/wasm-split/instrument-in-memory.wast @@ -7,6 +7,7 @@ (module (import "env" "foo" (func $foo)) (export "bar" (func $bar)) + (memory $0 1 1) (func $bar (call $foo) ) diff --git a/test/lit/wasm-split/merge-profiles.wast b/test/lit/wasm-split/merge-profiles.wast index fdaf6678e..2d09fefaa 100644 --- a/test/lit/wasm-split/merge-profiles.wast +++ b/test/lit/wasm-split/merge-profiles.wast @@ -22,6 +22,7 @@ ;; SPLIT-NEXT: Splitting out functions: qux{{$}} (module + (memory 0 0) (export "memory" (memory 0 0)) (export "foo" (func $foo)) (export "bar" (func $bar)) diff --git a/test/lit/wasm-split/mismatched-hashes.wast b/test/lit/wasm-split/mismatched-hashes.wast index fd3ebb8d3..347fb1746 100644 --- a/test/lit/wasm-split/mismatched-hashes.wast +++ b/test/lit/wasm-split/mismatched-hashes.wast @@ -19,5 +19,6 @@ ;; RUN: wasm-split %s --profile=%t.prof -o1 %t.1.wasm -o2 %t.2.wasm (module + (memory 0 0) (export "memory" (memory 0 0)) ) |