summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_algebraic.py
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-01-12 21:51:56 +1100
committerTimothy Arceri <[email protected]>2017-01-14 23:26:22 +1100
commit772cd3104852302aedf87895cef7828ccacedee2 (patch)
tree91e4f5998d6d78e80dd86e908a6ab851e33bc5b3 /src/compiler/nir/nir_opt_algebraic.py
parent0d5071db5e50629a63490639a3c86dfc65bf27ab (diff)
nir: optimise min/max fadd combos
shader-db results BDW: total instructions in shared programs: 13060410 -> 13060313 (-0.00%) instructions in affected programs: 24533 -> 24436 (-0.40%) helped: 88 HURT: 0 total cycles in shared programs: 256585692 -> 256586698 (0.00%) cycles in affected programs: 647290 -> 648296 (0.16%) helped: 35 HURT: 30 Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opt_algebraic.py')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index a557f7bf37d..d7ad1f2fbf3 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -522,6 +522,10 @@ late_optimizations = [
(('b2f(is_used_more_than_once)', ('inot', a)), ('bcsel', a, 0.0, 1.0)),
(('fneg(is_used_more_than_once)', ('b2f', ('inot', a))), ('bcsel', a, -0.0, -1.0)),
+
+ # we do these late so that we don't get in the way of creating ffmas
+ (('fmin', ('fadd(is_used_once)', '#c', a), ('fadd(is_used_once)', '#c', b)), ('fadd', c, ('fmin', a, b))),
+ (('fmax', ('fadd(is_used_once)', '#c', a), ('fadd(is_used_once)', '#c', b)), ('fadd', c, ('fmax', a, b))),
]
print nir_algebraic.AlgebraicPass("nir_opt_algebraic", optimizations).render()