amd/common: use llvm.amdgcn.s.buffer.load for LLVM 8.0
authorNicolai Hähnle <nicolai.haehnle@amd.com>
Thu, 10 Jan 2019 21:59:58 +0000 (22:59 +0100)
committerNicolai Hähnle <nicolai.haehnle@amd.com>
Mon, 14 Jan 2019 07:30:12 +0000 (08:30 +0100)
llvm.SI.load.const is deprecated.

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
src/amd/common/ac_llvm_build.c

index 76047148a6a35bac8016a6e6888213a2c42c2f9b..4d7f15901e3e2dbb8001f998c1b46fca6d9ede57 100644 (file)
@@ -1241,11 +1241,15 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
                                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];