zink: Fix incorrect emission of SPIR-V shift ops
authorSoroushIMG <soroush.kashani@imgtec.com>
Mon, 15 Aug 2022 22:17:09 +0000 (23:17 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 19 Aug 2022 09:35:46 +0000 (09:35 +0000)
commitb386df918fd3274b3814c639ad7297f5b07cc48a
treed03bc4ee994aa2e979aab8bbb0750575fa7cbcb8
parentf0f22d850cad39065f07892cf0f45c6284131bf5
zink: Fix incorrect emission of SPIR-V shift ops

SPIR-V shift ops unlike NIR have undefined behavior if shift count
larger than or equalt to bitwidth.
This means that true translation of NIR ishl/ishr/ushr to SPIR-V requires
masking like that done in gallivm.
This was seen in the case of soft fp64 in cts case
KHR-GL46.gpu_shader_fp64.builtin.ceil_double.

Cc: mesa-stable
Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18074>
src/gallium/drivers/zink/nir_to_spirv/nir_to_spirv.c