[Mesa-dev] [PATCH 1/2] amd/common: use llvm.amdgcn.s.buffer.load for LLVM 8.0

Nicolai Hähnle nhaehnle at gmail.com
Thu Jan 10 22:26:08 UTC 2019


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

llvm.SI.load.const is deprecated.
---
 src/amd/common/ac_llvm_build.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 76047148a6a..4d7f15901e3 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1234,25 +1234,29 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
 	if (allow_smem && !glc && !slc) {
 		assert(vindex == NULL);
 
 		LLVMValueRef result[8];
 
 		for (int i = 0; i < num_channels; i++) {
 			if (i) {
 				offset = LLVMBuildAdd(ctx->builder, offset,
 						      LLVMConstInt(ctx->i32, 4, 0), "");
 			}
-			LLVMValueRef args[2] = {rsrc, offset};
-			result[i] = ac_build_intrinsic(ctx, "llvm.SI.load.const.v4i32",
-						       ctx->f32, args, 2,
+			const char *intrname =
+				HAVE_LLVM >= 0x0800 ? "llvm.amdgcn.s.buffer.load.f32"
+						    : "llvm.SI.load.const";
+			unsigned num_args = HAVE_LLVM >= 0x0800 ? 3 : 2;
+			LLVMValueRef args[3] = {rsrc, offset, ctx->i32_0};
+			result[i] = ac_build_intrinsic(ctx, intrname,
+						       ctx->f32, args, num_args,
 						       AC_FUNC_ATTR_READNONE |
-						       AC_FUNC_ATTR_LEGACY);
+						       (HAVE_LLVM < 0x0800 ? AC_FUNC_ATTR_LEGACY : 0));
 		}
 		if (num_channels == 1)
 			return result[0];
 
 		if (num_channels == 3)
 			result[num_channels++] = LLVMGetUndef(ctx->f32);
 		return ac_build_gather_values(ctx, result, num_channels);
 	}
 
 	return ac_build_buffer_load_common(ctx, rsrc, vindex, offset,
-- 
2.19.1



More information about the mesa-dev mailing list