diff options
author | Alon Zakai <alonzakai@gmail.com> | 2018-01-17 21:20:53 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-17 21:20:53 -0800 |
commit | 14cb0c01ee22fbcd2923db0502e11b1fc51df05d (patch) | |
tree | eb4c6c854a803482c2891e7235ea8700886d289c /test/passes/optimize-instructions.wast | |
parent | 692069c6eef63754c27e815fd948fea6185d7619 (diff) | |
download | binaryen-14cb0c01ee22fbcd2923db0502e11b1fc51df05d.tar.gz binaryen-14cb0c01ee22fbcd2923db0502e11b1fc51df05d.tar.bz2 binaryen-14cb0c01ee22fbcd2923db0502e11b1fc51df05d.zip |
optimize out 0-x, a zero only used to negate an int, when possible (#1365)
Diffstat (limited to 'test/passes/optimize-instructions.wast')
-rw-r--r-- | test/passes/optimize-instructions.wast | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/passes/optimize-instructions.wast b/test/passes/optimize-instructions.wast index 34b805f3d..60bfc9b7d 100644 --- a/test/passes/optimize-instructions.wast +++ b/test/passes/optimize-instructions.wast @@ -2663,6 +2663,50 @@ (i32.and (i32.wrap/i64 (i64.const 1)) (i32.eqz (get_local $y))) ) ) + (func $subzero1 (param $0 i32) (result i32) + (i32.add + (i32.sub + (i32.const 1) + (i32.clz + (get_local $0) + ) + ) + (i32.const 31) + ) + ) + (func $subzero2 (param $0 i32) (result i32) + (i32.add + (i32.const 31) + (i32.sub + (i32.const 1) + (i32.clz + (get_local $0) + ) + ) + ) + ) + (func $subzero3 (param $0 i32) (param $1 i32) (result i32) + (i32.add + (i32.sub + (i32.const 0) + (i32.clz + (get_local $0) + ) + ) + (get_local $1) + ) + ) + (func $subzero4 (param $0 i32) (param $1 i32) (result i32) + (i32.add + (get_local $0) + (i32.sub + (i32.const 0) + (i32.clz + (get_local $1) + ) + ) + ) + ) ) (module (import "env" "memory" (memory $0 (shared 256 256))) @@ -2680,3 +2724,4 @@ ) ) ) + |