From 8671b866bf4b7909227f8d28307937eedfb347b9 Mon Sep 17 00:00:00 2001 From: Georg Lehmann Date: Sat, 20 Nov 2021 20:45:57 +0100 Subject: [PATCH] ac/llvm: Implement usub_sat and isub_sat. 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/amd/llvm/ac_nir_to_llvm.c b/src/amd/llvm/ac_nir_to_llvm.c index 3b740cf9431..50dd2e0665f 100644 --- a/src/amd/llvm/ac_nir_to_llvm.c +++ b/src/amd/llvm/ac_nir_to_llvm.c @@ -649,6 +649,15 @@ static void visit_alu(struct ac_nir_context *ctx, const nir_alu_instr *instr) result = ac_build_intrinsic(&ctx->ac, name, def_type, src, 2, AC_FUNC_ATTR_READNONE); break; } + case nir_op_usub_sat: + case nir_op_isub_sat: { + char name[64], type[64]; + ac_build_type_name_for_intr(def_type, type, sizeof(type)); + snprintf(name, sizeof(name), "llvm.%csub.sat.%s", + instr->op == nir_op_usub_sat ? 'u' : 's', type); + result = ac_build_intrinsic(&ctx->ac, name, def_type, src, 2, AC_FUNC_ATTR_READNONE); + break; + } case nir_op_fadd: src[0] = ac_to_float(&ctx->ac, src[0]); src[1] = ac_to_float(&ctx->ac, src[1]);