From: Eric Anholt Date: Fri, 30 Jan 2015 22:10:58 +0000 (-0800) Subject: nir: Recognize and reduce duplicated fsats. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6eadde51bba26bc57da7b26cbb40d783259d4a5f;p=mesa.git nir: Recognize and reduce duplicated fsats. No effect on vc4 shader-db. v2: Rebase to master (no TGSI->NIR present) Reviewed-by: Kenneth Graunke (v1) --- diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index c7cb651fbb4..504c9f69054 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -87,6 +87,8 @@ optimizations = [ (('bcsel', ('flt', a, b), b, a), ('fmax', a, 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)), + (('fmin', ('fmax', ('fmin', ('fmax', a, 0.0), 1.0), 0.0), 1.0), ('fmin', ('fmax', a, 0.0), 1.0)), # Comparison with the same args. Note that these are not done for # the float versions because NaN always returns false on float # inequalities.