summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2015-03-17 23:30:32 -0700
committerMatt Turner <mattst88@gmail.com>2015-03-24 14:43:37 -0700
commitc31158d2cb06a864cf44d6d4f2c539e359990d3d (patch)
tree755cab67b154fe26532dbf32b054a17d6c508fa7 /src
parentb481ebbe399fdc6386fd52f890ba7c310d333ed5 (diff)
downloadexternal_mesa3d-c31158d2cb06a864cf44d6d4f2c539e359990d3d.zip
external_mesa3d-c31158d2cb06a864cf44d6d4f2c539e359990d3d.tar.gz
external_mesa3d-c31158d2cb06a864cf44d6d4f2c539e359990d3d.tar.bz2
nir: Recognize mul(b2f(a), b2f(b)) as a logical AND.
Transform this into b2f(and(a, b)). total instructions in shared programs: 6205448 -> 6204391 (-0.02%) instructions in affected programs: 284030 -> 282973 (-0.37%) helped: 903 HURT: 6 Acked-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py2
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 ef855aa..f956edf 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -95,6 +95,8 @@ optimizations = [
(('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)),
+ # Emulating booleans
+ (('fmul', ('b2f', a), ('b2f', b)), ('b2f', ('iand', 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.