[Mesa-dev] [PATCH 10/10] nir: add late opt to turn inot/b2f combos back to bcsel

Timothy Arceri timothy.arceri at collabora.com
Sat Jan 7 11:58:40 UTC 2017


We turn these from bcsel into inot/b2f combos in order for other
optimisation passes to get further, once we have finished turn
the ones that remain and are used in more than a single expression
back into a bcsel.

On BDW:

total instructions in shared programs: 13060965 -> 13060297 (-0.01%)
instructions in affected programs: 835701 -> 835033 (-0.08%)
helped: 670
HURT: 2

total cycles in shared programs: 256599536 -> 256598006 (-0.00%)
cycles in affected programs: 114655488 -> 114653958 (-0.00%)
helped: 419
HURT: 240

LOST:   0
GAINED: 1
---
 src/compiler/nir/nir_opt_algebraic.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index eaeca5e..3f7f9a0 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -522,6 +522,9 @@ late_optimizations = [
    (('fdot3', a, b), ('fdot_replicated3', a, b), 'options->fdot_replicates'),
    (('fdot4', a, b), ('fdot_replicated4', a, b), 'options->fdot_replicates'),
    (('fdph', a, b), ('fdph_replicated', a, b), 'options->fdot_replicates'),
+
+   (('%b2f', ('inot', a)), ('bcsel', a, 0.0, 1.0)),
+   (('%fneg', ('b2f', ('inot', a))), ('bcsel', a, -0.0, -1.0)),
 ]
 
 print nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render()
-- 
2.9.3



More information about the mesa-dev mailing list