summaryrefslogtreecommitdiffstats
path: root/src/amd
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-02-24 22:44:18 +0100
committerMarek Olšák <[email protected]>2017-03-03 15:29:30 +0100
commit9c09592086d8b8801d663756efcc997bc741868d (patch)
tree4755dc2a0a53472c846a385eb77d2b22f0210d04 /src/amd
parente729dc7c46bc903f40c933d40ce507d6cd23bf83 (diff)
radeonsi: move kill intrinsic building into amd/common
just a cleanup Reviewed-by: Dave Airlie <[email protected]>
Diffstat (limited to 'src/amd')
-rw-r--r--src/amd/common/ac_llvm_build.c16
-rw-r--r--src/amd/common/ac_llvm_build.h1
2 files changed, 17 insertions, 0 deletions
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
}