pan/mdg: Lower ufind_msb, poorly

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8774>
This commit is contained in:
Alyssa Rosenzweig 2021-01-27 13:02:01 -05:00
parent 36248dd448
commit 4a2f128985
1 changed files with 6 additions and 0 deletions

View File

@ -71,6 +71,12 @@ algebraic_late = [
(('fmul', a, 2.0), ('fadd', a, a))
]
# Size conversion is redundant to Midgard but needed for NIR, and writing this
# lowering in MIR would be painful without a competent builder, so eat the
# extra instruction
for sz in ('8', '16', '32'):
converted = ('u2u32', a) if sz != '32' else a
algebraic_late += [(('ufind_msb', 'a@' + sz), ('isub', 31, ('uclz', converted)))]
# Midgard is able to type convert down by only one "step" per instruction; if
# NIR wants more than one step, we need to break up into multiple instructions.