Mesa (master): nir/algebraic: propagate b2i out of ior/iand

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 20 16:31:07 UTC 2020


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

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Wed Jul 15 19:30:34 2020 +0200

nir/algebraic: propagate b2i out of ior/iand

Totals from 761 (0.57% of 134368) affected shaders (Polaris):
SGPRs: 29496 -> 29488 (-0.03%)
SpillSGPRs: 41 -> 43 (+4.88%)
CodeSize: 1922036 -> 1882408 (-2.06%); split: -2.08%, +0.02%
Instrs: 366051 -> 360362 (-1.55%); split: -1.57%, +0.02%
Cycles: 7692516 -> 7661216 (-0.41%); split: -0.41%, +0.01%
VMEM: 365175 -> 365172 (-0.00%)
VClause: 15324 -> 15322 (-0.01%)
SClause: 9825 -> 9824 (-0.01%); split: -0.02%, +0.01%
Copies: 41216 -> 41294 (+0.19%); split: -0.01%, +0.20%
Branches: 7020 -> 7033 (+0.19%)
PreSGPRs: 22103 -> 22106 (+0.01%)
PreVGPRs: 26518 -> 26515 (-0.01%)

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4830>

---

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

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 213bc843a68..c2e961d020c 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -753,6 +753,8 @@ optimizations.extend([
    (('feq', ('fneg', a), a), ('feq', a, 0.0)),
    # Emulating booleans
    (('imul', ('b2i', 'a at 1'), ('b2i', 'b at 1')), ('b2i', ('iand', a, b))),
+   (('iand', ('b2i', 'a at 1'), ('b2i', 'b at 1')), ('b2i', ('iand', a, b))),
+   (('ior', ('b2i', 'a at 1'), ('b2i', 'b at 1')), ('b2i', ('ior', a, b))),
    (('fmul', ('b2f', 'a at 1'), ('b2f', 'b at 1')), ('b2f', ('iand', a, b))),
    (('fsat', ('fadd', ('b2f', 'a at 1'), ('b2f', 'b at 1'))), ('b2f', ('ior', a, b))),
    (('iand', 'a at bool32', 1.0), ('b2f', a)),



More information about the mesa-commit mailing list