agx: reassociate bcsel with ior/iand

fairly dramatic improvement to citra shaders, citra seems to be a % faster with
this.

total instructions in shared programs: 2910477 -> 2909192 (-0.04%)
instructions in affected programs: 983562 -> 982277 (-0.13%)
helped: 529
HURT: 1
Instructions are helped.

total bytes in shared programs: 19400010 -> 19392214 (-0.04%)
bytes in affected programs: 6785058 -> 6777262 (-0.11%)
helped: 529
HURT: 58
Bytes are helped.

total halfregs in shared programs: 519553 -> 519429 (-0.02%)
halfregs in affected programs: 1877 -> 1753 (-6.61%)
helped: 37
HURT: 12
Halfregs are helped.

total spills in shared programs: 135040 -> 135022 (-0.01%)
spills in affected programs: 135040 -> 135022 (-0.01%)
helped: 6
HURT: 0

total fills in shared programs: 342326 -> 342308 (<.01%)
fills in affected programs: 342326 -> 342308 (<.01%)
helped: 6
HURT: 0

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
This commit is contained in:
Alyssa Rosenzweig
2024-01-19 18:14:55 -04:00
committed by Marge Bot
parent b45d54a388
commit 27d39bf544

View File

@@ -83,7 +83,16 @@ lower_pack = [
('isub', 32, 'bits'))),
]
lower_selects = []
# Rewriting bcsel(a || b, ...) in terms of bcsel(a, ...) and bcsel(b, ...) lets
# our rules to fuse compare-and-select do a better job, assuming that a and b
# are comparisons themselves.
lower_selects = [
(('bcsel', ('ior(is_used_once)', a, b), c, d),
('bcsel', a, c, ('bcsel', b, c, d))),
(('bcsel', ('iand(is_used_once)', a, b), c, d),
('bcsel', a, ('bcsel', b, c, d), d)),
]
for T, sizes, one in [('f', [16, 32], 1.0),
('i', [8, 16, 32], 1),