Mesa (master): nir: Transform expressions of b2f(a) and b2f(b) to a ^^ b

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 4 08:12:21 UTC 2018


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Aug  1 19:33:24 2018 -0700

nir: Transform expressions of b2f(a) and b2f(b) to a ^^ b

All Gen platforms had pretty similar results. (Skylake shown)
total instructions in shared programs: 14276892 -> 14276886 (<.01%)
instructions in affected programs: 484 -> 478 (-1.24%)
helped: 2
HURT: 0

total cycles in shared programs: 532578397 -> 532578395 (<.01%)
cycles in affected programs: 3522 -> 3520 (-0.06%)
helped: 1
HURT: 0

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Thomas Helland <thomashelland90 at gmail.com>

---

 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 9ead2dd37d..c1ab9dd3c8 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -173,6 +173,9 @@ optimizations = [
    (('fne', ('fmul', ('b2f', a), ('b2f', b)), 0.0), ('iand', a, b)),
    (('fne', ('fmin', ('b2f', a), ('b2f', b)), 0.0), ('iand', a, b)),
    (('fne', ('bcsel', a, ('b2f', b), 0.0)   , 0.0), ('iand', a, b)),
+   (('fne', ('fadd', ('b2f', a), ('fneg', ('b2f', b))), 0.0), ('ixor', a, b)),
+   (('fne',          ('b2f', a) ,          ('b2f', b) ),      ('ixor', a, b)),
+   (('fne', ('fneg', ('b2f', a)), ('fneg', ('b2f', b))),      ('ixor', a, b)),
    (('feq', ('fadd', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
    (('feq', ('fmax', ('b2f', a), ('b2f', b)), 0.0), ('inot', ('ior', a, b))),
    (('feq', ('bcsel', a, 1.0, ('b2f', b))   , 0.0), ('inot', ('ior', a, b))),




More information about the mesa-commit mailing list