summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-02-20 01:18:46 -0800
committerEric Anholt <[email protected]>2015-02-21 14:57:14 -0800
commita38038ca5e329c074f67399a993a653c8e439cae (patch)
treeb6dc9be990932837cdd79e77d75adcd2160bc9ce
parent8e1152cb33e53a9d31a6c239dd77b0b4b7613ea8 (diff)
nir: When faced with a csel on !condition, just flip the arguments.
total NIR instructions in shared programs: 39426 -> 39411 (-0.04%) NIR instructions in affected programs: 3748 -> 3733 (-0.40%) Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Connor Abbott <[email protected]>
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index ef3a0297457..c3a884bb1e6 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -85,6 +85,7 @@ optimizations = [
(('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
(('bcsel', ('flt', a, b), a, b), ('fmin', a, b)),
(('bcsel', ('flt', a, b), b, a), ('fmax', a, b)),
+ (('bcsel', ('inot', 'a@bool'), b, c), ('bcsel', a, c, b)),
(('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)),