Mesa (main): ac/llvm: Implement usub_sat and isub_sat.
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 1 17:59:53 UTC 2022
Module: Mesa
Branch: main
Commit: 8671b866bf4b7909227f8d28307937eedfb347b9
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8671b866bf4b7909227f8d28307937eedfb347b9
Author: Georg Lehmann <dadschoorse at gmail.com>
Date: Sat Nov 20 20:45:57 2021 +0100
ac/llvm: Implement usub_sat and isub_sat.
Signed-off-by: Georg Lehmann <dadschoorse at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13895>
---
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]);
More information about the mesa-commit
mailing list