Utilize Binaryen's -O4

When specifying -O3 or -Oz, asc now automatically increases the optimize level to 4, then including costly non-LLVM optimizations for blocky code, in turn achieving similar results as an LLVM-based generator.
This commit is contained in:
dcodeIO
2018-06-09 14:05:33 +02:00
parent e9094bbd6f
commit c6ec5e2832
46 changed files with 14240 additions and 16223 deletions

View File

@ -11,8 +11,8 @@
(start $start)
(func $memset/memset (; 1 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(local $4 i64)
(local $5 i32)
(local $4 i32)
(local $5 i64)
(block $folding-inner0
(set_local $3
(get_local $0)
@ -23,13 +23,13 @@
)
)
(i32.store8
(get_local $0)
(get_local $3)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $3)
(get_local $2)
)
(i32.const 1)
@ -44,34 +44,33 @@
)
(i32.store8
(i32.add
(get_local $0)
(get_local $3)
(i32.const 1)
)
(get_local $1)
)
(i32.store8
(i32.add
(get_local $3)
(i32.const 2)
)
(get_local $1)
)
(i32.store8
(i32.sub
(tee_local $0
(i32.add
(get_local $3)
(get_local $2)
)
)
(i32.const 2)
)
(get_local $1)
)
(i32.store8
(i32.sub
(get_local $0)
(i32.const 2)
)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 2)
)
(get_local $1)
)
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(i32.const 3)
)
(get_local $1)
@ -84,7 +83,7 @@
)
(i32.store8
(i32.add
(get_local $0)
(get_local $3)
(i32.const 3)
)
(get_local $1)
@ -92,7 +91,7 @@
(i32.store8
(i32.sub
(i32.add
(get_local $0)
(get_local $3)
(get_local $2)
)
(i32.const 4)
@ -105,19 +104,25 @@
(i32.const 8)
)
)
(set_local $2
(i32.sub
(get_local $2)
(tee_local $4
(i32.and
(i32.sub
(i32.const 0)
(get_local $3)
)
(i32.const 3)
)
)
)
)
(i32.store
(tee_local $0
(i32.add
(get_local $0)
(tee_local $5
(i32.and
(i32.sub
(i32.const 0)
(get_local $0)
)
(i32.const 3)
)
)
(get_local $3)
(get_local $4)
)
)
(tee_local $1
@ -136,10 +141,7 @@
(get_local $0)
(tee_local $2
(i32.and
(i32.sub
(get_local $2)
(get_local $5)
)
(get_local $2)
(i32.const -4)
)
)
@ -170,9 +172,11 @@
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
(tee_local $4
(i32.add
(get_local $0)
(get_local $2)
)
)
(i32.const 12)
)
@ -180,10 +184,7 @@
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(get_local $4)
(i32.const 8)
)
(get_local $1)
@ -224,9 +225,11 @@
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
(tee_local $4
(i32.add
(get_local $0)
(get_local $2)
)
)
(i32.const 28)
)
@ -234,30 +237,21 @@
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(get_local $4)
(i32.const 24)
)
(get_local $1)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(get_local $4)
(i32.const 20)
)
(get_local $1)
)
(i32.store
(i32.sub
(i32.add
(get_local $0)
(get_local $2)
)
(get_local $4)
(i32.const 16)
)
(get_local $1)
@ -265,7 +259,7 @@
(set_local $0
(i32.add
(get_local $0)
(tee_local $5
(tee_local $4
(i32.add
(i32.and
(get_local $0)
@ -279,18 +273,18 @@
(set_local $2
(i32.sub
(get_local $2)
(get_local $5)
(get_local $4)
)
)
(set_local $4
(set_local $5
(i64.or
(i64.extend_u/i32
(get_local $1)
)
(i64.shl
(tee_local $5
(i64.extend_u/i32
(get_local $1)
)
)
(i64.shl
(get_local $5)
(i64.const 32)
)
)
@ -304,28 +298,28 @@
(block
(i64.store
(get_local $0)
(get_local $4)
(get_local $5)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 8)
)
(get_local $4)
(get_local $5)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 16)
)
(get_local $4)
(get_local $5)
)
(i64.store
(i32.add
(get_local $0)
(i32.const 24)
)
(get_local $4)
(get_local $5)
)
(set_local $2
(i32.sub