nir/opt_algebraic: optimize ineg(a) == ineg(b)

DXBC boolean cleanup.

Foz-DB Navi21:
Totals from 19 (0.02% of 79188) affected shaders:
Instrs: 9720 -> 9652 (-0.70%)
CodeSize: 54056 -> 53640 (-0.77%)
Latency: 95357 -> 94377 (-1.03%); split: -1.03%, +0.00%
InvThroughput: 17331 -> 16939 (-2.26%)
Copies: 604 -> 605 (+0.17%)
PreSGPRs: 832 -> 838 (+0.72%)
PreVGPRs: 701 -> 699 (-0.29%)
VALU: 6551 -> 6485 (-1.01%)
SALU: 893 -> 891 (-0.22%); split: -1.68%, +1.46%

v2 (idr): Remove a pattern that is now redundant. The version without
ineg already exists much earlier in the file. Search for b2iN.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33498>
This commit is contained in:
Georg Lehmann 2025-02-08 17:02:01 +01:00 committed by Marge Bot
parent dd1a7f0e8c
commit 3e4ac92298

View file

@ -695,6 +695,10 @@ optimizations.extend([
(('ine', ('ineg', a), 0), ('ine', a, 0)),
(('ieq', ('iabs', a), 0), ('ieq', a, 0)),
(('ine', ('iabs', a), 0), ('ine', a, 0)),
(('ieq', ('ineg', a), ('ineg', b)), ('ieq', a, b)),
(('ine', ('ineg', a), ('ineg', b)), ('ine', a, b)),
(('fneu', ('fabs', a), 0.0), ('fneu', a, 0.0)),
(('feq', ('fabs', a), 0.0), ('feq', a, 0.0)),
(('fneu', ('fabs', a), ('fabs', a)), ('fneu', a, a)),
@ -1283,7 +1287,6 @@ optimizations.extend([
(('uge', a, 1), ('ine', a, 0)),
(('ult', a, 1), ('ieq', a, 0)),
(('ine', ('ineg', ('b2i', 'a@1')), ('ineg', ('b2i', 'b@1'))), ('ine', a, b)),
(('b2i', ('ine', 'a@1', 'b@1')), ('b2i', ('ixor', a, b))),
(('ishl', ('b2i32', ('ine', ('iand', 'a@32', '#b(is_pos_power_of_two)'), 0)), '#c'),