diff options
author | Matt Turner <[email protected]> | 2015-02-10 21:43:32 -0800 |
---|---|---|
committer | Matt Turner <[email protected]> | 2015-02-11 13:50:19 -0800 |
commit | 4c42e1116b552cca1ed667c20ae9ba966b580983 (patch) | |
tree | b117f90e3f0d305cc1595a3ef3c4f4f2d651c557 | |
parent | 56e21647e20db8e3708001a8600c3d8e7d12d841 (diff) |
nir: Recognize open-coded fmin/fmax.
And unfortunately other shaders do the same thing but with >=/<= which
we can't apply this optimization to because of NaNs.
instructions in affected programs: 23309 -> 22938 (-1.59%)
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r-- | src/glsl/nir/nir_opt_algebraic.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 2b4259e4654..83223f768cd 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -82,6 +82,8 @@ optimizations = [ (('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))), (('fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))), (('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)), (('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a)), # Comparison with the same args. Note that these are not done for # the float versions because NaN always returns false on float |