if (soffset)
offset = LLVMBuildAdd(ctx->builder, offset, soffset, "");
- /* TODO: VI and later generations can use SMEM with GLC=1.*/
- if (allow_smem && !glc && !slc) {
+ if (allow_smem && !slc &&
+ (!glc || (HAVE_LLVM >= 0x0800 && ctx->chip_class >= VI))) {
assert(vindex == NULL);
LLVMValueRef result[8];
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};
+ LLVMValueRef args[3] = {
+ rsrc,
+ offset,
+ glc ? ctx->i32_1 : ctx->i32_0,
+ };
result[i] = ac_build_intrinsic(ctx, intrname,
ctx->f32, args, num_args,
AC_FUNC_ATTR_READNONE |