nir/opt_algebraic: create ubfe with non constant mask

Foz-DB Navi21:
Totals from 278 (0.35% of 79395) affected shaders:
MaxWaves: 7444 -> 7448 (+0.05%)
Instrs: 316069 -> 314584 (-0.47%); split: -0.47%, +0.00%
CodeSize: 1608064 -> 1593204 (-0.92%)
VGPRs: 11128 -> 11120 (-0.07%)
Latency: 796599 -> 797786 (+0.15%); split: -0.19%, +0.34%
InvThroughput: 141195 -> 139472 (-1.22%); split: -1.22%, +0.00%
Copies: 28565 -> 29796 (+4.31%); split: -0.15%, +4.46%
PreSGPRs: 14335 -> 14336 (+0.01%)
VALU: 161342 -> 159426 (-1.19%)
SALU: 87794 -> 88305 (+0.58%); split: -0.03%, +0.61%

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31852>
This commit is contained in:
Georg Lehmann
2024-10-25 19:52:55 +02:00
committed by Marge Bot
parent be68aeafdc
commit d6535f2602

View File

@@ -562,6 +562,12 @@ optimizations.extend([
('ubfe', a, b, ('bit_count', c)),
'options->has_bfe && !options->avoid_ternary_with_two_constants'),
(('iand@32', ('ushr@32', a, b), ('bfm', c, 0)),
('ubfe', a, b, c), 'options->has_bfe'),
(('ushr', ('iand', a, ('bfm', c, b)), b),
('ubfe', a, b, c), 'options->has_bfe'),
# Collapse two bitfield extracts with constant operands into a single one.
(('ubfe', ('ubfe', a, '#b', '#c'), '#d', '#e'),
ubfe_ubfe(a, b, c, d, e)),