summaryrefslogtreecommitdiffstats
path: root/src/glsl/nir/nir_opt_algebraic.py
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-03-17 23:30:43 -0700
committerMatt Turner <[email protected]>2015-03-24 14:43:37 -0700
commit3fb56805f0dbfe929cd733e15566197bc0733290 (patch)
treeb28924ffffba6c87fb4fd0b3c181b134cd59767c /src/glsl/nir/nir_opt_algebraic.py
parentc31158d2cb06a864cf44d6d4f2c539e359990d3d (diff)
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 <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/glsl/nir/nir_opt_algebraic.py')
-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 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.