Update binaryen.js and enable tee optimizations

This commit is contained in:
dcodeIO
2017-12-29 04:38:39 +01:00
parent 4207f6460d
commit c67f87a988
15 changed files with 246 additions and 329 deletions

View File

@ -31,13 +31,13 @@
(local $5 i32)
(local $6 i32)
(local $7 i32)
(set_local $6
(set_local $5
(i32.sub
(get_global $../../examples/game-of-life/assembly/game-of-life/h)
(i32.const 1)
)
)
(set_local $7
(set_local $6
(i32.sub
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
(i32.const 1)
@ -53,17 +53,17 @@
(get_global $../../examples/game-of-life/assembly/game-of-life/h)
)
(block
(set_local $4
(set_local $3
(select
(i32.sub
(get_local $0)
(i32.const 1)
)
(get_local $6)
(get_local $5)
(get_local $0)
)
)
(set_local $5
(set_local $4
(select
(i32.const 0)
(i32.add
@ -72,7 +72,7 @@
)
(i32.eq
(get_local $0)
(get_local $6)
(get_local $5)
)
)
)
@ -97,7 +97,7 @@
(i32.load8_u
(i32.add
(i32.mul
(get_local $4)
(get_local $3)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(tee_local $2
@ -106,7 +106,7 @@
(get_local $1)
(i32.const 1)
)
(get_local $7)
(get_local $6)
(get_local $1)
)
)
@ -115,7 +115,7 @@
(i32.load8_u
(i32.add
(i32.mul
(get_local $4)
(get_local $3)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $1)
@ -125,10 +125,10 @@
(i32.load8_u
(i32.add
(i32.mul
(get_local $4)
(get_local $3)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(tee_local $3
(tee_local $7
(select
(i32.const 0)
(i32.add
@ -137,7 +137,7 @@
)
(i32.eq
(get_local $1)
(get_local $7)
(get_local $6)
)
)
)
@ -160,14 +160,14 @@
(get_local $0)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $3)
(get_local $7)
)
)
)
(i32.load8_u
(i32.add
(i32.mul
(get_local $5)
(get_local $4)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $2)
@ -177,7 +177,7 @@
(i32.load8_u
(i32.add
(i32.mul
(get_local $5)
(get_local $4)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $1)
@ -187,10 +187,10 @@
(i32.load8_u
(i32.add
(i32.mul
(get_local $5)
(get_local $4)
(get_global $../../examples/game-of-life/assembly/game-of-life/w)
)
(get_local $3)
(get_local $7)
)
)
)
@ -207,13 +207,14 @@
)
(if
(if (result i32)
(tee_local $3
(i32.lt_u
(get_local $2)
(i32.const 2)
)
(i32.lt_u
(get_local $2)
(i32.const 2)
)
(i32.lt_u
(get_local $2)
(i32.const 2)
)
(get_local $3)
(i32.gt_u
(get_local $2)
(i32.const 3)

View File

@ -35,7 +35,6 @@
(local $8 i32)
(local $9 i32)
(local $10 i32)
(local $11 i32)
(nop)
(nop)
(block
@ -236,13 +235,14 @@
(get_local $9)
(if
(if (result i32)
(tee_local $11
(i32.lt_u
(get_local $8)
(i32.const 2)
)
(i32.lt_u
(get_local $8)
(i32.const 2)
)
(i32.lt_u
(get_local $8)
(i32.const 2)
)
(get_local $11)
(i32.gt_u
(get_local $8)
(i32.const 3)

View File

@ -10,27 +10,10 @@
(func $start (; 0 ;) (type $v)
(local $0 i32)
(local $1 f64)
(local $2 i64)
(local $3 f32)
(if
(tee_local $0
(i32.const 0)
)
(unreachable)
)
(if
(f64.ne
(tee_local $1
(f64.const 0)
)
(f64.const 0)
)
(unreachable)
)
(if
(i32.eqz
(tee_local $0
(i32.const 1)
(i32.const 2)
)
)
(unreachable)
@ -38,52 +21,14 @@
(if
(f64.eq
(tee_local $1
(f64.const 1)
)
(f64.const 0)
)
(unreachable)
)
(if
(i32.eqz
(if (result i32)
(tee_local $0
(i32.const 1)
)
(tee_local $0
(i32.const 2)
)
(get_local $0)
)
)
(unreachable)
)
(if
(f64.eq
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 0)
)
(tee_local $1
(f64.const 2)
)
(get_local $1)
(f64.const 2)
)
(f64.const 0)
)
(unreachable)
)
(set_global $logical/i
(if (result i32)
(tee_local $0
(i32.const 1)
)
(i32.const 2)
(get_local $0)
)
(i32.const 2)
)
(if
(i32.ne
@ -93,13 +38,7 @@
(unreachable)
)
(set_global $logical/i
(if (result i32)
(tee_local $0
(i32.const 0)
)
(get_local $0)
(i32.const 1)
)
(i32.const 1)
)
(if
(i32.ne
@ -109,16 +48,7 @@
(unreachable)
)
(set_global $logical/I
(if (result i64)
(i64.ne
(tee_local $2
(i64.const 1)
)
(i64.const 0)
)
(i64.const 2)
(get_local $2)
)
(i64.const 2)
)
(if
(i64.ne
@ -128,16 +58,7 @@
(unreachable)
)
(set_global $logical/I
(if (result i64)
(i64.ne
(tee_local $2
(i64.const 0)
)
(i64.const 0)
)
(get_local $2)
(i64.const 1)
)
(i64.const 1)
)
(if
(i64.ne
@ -147,16 +68,7 @@
(unreachable)
)
(set_global $logical/f
(if (result f32)
(f32.ne
(tee_local $3
(f32.const 1)
)
(f32.const 0)
)
(f32.const 2)
(get_local $3)
)
(f32.const 2)
)
(if
(f32.ne
@ -166,16 +78,7 @@
(unreachable)
)
(set_global $logical/f
(if (result f32)
(f32.ne
(tee_local $3
(f32.const 0)
)
(f32.const 0)
)
(get_local $3)
(f32.const 1)
)
(f32.const 1)
)
(if
(f32.ne
@ -185,16 +88,7 @@
(unreachable)
)
(set_global $logical/F
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 0)
)
(f64.const 2)
(get_local $1)
)
(f64.const 2)
)
(if
(f64.ne
@ -204,16 +98,7 @@
(unreachable)
)
(set_global $logical/F
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 0)
)
(f64.const 0)
)
(get_local $1)
(f64.const 1)
)
(f64.const 1)
)
(if
(f64.ne

View File

@ -11,47 +11,37 @@
(func $start (; 0 ;) (type $v)
(local $0 i32)
(local $1 f64)
(local $2 i64)
(local $3 f32)
(drop
(if (result i32)
(tee_local $0
(i32.const 0)
)
(i32.const 0)
(unreachable)
(get_local $0)
(i32.const 0)
)
)
(drop
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 0)
)
(f64.const 0)
(f64.const 0)
)
(unreachable)
(get_local $1)
(f64.const 0)
)
)
(drop
(if (result i32)
(tee_local $0
(i32.const 1)
)
(get_local $0)
(i32.const 1)
(i32.const 1)
(unreachable)
)
)
(drop
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 1)
(f64.const 0)
)
(get_local $1)
(f64.const 1)
(unreachable)
)
)
@ -59,11 +49,9 @@
(if (result i32)
(tee_local $0
(if (result i32)
(tee_local $0
(i32.const 1)
)
(i32.const 1)
(i32.const 2)
(get_local $0)
(i32.const 1)
)
)
(get_local $0)
@ -76,13 +64,11 @@
(tee_local $1
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 1)
(f64.const 0)
)
(f64.const 2)
(get_local $1)
(f64.const 1)
)
)
(f64.const 0)
@ -93,11 +79,9 @@
)
(set_global $logical/i
(if (result i32)
(tee_local $0
(i32.const 1)
)
(i32.const 1)
(i32.const 2)
(get_local $0)
(i32.const 1)
)
)
(if
@ -111,10 +95,8 @@
)
(set_global $logical/i
(if (result i32)
(tee_local $0
(i32.const 0)
)
(get_local $0)
(i32.const 0)
(i32.const 0)
(i32.const 1)
)
)
@ -130,13 +112,11 @@
(set_global $logical/I
(if (result i64)
(i64.ne
(tee_local $2
(i64.const 1)
)
(i64.const 1)
(i64.const 0)
)
(i64.const 2)
(get_local $2)
(i64.const 1)
)
)
(if
@ -151,12 +131,10 @@
(set_global $logical/I
(if (result i64)
(i64.ne
(tee_local $2
(i64.const 0)
)
(i64.const 0)
(i64.const 0)
)
(get_local $2)
(i64.const 0)
(i64.const 1)
)
)
@ -172,13 +150,11 @@
(set_global $logical/f
(if (result f32)
(f32.ne
(tee_local $3
(f32.const 1)
)
(f32.const 1)
(f32.const 0)
)
(f32.const 2)
(get_local $3)
(f32.const 1)
)
)
(if
@ -193,12 +169,10 @@
(set_global $logical/f
(if (result f32)
(f32.ne
(tee_local $3
(f32.const 0)
)
(f32.const 0)
(f32.const 0)
)
(get_local $3)
(f32.const 0)
(f32.const 1)
)
)
@ -214,13 +188,11 @@
(set_global $logical/F
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 1)
)
(f64.const 1)
(f64.const 0)
)
(f64.const 2)
(get_local $1)
(f64.const 1)
)
)
(if
@ -235,12 +207,10 @@
(set_global $logical/F
(if (result f64)
(f64.ne
(tee_local $1
(f64.const 0)
)
(f64.const 0)
(f64.const 0)
)
(get_local $1)
(f64.const 0)
(f64.const 1)
)
)

View File

@ -19,14 +19,12 @@
(loop $continue|0
(if
(if (result i32)
(tee_local $1
(get_local $2)
)
(get_local $2)
(i32.rem_u
(get_local $3)
(i32.const 4)
)
(get_local $1)
(get_local $2)
)
(block
(set_local $4

View File

@ -27,14 +27,12 @@
(loop $continue|0
(if
(if (result i32)
(tee_local $7
(get_local $2)
)
(get_local $2)
(i32.rem_u
(get_local $4)
(i32.const 4)
)
(get_local $7)
(get_local $2)
)
(block
(block

View File

@ -473,14 +473,12 @@
(loop $continue|0
(if
(if (result i32)
(tee_local $3
(get_local $2)
)
(get_local $2)
(i32.rem_u
(get_local $1)
(i32.const 4)
)
(get_local $3)
(get_local $2)
)
(block
(set_local $4
@ -2049,7 +2047,6 @@
(get_local $0)
)
(func $std:heap/Heap.compare (; 3 ;) (type $iiii) (param $0 i32) (param $1 i32) (param $2 i32) (result i32)
(local $3 i32)
(if
(i32.eq
(get_local $0)
@ -2062,9 +2059,7 @@
(loop $continue|0
(if
(if (result i32)
(tee_local $3
(get_local $2)
)
(get_local $2)
(i32.eq
(i32.load8_u
(get_local $0)
@ -2073,7 +2068,7 @@
(get_local $1)
)
)
(get_local $3)
(get_local $2)
)
(block
(set_local $2

View File

@ -528,14 +528,12 @@
(loop $continue|0
(if
(if (result i32)
(tee_local $6
(get_local $2)
)
(get_local $2)
(i32.rem_u
(get_local $1)
(i32.const 4)
)
(get_local $6)
(get_local $2)
)
(block
(block
@ -2346,9 +2344,7 @@
(loop $continue|0
(if
(if (result i32)
(tee_local $3
(get_local $2)
)
(get_local $2)
(i32.eq
(i32.load8_u
(get_local $0)
@ -2357,7 +2353,7 @@
(get_local $1)
)
)
(get_local $3)
(get_local $2)
)
(block
(block