[Mesa-dev] [PATCH 23/24] ac: replace SI.vs.load.input with amdgcn.buffer.load.format

Marek Olšák maraeo at gmail.com
Sat Feb 25 23:58:21 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

---
 src/amd/common/ac_llvm_build.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index 8fac89c..6364657 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -729,20 +729,40 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
 					       ARRAY_SIZE(args), AC_FUNC_ATTR_READONLY);
 	}
 }
 
 LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
 					 LLVMValueRef rsrc,
 					 LLVMValueRef vindex,
 					 LLVMValueRef voffset,
 					 bool readonly_memory)
 {
+	if (HAVE_LLVM >= 0x0309) {
+		LLVMValueRef args [] = {
+			LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
+			vindex,
+			voffset,
+			LLVMConstInt(ctx->i1, 0, 0), /* glc */
+			LLVMConstInt(ctx->i1, 0, 0), /* slc */
+		};
+
+		return ac_emit_llvm_intrinsic(ctx,
+					      "llvm.amdgcn.buffer.load.format.v4f32",
+					      ctx->v4f32, args, ARRAY_SIZE(args),
+					      /* READNONE means writes can't
+					       * affect it, while READONLY means
+					       * that writes can affect it. */
+					      readonly_memory ?
+						      AC_FUNC_ATTR_READNONE :
+						      AC_FUNC_ATTR_READONLY);
+	}
+
 	LLVMValueRef args[] = {
 		rsrc,
 		voffset,
 		vindex,
 	};
 	return ac_emit_llvm_intrinsic(ctx, "llvm.SI.vs.load.input",
 				      ctx->v4f32, args, 3,
 				      AC_FUNC_ATTR_READNONE |
 				      AC_FUNC_ATTR_LEGACY);
 }
-- 
2.7.4



More information about the mesa-dev mailing list