pan/bi: Handle needless conversions in nir_lower_bool_to_bitsize

We can end up with conversion instructions to the same type of integer
with nir_lower_bool_to_bitsize so let's make
bifrost_nir_lower_algebraic_late handle those cases.

Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36629>
This commit is contained in:
Mary Guillemard
2025-08-05 11:04:58 +00:00
committed by Marge Bot
parent 9ec1bb0111
commit ef7095c85b
@@ -106,6 +106,12 @@ algebraic_late = [
(('ffract', a), ('fadd', a, ('fneg', ('ffloor', a))), 'gpu_arch >= 11'),
]
# nir_lower_bool_to_bitsize can generate needless conversions.
for bits in [8, 16, 32]:
algebraic_late += [
((f'i2i{bits}', f'a@{bits}'), a)
]
# On v11+, ICMP_OR.v4u8 was removed
for cond in ['ilt', 'ige', 'ieq', 'ine', 'ult', 'uge']:
convert_8bit = 'u2u8'