Module: Mesa
Branch: master
Commit: 3371de38f282c77461bbe5007a2fec2a975776df
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=3371de38f282c77461bbe5007a2fec2a975776df

Author: Kenneth Graunke <kenn...@whitecape.org>
Date:   Tue Aug  9 01:44:38 2016 -0700

nir: Turn bcsel of +/- 1.0 and 0.0 into b2f sequences.

On BDW:

total instructions in shared programs: 13074882 -> 13068703 (-0.05%)
instructions in affected programs: 1823116 -> 1816937 (-0.34%)
helped: 4187
HURT: 537

total cycles in shared programs: 256622718 -> 256425382 (-0.08%)
cycles in affected programs: 123790120 -> 123592784 (-0.16%)
helped: 3823
HURT: 2037

total spills in shared programs: 15276 -> 14929 (-2.27%)
spills in affected programs: 9446 -> 9099 (-3.67%)
helped: 352
HURT: 1

total fills in shared programs: 20496 -> 20144 (-1.72%)
fills in affected programs: 13040 -> 12688 (-2.70%)
helped: 352
HURT: 1

LOST:   2
GAINED: 21

v2: Rely on 'a' being a well-formed boolean (Connor, Eric).

Signed-off-by: Kenneth Graunke <kenn...@whitecape.org>
Reviewed-by: Timothy Arceri <timothy.arc...@collabora.com>
Reviewed-by: Jason Ekstrand <ja...@jlekstrand.net>

---

 src/compiler/nir/nir_opt_algebraic.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 3b8836e..434881f 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -269,6 +269,10 @@ optimizations = [
    (('ieq', 'a@bool', False), ('inot', 'a')),
    (('bcsel', a, True, False), a),
    (('bcsel', a, False, True), ('inot', a)),
+   (('bcsel@32', a, 1.0, 0.0), ('b2f', a)),
+   (('bcsel@32', a, 0.0, 1.0), ('b2f', ('inot', a))),
+   (('bcsel@32', a, -1.0, -0.0), ('fneg', ('b2f', a))),
+   (('bcsel@32', a, -0.0, -1.0), ('fneg', ('b2f', ('inot', a)))),
    (('bcsel', True, b, c), b),
    (('bcsel', False, b, c), c),
    # The result of this should be hit by constant propagation and, in the

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to