ac: replace SI.vs.load.input with amdgcn.buffer.load.format
authorMarek Olšák <marek.olsak@amd.com>
Sat, 25 Feb 2017 22:48:23 +0000 (23:48 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 3 Mar 2017 16:30:07 +0000 (17:30 +0100)
Reviewed-by: Dave Airlie <airlied@redhat.com>
src/amd/common/ac_llvm_build.c

index 8fac89ccd7bf64a7e0b02c7dfd59d91453ca236e..6364657e6799c6ae522bb0ed5bff13a6e4ac117f 100644 (file)
@@ -736,6 +736,26 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
                                         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,