[Mesa-dev] [PATCH 13/10] nir: don't turn ieq/ine into inot if used by an if

Timothy Arceri timothy.arceri at collabora.com
Sun Jan 8 13:05:26 UTC 2017


Otherwise we will end up with an extra instruction to compare the
result of the inot.

On BDW:

total instructions in shared programs: 13060620 -> 13060481 (-0.00%)
instructions in affected programs: 103379 -> 103240 (-0.13%)
helped: 127
HURT: 0

total cycles in shared programs: 256590950 -> 256587408 (-0.00%)
cycles in affected programs: 11324730 -> 11321188 (-0.03%)
helped: 114
HURT: 21
---
 src/compiler/nir/nir_opt_algebraic.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 1ad7708..bfb8d8d 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -270,9 +270,9 @@ optimizations = [
    (('~frcp', ('frsq', a)), ('fsqrt', a), '!options->lower_fsqrt'),
    # Boolean simplifications
    (('ieq', 'a at bool', True), a),
-   (('ine', 'a at bool', True), ('inot', a)),
+   (('!ine', 'a at bool', True), ('inot', a)),
    (('ine', 'a at bool', False), a),
-   (('ieq', 'a at bool', False), ('inot', 'a')),
+   (('!ieq', 'a at bool', False), ('inot', 'a')),
    (('bcsel', a, True, False), a),
    (('bcsel', a, False, True), ('inot', a)),
    (('bcsel at 32', a, 1.0, 0.0), ('b2f', a)),
-- 
2.9.3



More information about the mesa-dev mailing list