From 47dee973292eee6407ec17923b983f4c614e7493 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Tue, 16 Jul 2019 01:07:49 -0400 Subject: [PATCH] ac: use llvm.amdgcn.writelane Reviewed-by: Samuel Pitoiset --- src/amd/common/ac_llvm_build.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index 221850139b1..041b6cd797e 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -3825,8 +3825,12 @@ ac_build_readlane(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef la LLVMValueRef ac_build_writelane(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef value, LLVMValueRef lane) { - /* TODO: Use the actual instruction when LLVM adds an intrinsic for it. - */ + if (HAVE_LLVM >= 0x0800) { + return ac_build_intrinsic(ctx, "llvm.amdgcn.writelane", ctx->i32, + (LLVMValueRef []) {value, lane, src}, 3, + AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_CONVERGENT); + } + LLVMValueRef pred = LLVMBuildICmp(ctx->builder, LLVMIntEQ, lane, ac_get_thread_id(ctx), ""); return LLVMBuildSelect(ctx->builder, pred, value, src, ""); -- 2.30.2