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 | |
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')
-rw-r--r-- | test/emcc_hello_world.fromasm | 160 |
1 files changed, 62 insertions, 98 deletions
diff --git a/test/emcc_hello_world.fromasm b/test/emcc_hello_world.fromasm index 5ac7af9f6..71ce805ba 100644 --- a/test/emcc_hello_world.fromasm +++ b/test/emcc_hello_world.fromasm @@ -7967,22 +7967,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) ) @@ -8148,43 +8145,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 @@ -8195,9 +8176,9 @@ (get_local $3) ) ) - (i32.const 1) + (i32.const 2) ) - (i32.const 2) + (i32.const 4) ) ) ) @@ -8212,19 +8193,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) ) @@ -8348,16 +8342,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) ) @@ -9059,16 +9050,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) ) @@ -10122,11 +10110,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) ) @@ -11665,11 +11650,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) ) @@ -12157,11 +12139,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) ) @@ -12852,11 +12831,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) ) @@ -13308,11 +13284,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) ) @@ -13665,11 +13638,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) ) @@ -14329,11 +14299,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) ) @@ -14819,11 +14786,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) ) |