summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2016-03-02 15:32:50 -0800
committerIan Romanick <ian.d.romanick@intel.com>2018-03-19 14:38:29 -0700
commit21e088a5abe23a3494560a58b233114430d18067 (patch)
treea0919e12df36c13b5fbd67427903b437f55eabf9
parent81a1c7edca8da23b0d35cdb619eb3989b4c71599 (diff)
nir: Eliminate spurious i2f when comparing with an integer 0
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 6ad1d4b720d..bdf495615cd 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -217,6 +217,8 @@ optimizations = [
# 1.0 >= i2f(a)
# 1 >= a
(('fge', ('fadd', ('fneg', ('i2f32', a)), 1.0), 0.0), ('ige', 1, a)),
+ (('fne', ('i2f32', a), 0.0), ('ine', a, 0)),
+ (('feq', ('i2f32', a), 0.0), ('ieq', a, 0)),
(('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
(('~bcsel', ('flt', b, a), b, a), ('fmin', a, b)),