diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-11-28 16:44:26 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-28 16:44:26 -0800 |
commit | 2de7b22f2b245ab2cf4efffab500a88511972bd8 (patch) | |
tree | 2c4821efb77147282ebbd975572b40231654b46c /test | |
parent | 5d92d866d8326b1908328485cccd2f8ebe57ac75 (diff) | |
download | binaryen-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')
-rw-r--r-- | test/passes/optimize-instructions.txt | 70 | ||||
-rw-r--r-- | test/passes/optimize-instructions.wast | 75 |
2 files changed, 145 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt index 7d82ae8b1..0e8654e48 100644 --- a/test/passes/optimize-instructions.txt +++ b/test/passes/optimize-instructions.txt @@ -3223,6 +3223,76 @@ (i32.const 2) ) ) + (func $pre-combine-or (; 75 ;) (type $5) (param $x i32) (param $y i32) + (drop + (i32.ge_s + (get_local $x) + (get_local $y) + ) + ) + (drop + (i32.ge_s + (get_local $x) + (get_local $y) + ) + ) + (drop + (i32.or + (i32.eq + (get_local $x) + (i32.const 1) + ) + (i32.gt_s + (get_local $x) + (get_local $y) + ) + ) + ) + (drop + (i32.or + (i32.eq + (get_local $x) + (get_local $y) + ) + (i32.gt_s + (get_local $x) + (i32.const 1) + ) + ) + ) + (drop + (i32.or + (i32.gt_s + (call $ne0) + (get_local $y) + ) + (i32.eq + (call $ne0) + (get_local $y) + ) + ) + ) + (drop + (i32.or + (i32.gt_s + (get_local $y) + (call $ne0) + ) + (i32.eq + (call $ne0) + (get_local $y) + ) + ) + ) + ) + (func $combine-or (; 76 ;) (type $5) (param $x i32) (param $y i32) + (drop + (i32.ge_s + (get_local $x) + (get_local $y) + ) + ) + ) ) (module (type $0 (func)) 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))) |