Module: Mesa Branch: main Commit: a7f2d821ecf8a3bf670df6431fb5aaf1f39b98f3 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a7f2d821ecf8a3bf670df6431fb5aaf1f39b98f3
Author: Timur Kristóf <[email protected]> Date: Mon Jul 3 17:06:50 2023 +0200 ac/nir: Simplify arg unpacking when shift is zero. This is so we can just use the same function when it's zero. Signed-off-by: Timur Kristóf <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24005> --- src/amd/common/ac_nir.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/amd/common/ac_nir.c b/src/amd/common/ac_nir.c index cdb609c05fb..8ed83771d67 100644 --- a/src/amd/common/ac_nir.c +++ b/src/amd/common/ac_nir.c @@ -40,7 +40,10 @@ ac_nir_unpack_arg(nir_builder *b, const struct ac_shader_args *ac_args, struct a unsigned rshift, unsigned bitwidth) { nir_ssa_def *value = ac_nir_load_arg(b, ac_args, arg); - return nir_ubfe_imm(b, value, rshift, bitwidth); + if (rshift) + return nir_ubfe_imm(b, value, rshift, bitwidth); + else + return nir_iand_imm(b, value, BITFIELD_MASK(bitwidth)); } static bool
