Mesa (master): nir: Collapse repeated bcsels on the same argument.

Eric Anholt anholt at kemper.freedesktop.org
Sat Feb 21 23:03:14 UTC 2015


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

Author: Eric Anholt <eric at anholt.net>
Date:   Fri Feb 20 01:20:34 2015 -0800

nir: Collapse repeated bcsels on the same argument.

vc4 results:
total instructions in shared programs: 39881 -> 39794 (-0.22%)
instructions in affected programs:     6302 -> 6215 (-1.38%)

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>

---

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

diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index c3a884b..3ea6320 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -86,6 +86,7 @@ optimizations = [
    (('bcsel', ('flt', a, b), a, b), ('fmin', a, b)),
    (('bcsel', ('flt', a, b), b, a), ('fmax', a, b)),
    (('bcsel', ('inot', 'a at bool'), b, c), ('bcsel', a, c, b)),
+   (('bcsel', a, ('bcsel', a, b, c), d), ('bcsel', a, b, d)),
    (('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'),
    (('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'),
    (('fsat', ('fsat', a)), ('fsat', a)),




More information about the mesa-commit mailing list