nir: Add a couple of simplifications of csel operations.
authorEric Anholt <eric@anholt.net>
Thu, 29 Jan 2015 23:50:18 +0000 (15:50 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 21 Feb 2015 22:57:14 +0000 (14:57 -0800)
vc4 was already cleaning these up, but it does shave 4 NIR instructions in
shader-db.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
src/glsl/nir/nir_opt_algebraic.py

index 504c9f6..ef3a029 100644 (file)
@@ -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),