diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-11-04 17:24:01 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-11-04 17:24:01 -0700 |
commit | 13ce3488333f70607411eb504ea2046fe2dc7c6d (patch) | |
tree | 6f7e8a6a529016dd7bb79d1c762d24e47d07bef2 /test | |
parent | fd5d26f549ec95f46d8696dac51ba5b5f7316248 (diff) | |
download | binaryen-13ce3488333f70607411eb504ea2046fe2dc7c6d.tar.gz binaryen-13ce3488333f70607411eb504ea2046fe2dc7c6d.tar.bz2 binaryen-13ce3488333f70607411eb504ea2046fe2dc7c6d.zip |
optimize booleans through i32.or
Diffstat (limited to 'test')
-rw-r--r-- | test/emcc_hello_world.fromasm | 17 | ||||
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 17 | ||||
-rw-r--r-- | test/passes/optimize-instructions.txt | 20 | ||||
-rw-r--r-- | test/passes/optimize-instructions.wast | 16 |
4 files changed, 46 insertions, 24 deletions
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index d1c3304ff..239c2a185 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -6339,15 +6339,11 @@ (i32.const 1) ) ) - (i32.eqz - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) + (i32.and + (i32.load + (get_local $0) ) + (i32.const 32) ) ) ) @@ -7043,10 +7039,7 @@ (set_local $6 (if i32 (i32.or - (i32.ne - (get_local $7) - (i32.const 0) - ) + (get_local $7) (tee_local $9 (i32.or (i32.ne diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index d95790044..8417befb4 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -6325,15 +6325,11 @@ (i32.const 1) ) ) - (i32.eqz - (i32.eqz - (i32.and - (i32.load - (get_local $0) - ) - (i32.const 32) - ) + (i32.and + (i32.load + (get_local $0) ) + (i32.const 32) ) ) ) @@ -7029,10 +7025,7 @@ (set_local $6 (if i32 (i32.or - (i32.ne - (get_local $7) - (i32.const 0) - ) + (get_local $7) (tee_local $9 (i32.or (i32.ne diff --git a/test/passes/optimize-instructions.txt b/test/passes/optimize-instructions.txt index 226f1766e..cb043f155 100644 --- a/test/passes/optimize-instructions.txt +++ b/test/passes/optimize-instructions.txt @@ -373,6 +373,26 @@ (call $ne0) (nop) ) + (if + (i32.or + (call $ne0) + (call $ne0) + ) + (nop) + ) + (if + (i32.and + (i32.ne + (call $ne0) + (i32.const 0) + ) + (i32.ne + (call $ne0) + (i32.const 0) + ) + ) + (nop) + ) (i32.const 1) ) (func $recurse-bool (type $1) diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index dfa6365f9..3cf756548 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -294,6 +294,22 @@ (if (i32.ne (i32.const 0) (call $ne0)) (nop) ) + ;; through an or + (if + (i32.or + (i32.ne (i32.const 0) (call $ne0)) + (i32.ne (i32.const 0) (call $ne0)) + ) + (nop) + ) + ;; but not an and + (if + (i32.and + (i32.ne (i32.const 0) (call $ne0)) + (i32.ne (i32.const 0) (call $ne0)) + ) + (nop) + ) (i32.const 1) ) (func $recurse-bool |