summaryrefslogtreecommitdiff
path: root/test/passes/optimize-instructions.wast
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2018-11-28 16:44:26 -0800
committerGitHub <noreply@github.com>2018-11-28 16:44:26 -0800
commit2de7b22f2b245ab2cf4efffab500a88511972bd8 (patch)
tree2c4821efb77147282ebbd975572b40231654b46c /test/passes/optimize-instructions.wast
parent5d92d866d8326b1908328485cccd2f8ebe57ac75 (diff)
downloadbinaryen-2de7b22f2b245ab2cf4efffab500a88511972bd8.tar.gz
binaryen-2de7b22f2b245ab2cf4efffab500a88511972bd8.tar.bz2
binaryen-2de7b22f2b245ab2cf4efffab500a88511972bd8.zip
Start to implement #1764 (#1776)
This adds a first instance of the rules discussed in #1764 , specifically, x == y || x > y => x >= y
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r--test/passes/optimize-instructions.wast75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast
index 234b3913b..be9761a2b 100644
--- a/test/passes/optimize-instructions.wast
+++ b/test/passes/optimize-instructions.wast
@@ -3663,6 +3663,81 @@
(i32.const 2)
)
)
+ (func $pre-combine-or (param $x i32) (param $y i32)
+ (drop (i32.or
+ (i32.gt_s
+ (get_local $x)
+ (get_local $y)
+ )
+ (i32.eq
+ (get_local $y) ;; ordering should not stop us
+ (get_local $x)
+ )
+ ))
+ (drop (i32.or
+ (i32.eq ;; ordering should not stop us
+ (get_local $y)
+ (get_local $x)
+ )
+ (i32.gt_s
+ (get_local $x)
+ (get_local $y)
+ )
+ ))
+ (drop (i32.or
+ (i32.gt_s
+ (get_local $x)
+ (get_local $y)
+ )
+ (i32.eq
+ (get_local $x)
+ (i32.const 1) ;; not equal
+ )
+ ))
+ (drop (i32.or
+ (i32.gt_s
+ (get_local $x)
+ (i32.const 1) ;; not equal
+ )
+ (i32.eq
+ (get_local $x)
+ (get_local $y)
+ )
+ ))
+ (drop (i32.or
+ (i32.gt_s
+ (call $ne0) ;; side effects
+ (get_local $y)
+ )
+ (i32.eq
+ (call $ne0)
+ (get_local $y)
+ )
+ ))
+ (drop (i32.or
+ (i32.gt_s
+ (get_local $y)
+ (call $ne0) ;; side effects
+ )
+ (i32.eq
+ (get_local $y)
+ (call $ne0)
+ )
+ ))
+ )
+ (func $combine-or (param $x i32) (param $y i32)
+ (drop (i32.or
+ (i32.gt_s
+ (get_local $x)
+ (get_local $y)
+ )
+ (i32.eq
+ (get_local $x)
+ (get_local $y)
+ )
+ ))
+ ;; TODO: more stuff here
+ )
)
(module
(import "env" "memory" (memory $0 (shared 256 256)))