nir/algebraic: use is_used_once for comparison patterns

otherwise we are just creating new instructions while not removing any

Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32172>
This commit is contained in:
Marek Olšák
2024-11-28 08:58:39 -05:00
committed by Marge Bot
parent 3c441191d9
commit ebec182b04

View File

@@ -2636,9 +2636,11 @@ for bit_size in [8, 16, 32, 64]:
invert = OrderedDict([('feq', 'fneu'), ('fneu', 'feq')])
for left, right in itertools.combinations_with_replacement(invert.keys(), 2):
optimizations.append((('inot', ('ior(is_used_once)', (left, a, b), (right, c, d))),
optimizations.append((('inot', ('ior(is_used_once)', (left + '(is_used_once)', a, b),
(right + '(is_used_once)', c, d))),
('iand', (invert[left], a, b), (invert[right], c, d))))
optimizations.append((('inot', ('iand(is_used_once)', (left, a, b), (right, c, d))),
optimizations.append((('inot', ('iand(is_used_once)', (left + '(is_used_once)', a, b),
(right + '(is_used_once)', c, d))),
('ior', (invert[left], a, b), (invert[right], c, d))))
# Optimize x2yN(b2x(x)) -> b2y