diff options
author | Alon Zakai <alonzakai@gmail.com> | 2017-02-16 22:42:31 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-16 22:42:31 -0800 |
commit | c6ea79d1532face076c2dfeb8eadb58319e4e5fd (patch) | |
tree | 12a840d94dda462827a8874371bb9858948ea42b /test/emcc_hello_world.fromasm.imprecise | |
parent | 0728a53fb6bf0540b9789c7bcd26e195800c5ecc (diff) | |
download | binaryen-c6ea79d1532face076c2dfeb8eadb58319e4e5fd.tar.gz binaryen-c6ea79d1532face076c2dfeb8eadb58319e4e5fd.tar.bz2 binaryen-c6ea79d1532face076c2dfeb8eadb58319e4e5fd.zip |
Optimize "squared" operations (#905)
* optimize 'almost' sign extends: when we can remove one entirely, then extra shifts can be left behind. with that in place, we can then optimize 'squared' operations like shl on shl, as doing so does not break our sign extend opts
Diffstat (limited to 'test/emcc_hello_world.fromasm.imprecise')
-rw-r--r-- | test/emcc_hello_world.fromasm.imprecise | 160 |
1 files changed, 62 insertions, 98 deletions
diff --git a/test/emcc_hello_world.fromasm.imprecise b/test/emcc_hello_world.fromasm.imprecise index 096d105b8..58dc7b313 100644 --- a/test/emcc_hello_world.fromasm.imprecise +++ b/test/emcc_hello_world.fromasm.imprecise @@ -7904,22 +7904,19 @@ (tee_local $2 (i32.add (i32.shl - (i32.shl - (tee_local $4 - (i32.add - (i32.xor - (i32.and - (get_local $5) - (i32.const 1) - ) + (tee_local $4 + (i32.add + (i32.xor + (i32.and + (get_local $5) (i32.const 1) ) - (get_local $13) + (i32.const 1) ) + (get_local $13) ) - (i32.const 1) ) - (i32.const 2) + (i32.const 3) ) (i32.const 216) ) @@ -8085,43 +8082,27 @@ (tee_local $10 (i32.add (i32.shl - (i32.shl - (tee_local $5 - (i32.add + (tee_local $5 + (i32.add + (i32.or (i32.or (i32.or (i32.or - (i32.or - (tee_local $3 - (i32.and - (i32.shr_u - (tee_local $7 - (i32.shr_u - (get_local $3) - (get_local $10) - ) - ) - (i32.const 5) - ) - (i32.const 8) - ) - ) - (get_local $10) - ) (tee_local $3 (i32.and (i32.shr_u (tee_local $7 (i32.shr_u - (get_local $7) (get_local $3) + (get_local $10) ) ) - (i32.const 2) + (i32.const 5) ) - (i32.const 4) + (i32.const 8) ) ) + (get_local $10) ) (tee_local $3 (i32.and @@ -8132,9 +8113,9 @@ (get_local $3) ) ) - (i32.const 1) + (i32.const 2) ) - (i32.const 2) + (i32.const 4) ) ) ) @@ -8149,19 +8130,32 @@ ) (i32.const 1) ) - (i32.const 1) + (i32.const 2) ) ) ) - (i32.shr_u - (get_local $7) - (get_local $3) + (tee_local $3 + (i32.and + (i32.shr_u + (tee_local $7 + (i32.shr_u + (get_local $7) + (get_local $3) + ) + ) + (i32.const 1) + ) + (i32.const 1) + ) ) ) + (i32.shr_u + (get_local $7) + (get_local $3) + ) ) - (i32.const 1) ) - (i32.const 2) + (i32.const 3) ) (i32.const 216) ) @@ -8285,16 +8279,13 @@ (set_local $4 (i32.add (i32.shl - (i32.shl - (tee_local $0 - (i32.shr_u - (get_local $8) - (i32.const 3) - ) + (tee_local $0 + (i32.shr_u + (get_local $8) + (i32.const 3) ) - (i32.const 1) ) - (i32.const 2) + (i32.const 3) ) (i32.const 216) ) @@ -8996,16 +8987,13 @@ (set_local $2 (i32.add (i32.shl - (i32.shl - (tee_local $0 - (i32.shr_u - (get_local $0) - (i32.const 3) - ) + (tee_local $0 + (i32.shr_u + (get_local $0) + (i32.const 3) ) - (i32.const 1) ) - (i32.const 2) + (i32.const 3) ) (i32.const 216) ) @@ -10059,11 +10047,8 @@ (set_local $3 (i32.add (i32.shl - (i32.shl - (get_local $0) - (i32.const 1) - ) - (i32.const 2) + (get_local $0) + (i32.const 3) ) (i32.const 216) ) @@ -11602,11 +11587,8 @@ (tee_local $0 (i32.add (i32.shl - (i32.shl - (get_local $1) - (i32.const 1) - ) - (i32.const 2) + (get_local $1) + (i32.const 3) ) (i32.const 216) ) @@ -12094,11 +12076,8 @@ (set_local $3 (i32.add (i32.shl - (i32.shl - (get_local $0) - (i32.const 1) - ) - (i32.const 2) + (get_local $0) + (i32.const 3) ) (i32.const 216) ) @@ -12789,11 +12768,8 @@ (set_local $2 (i32.add (i32.shl - (i32.shl - (get_local $1) - (i32.const 1) - ) - (i32.const 2) + (get_local $1) + (i32.const 3) ) (i32.const 216) ) @@ -13245,11 +13221,8 @@ (tee_local $4 (i32.add (i32.shl - (i32.shl - (get_local $2) - (i32.const 1) - ) - (i32.const 2) + (get_local $2) + (i32.const 3) ) (i32.const 216) ) @@ -13601,11 +13574,8 @@ (tee_local $3 (i32.add (i32.shl - (i32.shl - (get_local $5) - (i32.const 1) - ) - (i32.const 2) + (get_local $5) + (i32.const 3) ) (i32.const 216) ) @@ -14265,11 +14235,8 @@ (tee_local $0 (i32.add (i32.shl - (i32.shl - (get_local $3) - (i32.const 1) - ) - (i32.const 2) + (get_local $3) + (i32.const 3) ) (i32.const 216) ) @@ -14755,11 +14722,8 @@ (set_local $1 (i32.add (i32.shl - (i32.shl - (get_local $0) - (i32.const 1) - ) - (i32.const 2) + (get_local $0) + (i32.const 3) ) (i32.const 216) ) |