From acaccff4d331ecc4b2794fef3f4b117abdd15abf Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Fri, 17 Apr 2020 09:52:25 -0500 Subject: [PATCH] nir/builder: Handle any bit-size selector in nir_extract Reviewed-by: Caio Marcelo de Oliveira Filho Part-of: --- src/compiler/nir/nir_builder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/nir/nir_builder.h b/src/compiler/nir/nir_builder.h index 69c7d312b84..481ea6382bf 100644 --- a/src/compiler/nir/nir_builder.h +++ b/src/compiler/nir/nir_builder.h @@ -580,7 +580,7 @@ _nir_vector_extract_helper(nir_builder *b, nir_ssa_def *vec, nir_ssa_def *c, return nir_channel(b, vec, start); } else { unsigned mid = start + (end - start) / 2; - return nir_bcsel(b, nir_ilt(b, c, nir_imm_int(b, mid)), + return nir_bcsel(b, nir_ilt(b, c, nir_imm_intN_t(b, mid, c->bit_size)), _nir_vector_extract_helper(b, vec, c, start, mid), _nir_vector_extract_helper(b, vec, c, mid, end)); } @@ -591,7 +591,7 @@ nir_vector_extract(nir_builder *b, nir_ssa_def *vec, nir_ssa_def *c) { nir_src c_src = nir_src_for_ssa(c); if (nir_src_is_const(c_src)) { - unsigned c_const = nir_src_as_uint(c_src); + uint64_t c_const = nir_src_as_uint(c_src); if (c_const < vec->num_components) return nir_channel(b, vec, c_const); else -- 2.30.2