summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-01-29 15:50:18 -0800
committerEric Anholt <[email protected]>2015-02-21 14:57:14 -0800
commitdc982f4a859d800ec3eba95d3c55bbe6af8d6518 (patch)
tree0e9047b3c52fe4860ca5fe6d1a8e29ceef223642
parentc2ece77678c19f6aee1d9a3ef65a1251a59dd2ae (diff)
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 <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 504c9f69054..ef3a0297457 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),