nir: add nir_shr builder

Sometimes we need to select between ishr/ushr based some condition; this
builder makes this less verbose.

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37793>
This commit is contained in:
Job Noorman 2025-10-10 07:30:18 +02:00 committed by Marge Bot
parent 10a8defecc
commit 18f69890d1

View file

@ -1213,6 +1213,12 @@ nir_ushr_imm(nir_builder *build, nir_def *x, uint32_t y)
}
}
static inline nir_def *
nir_shr(nir_builder *build, bool is_signed, nir_def *x, nir_def *y)
{
return is_signed ? nir_ishr(build, x, y) : nir_ushr(build, x, y);
}
static inline nir_def *
nir_imod_imm(nir_builder *build, nir_def *x, uint64_t y)
{