nir/algebraic: optimize more bcsel(, bcsel())

This inot should be pretty optimizable.

fossil-db (navi21);
Totals from 2361 (2.97% of 79395) affected shaders:
MaxWaves: 50808 -> 50890 (+0.16%)
Instrs: 4168195 -> 4167332 (-0.02%); split: -0.05%, +0.03%
CodeSize: 22727496 -> 22708088 (-0.09%); split: -0.12%, +0.03%
VGPRs: 135160 -> 134824 (-0.25%)
SpillSGPRs: 723 -> 725 (+0.28%)
Latency: 37498671 -> 37479794 (-0.05%); split: -0.07%, +0.02%
InvThroughput: 10468406 -> 10453028 (-0.15%); split: -0.16%, +0.01%
VClause: 98258 -> 98283 (+0.03%); split: -0.04%, +0.07%
SClause: 111281 -> 111323 (+0.04%); split: -0.06%, +0.09%
Copies: 299281 -> 300155 (+0.29%); split: -0.17%, +0.46%
Branches: 115951 -> 116111 (+0.14%); split: -0.00%, +0.14%
PreSGPRs: 109404 -> 109462 (+0.05%); split: -0.14%, +0.19%
PreVGPRs: 114558 -> 114421 (-0.12%)
VALU: 2876823 -> 2869990 (-0.24%); split: -0.24%, +0.00%
SALU: 500286 -> 506124 (+1.17%); split: -0.03%, +1.20%

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32145>
This commit is contained in:
Rhys Perry 2024-11-19 14:53:38 +00:00 committed by Marge Bot
parent 7ef1585fd6
commit 4c7d6e9437

View file

@ -2155,7 +2155,9 @@ optimizations.extend([
(('~bcsel', ('flt', a, 0.0), ('fneg', a), a), ('fabs', a)),
(('bcsel', a, ('bcsel(is_used_once)', b, c, d), d), ('bcsel', ('iand', a, b), c, d)),
(('bcsel', a, ('bcsel(is_used_once)', b, d, c), d), ('bcsel', ('iand', a, ('inot', b)), c, d)),
(('bcsel', a, b, ('bcsel(is_used_once)', c, b, d)), ('bcsel', ('ior', a, c), b, d)),
(('bcsel', a, b, ('bcsel(is_used_once)', c, d, b)), ('bcsel', ('iand', c, ('inot', a)), d, b)),
# Misc. lowering
(('fmod', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod'),