summaryrefslogtreecommitdiff
path: root/test/lit/passes/flatten_local-cse_Os.wast
diff options
context:
space:
mode:
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: )