From 83f51212c1099bf675c0ef060a9c749b19614af5 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 20 Nov 2021 21:11:57 +0100 Subject: [PATCH] ac/llvm: Implement uclz. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Georg Lehmann Reviewed-by: Timur Kristóf Part-of: --- src/amd/llvm/ac_nir_to_llvm.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 50dd2e0665f..e3d7a398b58 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -1086,6 +1086,14 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) case nir_op_ifind_msb: result = ac_build_imsb(&ctx->ac, src[0], ctx->ac.i32); break; + case nir_op_uclz: { + LLVMValueRef params[2] = { + src[0], + ctx->ac.i1false, + }; + result = ac_build_intrinsic(&ctx->ac, "llvm.ctlz.i32", ctx->ac.i32, params, 2, AC_FUNC_ATTR_READNONE); + break; + } case nir_op_uadd_carry: result = emit_uint_carry(&ctx->ac, "llvm.uadd.with.overflow.i32", src[0], src[1]); break;