nir/builder: use amul over ishl on agx

ishl can wrap, amul cannot. so we need amul in the backend, or otherwise we
would need to introduce an ashl opcode instead. that doesn't seem better.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31964>
This commit is contained in:
Alyssa Rosenzweig 2024-11-04 10:23:48 -04:00
parent 9ab8d70fa6
commit 1f3c97547a

View file

@ -974,6 +974,8 @@ _nir_mul_imm(nir_builder *build, nir_def *x, uint64_t y, bool amul)
return x;
} else if ((!build->shader->options ||
!build->shader->options->lower_bitops) &&
!(amul && (!build->shader->options ||
build->shader->options->has_amul)) &&
util_is_power_of_two_or_zero64(y)) {
return nir_ishl(build, x, nir_imm_int(build, ffsll(y) - 1));
} else if (amul) {