nir/lower_int64: fix shift lowering
authorKarol Herbst <kherbst@redhat.com>
Fri, 25 Nov 2022 00:56:07 +0000 (01:56 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 29 Nov 2022 23:08:53 +0000 (23:08 +0000)
commit5398dd04bf62db100639d96c84a8c41041f4ad01
treedf57e4d3707c69a0672b60dabe2babe23dd94856
parent83efd336dad963d378a9a56d26be2f9cac205dd7
nir/lower_int64: fix shift lowering

Starting with !19748 lowered 64 bit shifts were showing wrong results for
shifts with insignificant bits set.

nir shifts are defined to only look at the least significant bits. The
lowering has take this into account.

So there are two things going on:
1. the `ieq` and `uge` further down depend on `y` being masked.
2. the calculation of `reverse_count` actually depends on a masked `y` as
   well, due to the `(iabs (iadd y -32))` giving a different result for
   shifts > 31;

Fixes: 41f3e9e5f5d ("nir: Implement lowering of 64-bit shift operations")
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19995>
src/compiler/nir/nir_lower_int64.c