From: Marek Olšák Date: Tue, 16 Jul 2019 05:07:49 +0000 (-0400) Subject: ac: use llvm.amdgcn.writelane X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=47dee973292eee6407ec17923b983f4c614e7493;p=mesa.git ac: use llvm.amdgcn.writelane Reviewed-by: Samuel Pitoiset --- 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, "");