X-Git-Url: https://git.libre-soc.org/?p=mesa.git;a=blobdiff_plain;f=src%2Fcompiler%2Fspirv%2Fvtn_opencl.c;h=b5e92dc3b85e1d53ccb321747bf8e74ec2201c73;hp=a4eb41d241bf5e9745cd6843c46618ff54c6b6e0;hb=608c87afdddb9524bce3d2ccd95c2297b453072b;hpb=a54695ddcb26b4437c361d7df8c93f6b8a990e27 diff --git a/src/compiler/spirv/vtn_opencl.c b/src/compiler/spirv/vtn_opencl.c index a4eb41d241b..b5e92dc3b85 100644 --- a/src/compiler/spirv/vtn_opencl.c +++ b/src/compiler/spirv/vtn_opencl.c @@ -117,8 +117,11 @@ handle_alu(struct vtn_builder *b, enum OpenCLstd_Entrypoints opcode, unsigned num_srcs, nir_ssa_def **srcs, const struct glsl_type *dest_type) { - return nir_build_alu(&b->nb, nir_alu_op_for_opencl_opcode(b, opcode), - srcs[0], srcs[1], srcs[2], NULL); + nir_ssa_def *ret = nir_build_alu(&b->nb, nir_alu_op_for_opencl_opcode(b, opcode), + srcs[0], srcs[1], srcs[2], NULL); + if (opcode == OpenCLstd_Popcount) + ret = nir_u2u(&b->nb, ret, glsl_get_bit_size(dest_type)); + return ret; } static nir_ssa_def *