[Mesa-dev] [PATCH 1/5] nir: Add a couple of simplifications of csel operations.
Eric Anholt
eric at anholt.net
Fri Feb 20 12:04:49 PST 2015
vc4 was already cleaning these up, but it does shave 4 NIR instructions in
shader-db.
---
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 b0c206a..dd4557f 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -146,6 +146,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),
--
2.1.4
More information about the mesa-dev
mailing list