aco: Unset 16 and 24-bit flags from operands in apply_extract.
authorTimur Kristóf <timur.kristof@gmail.com>
Thu, 26 Aug 2021 08:47:10 +0000 (10:47 +0200)
committerMarge Bot <eric+marge@anholt.net>
Mon, 30 Aug 2021 14:05:33 +0000 (14:05 +0000)
commit76b9dd6266f4b170e94ee47a6881c3d528c25969
tree979db934dd2d826de466f474c5e281f0647a6275
parent849033e6d8ba7befeb560278bb9b24c2469de498
aco: Unset 16 and 24-bit flags from operands in apply_extract.

Consider the following sequence in a shader:
b = p_extract a
c = v_mad_u32_u16 b, X, 0

The optimizer applies extract, resulting in:
c = v_mad_u32_u16 a, X, 0 (correct)

Then it mistakenly turns that into:
c = v_mul_u32_u24 a, X, 0 (incorrect)

In this case, the p_extract is applied to v_mad_u32_u16 by
apply_extract. After this, we can no longer be sure that
the operands are still 16 or 24-bit, so we have to remove
this flag.

No Fossil DB changes.

Fixes: 54292e99c7844500314bfd623469c65adef954c5
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12558>
src/amd/compiler/aco_optimizer.cpp