Mesa (master): nir/algebraic: Optimize away an fsat of a b2f

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Mar 2 22:05:35 UTC 2019


Module: Mesa
Branch: master
Commit: bae0c3675174b63c7d7e25556266027b2d4f2b87
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=bae0c3675174b63c7d7e25556266027b2d4f2b87

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Fri Mar  1 14:41:59 2019 -0800

nir/algebraic: Optimize away an fsat of a b2f

The b2f can only produce 0.0 or 1.0, so the fsat does nothing.

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/compiler/nir/nir_opt_algebraic.py | 1 +
 1 file changed, 1 insertion(+)

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)),




More information about the mesa-commit mailing list