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

No Foz-DB changes.

v2 (idr): Remove some patterns that are now redundant. These were
originally removed in a commit later in the MR.

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-10 18:09:16 +01:00 committed by Marge Bot
parent 3e4ac92298
commit 000f14f7fd

View file

@ -691,8 +691,8 @@ optimizations.extend([
(('fneu', a, '#b(is_negative_zero)'), ('fneu', 0.0, a)),
(('feq', '#b(is_negative_zero)', a), ('feq', a, 0.0)),
(('ieq', ('ineg', a), 0), ('ieq', a, 0)),
(('ine', ('ineg', a), 0), ('ine', a, 0)),
(('ieq', ('ineg', 'a(is_not_const)'), '#b'), ('ieq', a, ('ineg', b))),
(('ine', ('ineg', 'a(is_not_const)'), '#b'), ('ine', a, ('ineg', b))),
(('ieq', ('iabs', a), 0), ('ieq', a, 0)),
(('ine', ('iabs', a), 0), ('ine', a, 0)),
@ -1454,8 +1454,6 @@ for s in [8, 16, 32, 64]:
])
optimizations.extend([
(('ieq', ('ineg', ('b2i', 'a@1')), -1), a),
(('ine', ('ineg', ('b2i', 'a@1')), -1), ('inot', a)),
(('ige', ('ineg', ('b2i', 'a@1')), 0), ('inot', a)),
(('ilt', ('ineg', ('b2i', 'a@1')), 0), a),
(('ult', 0, ('ineg', ('b2i', 'a@1'))), a),