[Mesa-dev] [PATCH] nir: Add variants of some of the comparison simplifications.

Eric Anholt eric at anholt.net
Wed Jan 28 17:16:07 PST 2015


We end up with these from TGSI-to-NIR because the pass generating the
comparisons doesn't know if the arg is actually a bool input or not.

total instructions in shared programs: 41801 -> 41508 (-0.70%)
instructions in affected programs:     4253 -> 3960 (-6.89%)
---
 src/glsl/nir/nir_opt_algebraic.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 9c62b28..122555b 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -71,6 +71,10 @@ optimizations = [
    (('inot', ('fge', a, b)), ('flt', a, b)),
    (('inot', ('ilt', a, b)), ('ige', a, b)),
    (('inot', ('ige', a, b)), ('ilt', a, b)),
+   (('ine', ('flt', a, b), 0), ('flt', a, b)),
+   (('ine', ('fge', a, b), 0), ('fge', a, b)),
+   (('ine', ('ilt', a, b), 0), ('ilt', a, b)),
+   (('ine', ('ige', a, b), 0), ('ige', a, b)),
    (('flt', ('fadd', a, b), 0.0), ('flt', a, ('fneg', b))),
    (('fge', ('fadd', a, b), 0.0), ('fge', a, ('fneg', b))),
    (('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),
-- 
2.1.4



More information about the mesa-dev mailing list