From 6ffde47095f8f21ff3a24029f8e4403b7a687a59 Mon Sep 17 00:00:00 2001 From: Sam Clegg Date: Thu, 11 Jul 2024 13:57:10 -0700 Subject: [PATCH] Convert memory64 lowering test to lit. NFC Test was converted using port_passes_tests_to_lit.py. --- test/lit/passes/memory64-lowering.wast | 268 ++++++++++++++++++ ...ry64_enable-bulk-memory_enable-threads.txt | 221 --------------- ...y64_enable-bulk-memory_enable-threads.wast | 43 --- 3 files changed, 268 insertions(+), 264 deletions(-) create mode 100644 test/lit/passes/memory64-lowering.wast delete mode 100644 test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.txt delete mode 100644 test/passes/memory64-lowering_enable-memory64_enable-bulk-memory_enable-threads.wast diff --git a/test/lit/passes/memory64-lowering.wast b/test/lit/passes/memory64-lowering.wast new file mode 100644 index 00000000000..464c0715bf6 --- /dev/null +++ b/test/lit/passes/memory64-lowering.wast @@ -0,0 +1,268 @@ +;; 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 -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 $func_1 + ;; CHECK-NEXT: (local $0 i64) + ;; 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: (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: (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: (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 $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 + ;; 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 122c7e889dc..00000000000 --- 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 7cb89599f69..00000000000 --- 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) -)