nir/opt_algebraic: optimize d3d9 iand(a, inot(b))

Foz-DB GFX1201:
Totals from 24 (0.02% of 112525) affected shaders:
Instrs: 15598 -> 15426 (-1.10%); split: -1.17%, +0.06%
CodeSize: 88716 -> 88260 (-0.51%); split: -0.98%, +0.46%
Latency: 54419 -> 53965 (-0.83%); split: -0.91%, +0.08%
InvThroughput: 10294 -> 10166 (-1.24%); split: -1.28%, +0.04%
VClause: 302 -> 300 (-0.66%)
SClause: 367 -> 363 (-1.09%); split: -1.63%, +0.54%
Copies: 712 -> 705 (-0.98%); split: -3.09%, +2.11%
PreSGPRs: 1402 -> 1424 (+1.57%); split: -0.14%, +1.71%
PreVGPRs: 850 -> 848 (-0.24%)
VALU: 9730 -> 9591 (-1.43%)
SALU: 1579 -> 1649 (+4.43%)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40104>
This commit is contained in:
Georg Lehmann 2026-02-25 22:11:15 +01:00 committed by Marge Bot
parent a3f9c347bf
commit 6b464785b9

View file

@ -1648,6 +1648,8 @@ optimizations.extend([
(('fmul', ('b2f', ('fneu', a, 0)), a), ('fmul', 1.0, a)),
(('ffma', ('b2f', ('fneu', a, 0)), a, b), ('fadd', a, b)),
(('fsat', ('fadd', ('b2f', 'a@1'), ('b2f', 'b@1'))), ('b2f', ('ior', a, b))),
(('fsat', ('fadd', ('b2f', 'a@1'), ('fneg', ('b2f', 'b@1')))), ('b2f', ('iand', a, ('inot', b)))),
(('fmax', ('fadd', ('b2f', 'a@1'), ('fneg', ('b2f', 'b@1'))), 0.0), ('b2f', ('iand', a, ('inot', b)))),
(('iand', 'a@bool16', 1.0), ('b2f', a)),
(('iand', 'a@bool32', 1.0), ('b2f', a)),
(('flt', ('fneg', ('b2f', 'a@1')), 0), a), # Generated by TGSI KILL_IF.