From: Matt Turner Date: Wed, 18 Mar 2015 06:30:43 +0000 (-0700) Subject: nir: Recognize sat(add(b2f(a), b2f(b))) as a logical OR. X-Git-Tag: upstream/17.1.0~19825 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3fb56805f0dbfe929cd733e15566197bc0733290;p=platform%2Fupstream%2Fmesa.git nir: Recognize sat(add(b2f(a), b2f(b))) as a logical OR. Transform this into b2f(or(a, b)). instructions in affected programs: 432 -> 430 (-0.46%) helped: 2 Acked-by: Ian Romanick Reviewed-by: Connor Abbott Reviewed-by: Jason Ekstrand --- diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index f956edf..1ee51a0 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -97,6 +97,7 @@ optimizations = [ (('fmin', ('fmax', ('fmin', ('fmax', a, 0.0), 1.0), 0.0), 1.0), ('fmin', ('fmax', a, 0.0), 1.0)), # Emulating booleans (('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', a, b))), + (('fsat', ('fadd', ('b2f', a), ('b2f', b))), ('b2f', ('ior', a, b))), # Comparison with the same args. Note that these are not done for # the float versions because NaN always returns false on float # inequalities.