Let the optimizer decide what it takes to become a select

This commit is contained in:
dcodeIO
2018-01-12 05:03:25 +01:00
parent d89703cdad
commit 3980e53bb7
18 changed files with 225 additions and 242 deletions

View File

@ -210,7 +210,11 @@
)
(if
(i32.and
(select
(if (result i32)
(i32.ge_u
(get_local $2)
(i32.const 2)
)
(i32.gt_u
(get_local $2)
(i32.const 3)
@ -219,10 +223,6 @@
(get_local $2)
(i32.const 2)
)
(i32.ge_u
(get_local $2)
(i32.const 2)
)
)
(i32.const 1)
)

View File

@ -236,7 +236,13 @@
)
(if
(i32.and
(select
(if (result i32)
(i32.eqz
(i32.lt_u
(get_local $8)
(i32.const 2)
)
)
(i32.gt_u
(get_local $8)
(i32.const 3)
@ -245,12 +251,6 @@
(get_local $8)
(i32.const 2)
)
(i32.eqz
(i32.lt_u
(get_local $8)
(i32.const 2)
)
)
)
(i32.const 1)
)

View File

@ -53,12 +53,12 @@
(if (result i32)
(i32.eqz
(tee_local $0
(select
(i32.const 1)
(i32.const 2)
(if (result i32)
(i32.eqz
(i32.const 1)
)
(i32.const 1)
(i32.const 2)
)
)
)
@ -70,13 +70,13 @@
(if (result f64)
(f64.eq
(tee_local $1
(select
(f64.const 1)
(f64.const 2)
(if (result f64)
(f64.eq
(f64.const 1)
(f64.const 0)
)
(f64.const 1)
(f64.const 2)
)
)
(f64.const 0)
@ -86,12 +86,12 @@
)
)
(set_global $logical/i
(select
(i32.const 1)
(i32.const 2)
(if (result i32)
(i32.eqz
(i32.const 1)
)
(i32.const 1)
(i32.const 2)
)
)
(if
@ -104,12 +104,12 @@
(unreachable)
)
(set_global $logical/i
(select
(i32.const 1)
(i32.const 0)
(if (result i32)
(i32.eqz
(i32.const 0)
)
(i32.const 1)
(i32.const 0)
)
)
(if
@ -122,12 +122,12 @@
(unreachable)
)
(set_global $logical/I
(select
(i64.const 1)
(i64.const 2)
(if (result i64)
(i64.eqz
(i64.const 1)
)
(i64.const 1)
(i64.const 2)
)
)
(if
@ -140,12 +140,12 @@
(unreachable)
)
(set_global $logical/I
(select
(i64.const 1)
(i64.const 0)
(if (result i64)
(i64.eqz
(i64.const 0)
)
(i64.const 1)
(i64.const 0)
)
)
(if
@ -158,13 +158,13 @@
(unreachable)
)
(set_global $logical/f
(select
(f32.const 1)
(f32.const 2)
(if (result f32)
(f32.eq
(f32.const 1)
(f32.const 0)
)
(f32.const 1)
(f32.const 2)
)
)
(if
@ -177,13 +177,13 @@
(unreachable)
)
(set_global $logical/f
(select
(f32.const 1)
(f32.const 0)
(if (result f32)
(f32.eq
(f32.const 0)
(f32.const 0)
)
(f32.const 1)
(f32.const 0)
)
)
(if
@ -196,13 +196,13 @@
(unreachable)
)
(set_global $logical/F
(select
(f64.const 1)
(f64.const 2)
(if (result f64)
(f64.eq
(f64.const 1)
(f64.const 0)
)
(f64.const 1)
(f64.const 2)
)
)
(if
@ -215,13 +215,13 @@
(unreachable)
)
(set_global $logical/F
(select
(f64.const 1)
(f64.const 0)
(if (result f64)
(f64.eq
(f64.const 0)
(f64.const 0)
)
(f64.const 1)
(f64.const 0)
)
)
(if

View File

@ -18,13 +18,13 @@
)
(loop $continue|0
(if
(select
(if (result i32)
(get_local $2)
(i32.rem_u
(get_local $3)
(i32.const 4)
)
(get_local $2)
(get_local $2)
)
(block
(set_local $4

View File

@ -26,15 +26,15 @@
(block $break|0
(loop $continue|0
(if
(select
(if (result i32)
(i32.eqz
(get_local $2)
)
(get_local $2)
(i32.rem_u
(get_local $4)
(i32.const 4)
)
(i32.eqz
(get_local $2)
)
)
(block
(block

View File

@ -65,13 +65,13 @@
)
(loop $continue|0
(if
(select
(if (result i32)
(get_local $2)
(i32.rem_u
(get_local $3)
(i32.const 4)
)
(get_local $2)
(get_local $2)
)
(block
(set_local $4

View File

@ -86,13 +86,13 @@
)
(loop $continue|0
(if
(select
(if (result i32)
(get_local $2)
(i32.rem_u
(get_local $3)
(i32.const 4)
)
(get_local $2)
(get_local $2)
)
(block
(set_local $4

View File

@ -134,15 +134,15 @@
(block $break|0
(loop $continue|0
(if
(select
(if (result i32)
(i32.eqz
(get_local $2)
)
(get_local $2)
(i32.rem_u
(get_local $4)
(i32.const 4)
)
(i32.eqz
(get_local $2)
)
)
(block
(block
@ -4271,12 +4271,12 @@
(if (result i32)
(i32.eqz
(tee_local $0
(select
(i32.const 1)
(i32.const 2)
(if (result i32)
(i32.eqz
(i32.const 1)
)
(i32.const 1)
(i32.const 2)
)
)
)
@ -4288,13 +4288,13 @@
(if (result f64)
(f64.eq
(tee_local $3
(select
(f64.const 1)
(f64.const 2)
(if (result f64)
(f64.eq
(f64.const 1)
(f64.const 0)
)
(f64.const 1)
(f64.const 2)
)
)
(f64.const 0)
@ -4304,12 +4304,12 @@
)
)
(set_global $logical/i
(select
(i32.const 1)
(i32.const 2)
(if (result i32)
(i32.eqz
(i32.const 1)
)
(i32.const 1)
(i32.const 2)
)
)
(if
@ -4322,12 +4322,12 @@
(unreachable)
)
(set_global $logical/i
(select
(i32.const 1)
(i32.const 0)
(if (result i32)
(i32.eqz
(i32.const 0)
)
(i32.const 1)
(i32.const 0)
)
)
(if
@ -4340,12 +4340,12 @@
(unreachable)
)
(set_global $logical/I
(select
(i64.const 1)
(i64.const 2)
(if (result i64)
(i64.eqz
(i64.const 1)
)
(i64.const 1)
(i64.const 2)
)
)
(if
@ -4358,12 +4358,12 @@
(unreachable)
)
(set_global $logical/I
(select
(i64.const 1)
(i64.const 0)
(if (result i64)
(i64.eqz
(i64.const 0)
)
(i64.const 1)
(i64.const 0)
)
)
(if
@ -4376,13 +4376,13 @@
(unreachable)
)
(set_global $logical/f
(select
(f32.const 1)
(f32.const 2)
(if (result f32)
(f32.eq
(f32.const 1)
(f32.const 0)
)
(f32.const 1)
(f32.const 2)
)
)
(if
@ -4395,13 +4395,13 @@
(unreachable)
)
(set_global $logical/f
(select
(f32.const 1)
(f32.const 0)
(if (result f32)
(f32.eq
(f32.const 0)
(f32.const 0)
)
(f32.const 1)
(f32.const 0)
)
)
(if
@ -4414,13 +4414,13 @@
(unreachable)
)
(set_global $logical/F
(select
(f64.const 1)
(f64.const 2)
(if (result f64)
(f64.eq
(f64.const 1)
(f64.const 0)
)
(f64.const 1)
(f64.const 2)
)
)
(if
@ -4433,13 +4433,13 @@
(unreachable)
)
(set_global $logical/F
(select
(f64.const 1)
(f64.const 0)
(if (result f64)
(f64.eq
(f64.const 0)
(f64.const 0)
)
(f64.const 1)
(f64.const 0)
)
)
(if

View File

@ -472,13 +472,13 @@
)
(loop $continue|0
(if
(select
(if (result i32)
(get_local $2)
(i32.rem_u
(get_local $1)
(i32.const 4)
)
(get_local $2)
(get_local $2)
)
(block
(set_local $4

View File

@ -527,15 +527,15 @@
(block $break|0
(loop $continue|0
(if
(select
(if (result i32)
(i32.eqz
(get_local $2)
)
(get_local $2)
(i32.rem_u
(get_local $1)
(i32.const 4)
)
(i32.eqz
(get_local $2)
)
)
(block
(block