diff options
author | Ian Romanick <ian.d.romanick@intel.com> | 2016-03-01 19:13:36 -0800 |
---|---|---|
committer | Ian Romanick <ian.d.romanick@intel.com> | 2018-03-19 14:38:29 -0700 |
commit | 81a1c7edca8da23b0d35cdb619eb3989b4c71599 (patch) | |
tree | 16e36876bbf2907c4e0465cc8f97593c27b5626c | |
parent | d22be02119e0d431059ab23efe0ede3f893375dd (diff) |
nir: Eliminate spurious i2f when comparing with an integer 1
-rw-r--r-- | src/compiler/nir/nir_opt_algebraic.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index db1a11c724e..6ad1d4b720d 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -213,6 +213,11 @@ optimizations = [ # use of conditional modifiers on supported hardware. (('flt(is_not_used_by_conditional)', ('fadd(is_used_once)', a, ('fneg', b)), 0.0), ('flt', a, b)), + # -i2f(a) + 1.0 >= 0.0 + # 1.0 >= i2f(a) + # 1 >= a + (('fge', ('fadd', ('fneg', ('i2f32', a)), 1.0), 0.0), ('ige', 1, a)), + (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)), (('~bcsel', ('flt', b, a), b, a), ('fmin', a, b)), (('~bcsel', ('flt', a, b), b, a), ('fmax', a, b)), |