From 3fb56805f0dbfe929cd733e15566197bc0733290 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Tue, 17 Mar 2015 23:30:43 -0700 Subject: [PATCH] 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 --- src/glsl/nir/nir_opt_algebraic.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index f956edff3c3..1ee51a05f80 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. -- 2.30.2