summaryrefslogtreecommitdiff
path: root/test/lit/passes/flatten_local-cse_Os.wast
diff options
context:
space:
mode:
authorThomas Lively <7121787+tlively@users.noreply.github.com>2021-07-12 17:37:47 -0700
committerGitHub <noreply@github.com>2021-07-12 17:37:47 -0700
commitd22bc1c5dc2685b2c3f9ee004197da249c2b416e (patch)
tree7dbc246d468e91c1a2602e64fb8c0df3b1a54156 /test/lit/passes/flatten_local-cse_Os.wast
parent58ce30422a24f44dcac6f5d1b6950d900582f0f2 (diff)
downloadbinaryen-d22bc1c5dc2685b2c3f9ee004197da249c2b416e.tar.gz
binaryen-d22bc1c5dc2685b2c3f9ee004197da249c2b416e.tar.bz2
binaryen-d22bc1c5dc2685b2c3f9ee004197da249c2b416e.zip
Port test/passes/flatten* to lit (#3971)
Diffstat (limited to 'test/lit/passes/flatten_local-cse_Os.wast')
-rw-r--r--test/lit/passes/flatten_local-cse_Os.wast71
1 files changed, 71 insertions, 0 deletions
diff --git a/test/lit/passes/flatten_local-cse_Os.wast b/test/lit/passes/flatten_local-cse_Os.wast
new file mode 100644
index 000000000..1f315cd2c
--- /dev/null
+++ b/test/lit/passes/flatten_local-cse_Os.wast
@@ -0,0 +1,71 @@
+;; NOTE: Assertions have been generated by update_lit_checks.py --all-items and should not be edited.
+;; NOTE: This test was ported using port_test.py and could be cleaned up.
+
+;; RUN: foreach %s %t wasm-opt --flatten --local-cse -Os -S -o - | filecheck %s
+
+(module
+ ;; testcase from AssemblyScript
+ (func "div16_internal" (param $0 i32) (param $1 i32) (result i32)
+ (i32.add
+ (i32.xor
+ (i32.shr_s
+ (i32.shl
+ (local.get $0)
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ (i32.shr_s
+ (i32.shl
+ (local.get $1)
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ )
+ (i32.xor
+ (i32.shr_s
+ (i32.shl
+ (local.get $0)
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ (i32.shr_s
+ (i32.shl
+ (local.get $1)
+ (i32.const 16)
+ )
+ (i32.const 16)
+ )
+ )
+ )
+ )
+)
+;; CHECK: (type $i32_i32_=>_i32 (func (param i32 i32) (result i32)))
+
+;; CHECK: (export "div16_internal" (func $0))
+
+;; CHECK: (func $0 (; has Stack IR ;) (param $0 i32) (param $1 i32) (result i32)
+;; CHECK-NEXT: (i32.add
+;; CHECK-NEXT: (local.tee $0
+;; CHECK-NEXT: (i32.xor
+;; CHECK-NEXT: (i32.shr_s
+;; CHECK-NEXT: (i32.shl
+;; CHECK-NEXT: (local.get $0)
+;; CHECK-NEXT: (i32.const 16)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (i32.const 16)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (i32.shr_s
+;; CHECK-NEXT: (i32.shl
+;; CHECK-NEXT: (local.get $1)
+;; CHECK-NEXT: (i32.const 16)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (i32.const 16)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )
+;; CHECK-NEXT: (local.get $0)
+;; CHECK-NEXT: )
+;; CHECK-NEXT: )