summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2019-03-01 14:41:59 -0800
committerIan Romanick <ian.d.romanick@intel.com>2019-03-01 14:44:02 -0800
commit3d78b0cd564d69fc146ca39e13f6556d224cd2a2 (patch)
tree4cfd0c1d0dc7e751fb8c5806fca76b31cebb69a4
parentcad6ce893045fd42c039be34fd614f600153350a (diff)
nir/algebraic: Optimize away an fsat of a b2fnir_lower_clamp_color_outputs-vs-b2f
The b2f can only produce 0.0 or 1.0, so the fsat does nothing.
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index b49f1a13161..617ca0ea933 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -337,6 +337,7 @@ optimizations = [
(('~fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'),
(('~fmax', ('fmin', a, 1.0), 0.0), ('fsat', a), '!options->lower_fsat'),
(('fsat', ('fsign', a)), ('b2f', ('flt', 0.0, a))),
+ (('fsat', ('b2f', a)), ('b2f', a)),
(('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'),
(('fsat', ('fsat', a)), ('fsat', a)),
(('fmin', ('fmax', ('fmin', ('fmax', a, b), c), b), c), ('fmin', ('fmax', a, b), c)),