[Mesa-dev] [PATCH 2/4] ac: use llvm.amdgcn.kill with LLVM 6.0

Marek Olšák maraeo at gmail.com
Sat Oct 14 00:58:16 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/amd/common/ac_llvm_build.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 752c42e..0550f80 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1400,20 +1400,26 @@ LLVMValueRef ac_build_cvt_pkrtz_f16(struct ac_llvm_context *ctx,
 		return LLVMBuildBitCast(ctx->builder, res, ctx->i32, "");
 	}
 
 	return ac_build_intrinsic(ctx, "llvm.SI.packf16", ctx->i32, args, 2,
 				  AC_FUNC_ATTR_READNONE |
 				  AC_FUNC_ATTR_LEGACY);
 }
 
 void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef i1)
 {
+	if (HAVE_LLVM >= 0x0600) {
+		ac_build_intrinsic(ctx, "llvm.amdgcn.kill", ctx->voidt,
+				   &i1, 1, 0);
+		return;
+	}
+
 	LLVMValueRef value = LLVMBuildSelect(ctx->builder, i1,
 					     LLVMConstReal(ctx->f32, 1),
 					     LLVMConstReal(ctx->f32, -1), "");
 	ac_build_intrinsic(ctx, "llvm.AMDGPU.kill", ctx->voidt,
 			   &value, 1, AC_FUNC_ATTR_LEGACY);
 }
 
 LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
 			  LLVMValueRef offset, LLVMValueRef width,
 			  bool is_signed)
-- 
2.7.4



More information about the mesa-dev mailing list