Mesa (master): nir: Add a couple of simplifications of csel operations.

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


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

Author: Eric Anholt <eric at anholt.net>
Date:   Thu Jan 29 15:50:18 2015 -0800

nir: Add a couple of simplifications of csel operations.

vc4 was already cleaning these up, but it does shave 4 NIR instructions in
shader-db.

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

---

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

diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 504c9f6..ef3a029 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -145,6 +145,9 @@ optimizations = [
    # next round of opt_algebraic, get picked up by one of the above two.
    (('bcsel', '#a', b, c), ('bcsel', ('ine', 'a', 0), b, c)),
 
+   (('bcsel', a, b, b), b),
+   (('fcsel', a, b, b), b),
+
    # Subtracts
    (('fsub', 0.0, ('fsub', 0.0, a)), a),
    (('isub', 0, ('isub', 0, a)), a),




More information about the mesa-commit mailing list