[Mesa-dev] [PATCH 28/92] ac/llvm: fix type of second llvm.cttz.* parameter

Nicolai Hähnle nhaehnle at gmail.com
Mon Jun 26 14:10:07 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

LLVM has required an i1 here for a long time. llvm.ctlz.* was fixed in
commit edd23e06067 ("ac/llvm: fix various findMSB bugs").
---
 src/amd/common/ac_nir_to_llvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index 49117d2..68865bd 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -1183,21 +1183,21 @@ static LLVMValueRef emit_find_lsb(struct nir_to_llvm_context *ctx,
 	LLVMValueRef params[2] = {
 		src0,
 
 		/* The value of 1 means that ffs(x=0) = undef, so LLVM won't
 		 * add special code to check for x=0. The reason is that
 		 * the LLVM behavior for x=0 is different from what we
 		 * need here.
 		 *
 		 * The hardware already implements the correct behavior.
 		 */
-		LLVMConstInt(ctx->i32, 1, false),
+		LLVMConstInt(ctx->i1, 1, false),
 	};
 	return ac_build_intrinsic(&ctx->ac, "llvm.cttz.i32", ctx->i32, params, 2, AC_FUNC_ATTR_READNONE);
 }
 
 static LLVMValueRef emit_ifind_msb(struct nir_to_llvm_context *ctx,
 				   LLVMValueRef src0)
 {
 	return ac_build_imsb(&ctx->ac, src0, ctx->i32);
 }
 
-- 
2.9.3



More information about the mesa-dev mailing list