From 9c09592086d8b8801d663756efcc997bc741868d Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Fri, 24 Feb 2017 22:44:18 +0100 Subject: radeonsi: move kill intrinsic building into amd/common just a cleanup Reviewed-by: Dave Airlie --- src/amd/common/ac_llvm_build.c | 16 ++++++++++++++++ src/amd/common/ac_llvm_build.h | 1 + 2 files changed, 17 insertions(+) (limited to 'src/amd') diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index f0ab9cb1367..a569a7c30f1 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -1105,3 +1105,19 @@ LLVMValueRef ac_emit_cvt_pkrtz_f16(struct ac_llvm_context *ctx, AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_LEGACY); } + +/** + * KILL, AKA discard in GLSL. + * + * \param value kill if value < 0.0 or value == NULL. + */ +void ac_emit_kill(struct ac_llvm_context *ctx, LLVMValueRef value) +{ + if (value) { + ac_emit_llvm_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt, + &value, 1, AC_FUNC_ATTR_LEGACY); + } else { + ac_emit_llvm_intrinsic(ctx, "llvm.AMDGPU.kilp", ctx->voidt, + NULL, 0, AC_FUNC_ATTR_LEGACY); + } +} diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index e6e4e434e2e..af16a2bca73 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -236,6 +236,7 @@ LLVMValueRef ac_emit_image_opcode(struct ac_llvm_context *ctx, struct ac_image_args *a); LLVMValueRef ac_emit_cvt_pkrtz_f16(struct ac_llvm_context *ctx, LLVMValueRef args[2]); +void ac_emit_kill(struct ac_llvm_context *ctx, LLVMValueRef value); #ifdef __cplusplus } -- cgit v1.2.3