[Mesa-dev] [PATCH] ac: Use old kill intrinsics for LLVM 6.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Mon Jan 29 23:03:28 UTC 2018

llvm.amdgcn.kill is currently broken for SGPRs. The old intrinsic
had that issue too, but did not fold the preceding comparison into
the machine instruction in LLVM. As the preceding comparison is
often a float comparison, this results in a VGPR, essentially hiding
the issue.

I have a fix outstanding for LLVM to make the new intrinsic work,
but as getting stuff reviewed, committed and cherry-picked in LLVM
takes quite a while, I'd like to be safe and disable the new
intrinsic with LLVM 6.

We can always revert when the fix is in LLVM.

Fixes: ad2b3b2a9c "ac: replace llvm.AMDGPU.kilp by llvm.amdgcn.kill with LLVM 6"

The LLVM fix is available at https://reviews.llvm.org/D42302

 src/amd/common/ac_llvm_build.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 5e08508fed..a34eda1037 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1479,7 +1479,7 @@ LLVMValueRef ac_build_wqm_vote(struct ac_llvm_context *ctx, LLVMValueRef i1)
 void ac_build_kill_if_false(struct ac_llvm_context *ctx, LLVMValueRef i1)
-	if (HAVE_LLVM >= 0x0600) {
+	if (HAVE_LLVM >= 0x0700) {
 		ac_build_intrinsic(ctx, "llvm.amdgcn.kill", ctx->voidt,
 				   &i1, 1, 0);

More information about the mesa-dev mailing list