summaryrefslogtreecommitdiff
path: root/test/lit/passes/optimize-added-constants-memory64.wast
diff options
context:
space:
mode:
authorAxis <dongaxis1944@outlook.com>2022-09-22 00:09:25 +0800
committerGitHub <noreply@github.com>2022-09-21 09:09:25 -0700
commit7fb6cfb4e0ef3af329cb6481407f9b167b4ac491 (patch)
tree254424b934f83b96d74c2adeba236e5bccf14661 /test/lit/passes/optimize-added-constants-memory64.wast
parent8fe12b43db9c2b88585d27f490ae1a92cca1c676 (diff)
downloadbinaryen-7fb6cfb4e0ef3af329cb6481407f9b167b4ac491.tar.gz
binaryen-7fb6cfb4e0ef3af329cb6481407f9b167b4ac491.tar.bz2
binaryen-7fb6cfb4e0ef3af329cb6481407f9b167b4ac491.zip
Add wasm64 support in OptimizeAddedConstants (#5043)
This lets that pass optimize 64-bit offsets on memory64 loads and stores.
Diffstat (limited to 'test/lit/passes/optimize-added-constants-memory64.wast')
-rw-r--r--test/lit/passes/optimize-added-constants-memory64.wast57
1 files changed, 57 insertions, 0 deletions
diff --git a/test/lit/passes/optimize-added-constants-memory64.wast b/test/lit/passes/optimize-added-constants-memory64.wast
new file mode 100644
index 000000000..e44bc414b
--- /dev/null
+++ b/test/lit/passes/optimize-added-constants-memory64.wast
@@ -0,0 +1,57 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py and should not be edited.
+
+;; RUN: wasm-opt %s -all --roundtrip --optimize-added-constants --low-memory-unused -S -o - | filecheck %s
+
+(module
+ ;; CHECK: (memory $0 i64 1 4294967296)
+ (memory $0 i64 1 4294967296)
+
+
+ ;; CHECK: (func $load_i64 (result i64)
+ ;; CHECK-NEXT: (i64.load
+ ;; CHECK-NEXT: (i64.const 579)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $load_i64 (result i64)
+ (i64.load offset=123
+ (i64.const 456)
+ )
+ )
+
+ ;; CHECK: (func $load_overflow_i64 (result i64)
+ ;; CHECK-NEXT: (i64.load offset=32
+ ;; CHECK-NEXT: (i64.const -16)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $load_overflow_i64 (result i64)
+ (i64.load offset=32
+ (i64.const 0xfffffffffffffff0)
+ )
+ )
+
+ ;; CHECK: (func $store
+ ;; CHECK-NEXT: (i64.store
+ ;; CHECK-NEXT: (i64.const 579)
+ ;; CHECK-NEXT: (i64.const 123)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $store (result)
+ (i64.store offset=123
+ (i64.const 456)
+ (i64.const 123)
+ )
+ )
+
+ ;; CHECK: (func $store_overflow
+ ;; CHECK-NEXT: (i64.store offset=32
+ ;; CHECK-NEXT: (i64.const -16)
+ ;; CHECK-NEXT: (i64.const 123)
+ ;; CHECK-NEXT: )
+ ;; CHECK-NEXT: )
+ (func $store_overflow (result)
+ (i64.store offset=32
+ (i64.const 0xfffffffffffffff0)
+ (i64.const 123)
+ )
+ )
+)