Mesa (master): nir/algebraic: Remove some redundant b2f logic-op reduction patterns

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Feb 20 01:53:36 UTC 2021


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

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Tue Jan 12 12:51:33 2021 -0800

nir/algebraic: Remove some redundant b2f logic-op reduction patterns

There are patterns that will re-write the fmin or fmax part into a form
that other patterns will gradually convert to the same ior or iand.  For
example,

    fmax(b2f(a), b2f(b)) != 0
    b2f(a || b) != 0
    a || b

No shader-db or fossil-db changes on any Intel platform.

Reviewed-by: Matt Turner <mattst88 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9122>

---

 src/compiler/nir/nir_opt_algebraic.py | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 87dce5d7a25..234c3120abf 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -404,21 +404,17 @@ optimizations.extend([
    (('fge', ('fneg', ('b2f', 'a at 1')), 0.0), ('inot', a)),
 
    (('fneu', ('fadd', ('b2f', 'a at 1'), ('b2f', 'b at 1')), 0.0), ('ior', a, b)),
-   (('fneu', ('fmax', ('b2f', 'a at 1'), ('b2f', 'b at 1')), 0.0), ('ior', a, b)),
    (('fneu', ('bcsel', a, 1.0, ('b2f', 'b at 1'))   , 0.0), ('ior', a, b)),
    (('fneu', ('b2f', 'a at 1'), ('fneg', ('b2f', 'b at 1'))),      ('ior', a, b)),
    (('fneu', ('fmul', ('b2f', 'a at 1'), ('b2f', 'b at 1')), 0.0), ('iand', a, b)),
-   (('fneu', ('fmin', ('b2f', 'a at 1'), ('b2f', 'b at 1')), 0.0), ('iand', a, b)),
    (('fneu', ('bcsel', a, ('b2f', 'b at 1'), 0.0)   , 0.0), ('iand', a, b)),
    (('fneu', ('fadd', ('b2f', 'a at 1'), ('fneg', ('b2f', 'b at 1'))), 0.0), ('ixor', a, b)),
    (('fneu',          ('b2f', 'a at 1') ,          ('b2f', 'b at 1') ),      ('ixor', a, b)),
    (('fneu', ('fneg', ('b2f', 'a at 1')), ('fneg', ('b2f', 'b at 1'))),      ('ixor', a, b)),
    (('feq', ('fadd', ('b2f', 'a at 1'), ('b2f', 'b at 1')), 0.0), ('inot', ('ior', a, b))),
-   (('feq', ('fmax', ('b2f', 'a at 1'), ('b2f', 'b at 1')), 0.0), ('inot', ('ior', a, b))),
    (('feq', ('bcsel', a, 1.0, ('b2f', 'b at 1'))   , 0.0), ('inot', ('ior', a, b))),
    (('feq', ('b2f', 'a at 1'), ('fneg', ('b2f', 'b at 1'))),      ('inot', ('ior', a, b))),
    (('feq', ('fmul', ('b2f', 'a at 1'), ('b2f', 'b at 1')), 0.0), ('inot', ('iand', a, b))),
-   (('feq', ('fmin', ('b2f', 'a at 1'), ('b2f', 'b at 1')), 0.0), ('inot', ('iand', a, b))),
    (('feq', ('bcsel', a, ('b2f', 'b at 1'), 0.0)   , 0.0), ('inot', ('iand', a, b))),
    (('feq', ('fadd', ('b2f', 'a at 1'), ('fneg', ('b2f', 'b at 1'))), 0.0), ('ieq', a, b)),
    (('feq',          ('b2f', 'a at 1') ,          ('b2f', 'b at 1') ),      ('ieq', a, b)),



More information about the mesa-commit mailing list