Commit 1fd60db4 authored by Samuel Pitoiset's avatar Samuel Pitoiset
Browse files

ac,radv,radeonsi: remove LLVM 7 support



Now that LLVM 9 will be released soon, we will only support
LLVM 8, 9 and master (10).
Signed-off-by: Samuel Pitoiset's avatarSamuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: default avatarMarek Olšák <marek.olsak@amd.com>
parent 3e03a3fc
...@@ -1243,7 +1243,7 @@ if with_gallium_opencl ...@@ -1243,7 +1243,7 @@ if with_gallium_opencl
endif endif
if with_amd_vk or with_gallium_radeonsi if with_amd_vk or with_gallium_radeonsi
_llvm_version = '>= 7.0.0' _llvm_version = '>= 8.0.0'
elif with_gallium_swr elif with_gallium_swr
_llvm_version = '>= 6.0.0' _llvm_version = '>= 6.0.0'
elif with_gallium_opencl or with_gallium_r600 elif with_gallium_opencl or with_gallium_r600
......
...@@ -487,8 +487,7 @@ bool ac_query_gpu_info(int fd, void *dev_p, ...@@ -487,8 +487,7 @@ bool ac_query_gpu_info(int fd, void *dev_p,
} }
info->has_gds_ordered_append = info->chip_class >= GFX7 && info->has_gds_ordered_append = info->chip_class >= GFX7 &&
info->drm_minor >= 29 && info->drm_minor >= 29;
HAVE_LLVM >= 0x0800;
return true; return true;
} }
......
...@@ -492,7 +492,6 @@ LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx, ...@@ -492,7 +492,6 @@ LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx,
LLVMConstInt(ctx->i32, LLVMIntNE, 0), LLVMConstInt(ctx->i32, LLVMIntNE, 0),
}; };
assert(HAVE_LLVM >= 0x0800);
return ac_build_intrinsic(ctx, name, ctx->i64, args, 3, return ac_build_intrinsic(ctx, name, ctx->i64, args, 3,
AC_FUNC_ATTR_NOUNWIND | AC_FUNC_ATTR_NOUNWIND |
AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_READNONE |
...@@ -1150,41 +1149,6 @@ static unsigned get_load_cache_policy(struct ac_llvm_context *ctx, ...@@ -1150,41 +1149,6 @@ static unsigned get_load_cache_policy(struct ac_llvm_context *ctx,
(ctx->chip_class >= GFX10 && cache_policy & ac_glc ? ac_dlc : 0); (ctx->chip_class >= GFX10 && cache_policy & ac_glc ? ac_dlc : 0);
} }
static void
ac_build_llvm7_buffer_store_common(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,
LLVMValueRef data,
LLVMValueRef vindex,
LLVMValueRef voffset,
unsigned num_channels,
unsigned cache_policy,
bool use_format)
{
LLVMValueRef args[] = {
data,
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
vindex ? vindex : ctx->i32_0,
voffset,
LLVMConstInt(ctx->i1, !!(cache_policy & ac_glc), 0),
LLVMConstInt(ctx->i1, !!(cache_policy & ac_slc), 0)
};
unsigned func = CLAMP(num_channels, 1, 3) - 1;
const char *type_names[] = {"f32", "v2f32", "v4f32"};
char name[256];
if (use_format) {
snprintf(name, sizeof(name), "llvm.amdgcn.buffer.store.format.%s",
type_names[func]);
} else {
snprintf(name, sizeof(name), "llvm.amdgcn.buffer.store.%s",
type_names[func]);
}
ac_build_intrinsic(ctx, name, ctx->voidt, args, ARRAY_SIZE(args),
AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY);
}
static void static void
ac_build_llvm8_buffer_store_common(struct ac_llvm_context *ctx, ac_build_llvm8_buffer_store_common(struct ac_llvm_context *ctx,
LLVMValueRef rsrc, LLVMValueRef rsrc,
...@@ -1235,16 +1199,10 @@ ac_build_buffer_store_format(struct ac_llvm_context *ctx, ...@@ -1235,16 +1199,10 @@ ac_build_buffer_store_format(struct ac_llvm_context *ctx,
unsigned num_channels, unsigned num_channels,
unsigned cache_policy) unsigned cache_policy)
{ {
if (HAVE_LLVM >= 0x800) { ac_build_llvm8_buffer_store_common(ctx, rsrc, data, vindex,
ac_build_llvm8_buffer_store_common(ctx, rsrc, data, vindex, voffset, NULL, num_channels,
voffset, NULL, num_channels, ctx->f32, cache_policy,
ctx->f32, cache_policy, true, true);
true, true);
} else {
ac_build_llvm7_buffer_store_common(ctx, rsrc, data, vindex, voffset,
num_channels, cache_policy,
true);
}
} }
/* TBUFFER_STORE_FORMAT_{X,XY,XYZ,XYZW} <- the suffix is selected by num_channels=1..4. /* TBUFFER_STORE_FORMAT_{X,XY,XYZ,XYZW} <- the suffix is selected by num_channels=1..4.
...@@ -1294,25 +1252,14 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx, ...@@ -1294,25 +1252,14 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
offset = LLVMBuildAdd(ctx->builder, offset, offset = LLVMBuildAdd(ctx->builder, offset,
LLVMConstInt(ctx->i32, inst_offset, 0), ""); LLVMConstInt(ctx->i32, inst_offset, 0), "");
if (HAVE_LLVM >= 0x800) { ac_build_llvm8_buffer_store_common(ctx, rsrc,
ac_build_llvm8_buffer_store_common(ctx, rsrc, ac_to_float(ctx, vdata),
ac_to_float(ctx, vdata), ctx->i32_0,
ctx->i32_0, voffset, offset,
voffset, offset, num_channels,
num_channels, ctx->f32,
ctx->f32, cache_policy,
cache_policy, false, false);
false, false);
} else {
if (voffset)
offset = LLVMBuildAdd(ctx->builder, offset, voffset, "");
ac_build_llvm7_buffer_store_common(ctx, rsrc,
ac_to_float(ctx, vdata),
ctx->i32_0, offset,
num_channels, cache_policy,
false);
}
return; return;
} }
...@@ -1330,42 +1277,6 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx, ...@@ -1330,42 +1277,6 @@ ac_build_buffer_store_dword(struct ac_llvm_context *ctx,
immoffset, num_channels, dfmt, nfmt, cache_policy); immoffset, num_channels, dfmt, nfmt, cache_policy);
} }
static LLVMValueRef
ac_build_llvm7_buffer_load_common(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,
LLVMValueRef vindex,
LLVMValueRef voffset,
unsigned num_channels,
unsigned cache_policy,
bool can_speculate,
bool use_format)
{
LLVMValueRef args[] = {
LLVMBuildBitCast(ctx->builder, rsrc, ctx->v4i32, ""),
vindex ? vindex : ctx->i32_0,
voffset,
LLVMConstInt(ctx->i1, !!(cache_policy & ac_glc), 0),
LLVMConstInt(ctx->i1, !!(cache_policy & ac_slc), 0)
};
unsigned func = CLAMP(num_channels, 1, 3) - 1;
LLVMTypeRef types[] = {ctx->f32, ctx->v2f32, ctx->v4f32};
const char *type_names[] = {"f32", "v2f32", "v4f32"};
char name[256];
if (use_format) {
snprintf(name, sizeof(name), "llvm.amdgcn.buffer.load.format.%s",
type_names[func]);
} else {
snprintf(name, sizeof(name), "llvm.amdgcn.buffer.load.%s",
type_names[func]);
}
return ac_build_intrinsic(ctx, name, types[func], args,
ARRAY_SIZE(args),
ac_get_load_intr_attribs(can_speculate));
}
static LLVMValueRef static LLVMValueRef
ac_build_llvm8_buffer_load_common(struct ac_llvm_context *ctx, ac_build_llvm8_buffer_load_common(struct ac_llvm_context *ctx,
LLVMValueRef rsrc, LLVMValueRef rsrc,
...@@ -1425,7 +1336,7 @@ ac_build_buffer_load(struct ac_llvm_context *ctx, ...@@ -1425,7 +1336,7 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
offset = LLVMBuildAdd(ctx->builder, offset, soffset, ""); offset = LLVMBuildAdd(ctx->builder, offset, soffset, "");
if (allow_smem && !(cache_policy & ac_slc) && if (allow_smem && !(cache_policy & ac_slc) &&
(!(cache_policy & ac_glc) || (HAVE_LLVM >= 0x0800 && ctx->chip_class >= GFX8))) { (!(cache_policy & ac_glc) || ctx->chip_class >= GFX8)) {
assert(vindex == NULL); assert(vindex == NULL);
LLVMValueRef result[8]; LLVMValueRef result[8];
...@@ -1435,19 +1346,15 @@ ac_build_buffer_load(struct ac_llvm_context *ctx, ...@@ -1435,19 +1346,15 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
offset = LLVMBuildAdd(ctx->builder, offset, offset = LLVMBuildAdd(ctx->builder, offset,
LLVMConstInt(ctx->i32, 4, 0), ""); LLVMConstInt(ctx->i32, 4, 0), "");
} }
const char *intrname =
HAVE_LLVM >= 0x0800 ? "llvm.amdgcn.s.buffer.load.f32"
: "llvm.SI.load.const.v4i32";
unsigned num_args = HAVE_LLVM >= 0x0800 ? 3 : 2;
LLVMValueRef args[3] = { LLVMValueRef args[3] = {
rsrc, rsrc,
offset, offset,
LLVMConstInt(ctx->i32, get_load_cache_policy(ctx, cache_policy), 0), LLVMConstInt(ctx->i32, get_load_cache_policy(ctx, cache_policy), 0),
}; };
result[i] = ac_build_intrinsic(ctx, intrname, result[i] = ac_build_intrinsic(ctx,
ctx->f32, args, num_args, "llvm.amdgcn.s.buffer.load.f32",
AC_FUNC_ATTR_READNONE | ctx->f32, args, 3,
(HAVE_LLVM < 0x0800 ? AC_FUNC_ATTR_LEGACY : 0)); AC_FUNC_ATTR_READNONE);
} }
if (num_channels == 1) if (num_channels == 1)
return result[0]; return result[0];
...@@ -1457,18 +1364,11 @@ ac_build_buffer_load(struct ac_llvm_context *ctx, ...@@ -1457,18 +1364,11 @@ ac_build_buffer_load(struct ac_llvm_context *ctx,
return ac_build_gather_values(ctx, result, num_channels); return ac_build_gather_values(ctx, result, num_channels);
} }
if (HAVE_LLVM >= 0x0800) { return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex,
return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex, offset, ctx->i32_0,
offset, ctx->i32_0, num_channels, ctx->f32,
num_channels, ctx->f32, cache_policy,
cache_policy, can_speculate, false, false);
can_speculate, false,
false);
}
return ac_build_llvm7_buffer_load_common(ctx, rsrc, vindex, offset,
num_channels, cache_policy,
can_speculate, false);
} }
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
...@@ -1479,44 +1379,9 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, ...@@ -1479,44 +1379,9 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
unsigned cache_policy, unsigned cache_policy,
bool can_speculate) bool can_speculate)
{ {
if (HAVE_LLVM >= 0x800) { return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex, voffset, ctx->i32_0,
return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex, voffset, ctx->i32_0, num_channels, ctx->f32,
num_channels, ctx->f32, cache_policy, can_speculate, true, true);
cache_policy, can_speculate, true, true);
}
return ac_build_llvm7_buffer_load_common(ctx, rsrc, vindex, voffset,
num_channels, cache_policy,
can_speculate, true);
}
LLVMValueRef ac_build_buffer_load_format_gfx9_safe(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,
LLVMValueRef vindex,
LLVMValueRef voffset,
unsigned num_channels,
unsigned cache_policy,
bool can_speculate)
{
if (HAVE_LLVM >= 0x800) {
return ac_build_llvm8_buffer_load_common(ctx, rsrc, vindex, voffset, ctx->i32_0,
num_channels, ctx->f32,
cache_policy, can_speculate, true, true);
}
LLVMValueRef elem_count = LLVMBuildExtractElement(ctx->builder, rsrc, LLVMConstInt(ctx->i32, 2, 0), "");
LLVMValueRef stride = LLVMBuildExtractElement(ctx->builder, rsrc, ctx->i32_1, "");
stride = LLVMBuildLShr(ctx->builder, stride, LLVMConstInt(ctx->i32, 16, 0), "");
LLVMValueRef new_elem_count = LLVMBuildSelect(ctx->builder,
LLVMBuildICmp(ctx->builder, LLVMIntUGT, elem_count, stride, ""),
elem_count, stride, "");
LLVMValueRef new_rsrc = LLVMBuildInsertElement(ctx->builder, rsrc, new_elem_count,
LLVMConstInt(ctx->i32, 2, 0), "");
return ac_build_llvm7_buffer_load_common(ctx, new_rsrc, vindex, voffset,
num_channels, cache_policy,
can_speculate, true);
} }
/// Translate a (dfmt, nfmt) pair into a chip-appropriate combined format /// Translate a (dfmt, nfmt) pair into a chip-appropriate combined format
...@@ -1615,36 +1480,12 @@ ac_build_tbuffer_load(struct ac_llvm_context *ctx, ...@@ -1615,36 +1480,12 @@ ac_build_tbuffer_load(struct ac_llvm_context *ctx,
bool can_speculate, bool can_speculate,
bool structurized) /* only matters for LLVM 8+ */ bool structurized) /* only matters for LLVM 8+ */
{ {
if (HAVE_LLVM >= 0x800) { voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, "");
voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, "");
return ac_build_llvm8_tbuffer_load(ctx, rsrc, vindex, voffset,
soffset, num_channels,
dfmt, nfmt, cache_policy,
can_speculate, structurized);
}
LLVMValueRef args[] = { return ac_build_llvm8_tbuffer_load(ctx, rsrc, vindex, voffset,
rsrc, soffset, num_channels,
vindex ? vindex : ctx->i32_0, dfmt, nfmt, cache_policy,
voffset, can_speculate, structurized);
soffset,
immoffset,
LLVMConstInt(ctx->i32, dfmt, false),
LLVMConstInt(ctx->i32, nfmt, false),
LLVMConstInt(ctx->i1, !!(cache_policy & ac_glc), false),
LLVMConstInt(ctx->i1, !!(cache_policy & ac_slc), false),
};
unsigned func = CLAMP(num_channels, 1, 3) - 1;
LLVMTypeRef types[] = {ctx->i32, ctx->v2i32, ctx->v4i32};
const char *type_names[] = {"i32", "v2i32", "v4i32"};
char name[256];
snprintf(name, sizeof(name), "llvm.amdgcn.tbuffer.load.%s",
type_names[func]);
return ac_build_intrinsic(ctx, name, types[func], args, 9,
ac_get_load_intr_attribs(can_speculate));
} }
LLVMValueRef LLVMValueRef
...@@ -1872,20 +1713,13 @@ ac_build_opencoded_load_format(struct ac_llvm_context *ctx, ...@@ -1872,20 +1713,13 @@ ac_build_opencoded_load_format(struct ac_llvm_context *ctx,
for (unsigned i = 0; i < load_num_channels; ++i) { for (unsigned i = 0; i < load_num_channels; ++i) {
tmp = LLVMBuildAdd(ctx->builder, soffset, tmp = LLVMBuildAdd(ctx->builder, soffset,
LLVMConstInt(ctx->i32, i << load_log_size, false), ""); LLVMConstInt(ctx->i32, i << load_log_size, false), "");
if (HAVE_LLVM >= 0x0800) { LLVMTypeRef channel_type = load_log_size == 0 ? ctx->i8 :
LLVMTypeRef channel_type = load_log_size == 0 ? ctx->i8 : load_log_size == 1 ? ctx->i16 : ctx->i32;
load_log_size == 1 ? ctx->i16 : ctx->i32; unsigned num_channels = 1 << (MAX2(load_log_size, 2) - 2);
unsigned num_channels = 1 << (MAX2(load_log_size, 2) - 2); loads[i] = ac_build_llvm8_buffer_load_common(
loads[i] = ac_build_llvm8_buffer_load_common( ctx, rsrc, vindex, voffset, tmp,
ctx, rsrc, vindex, voffset, tmp, num_channels, channel_type, cache_policy,
num_channels, channel_type, cache_policy, can_speculate, false, true);
can_speculate, false, true);
} else {
tmp = LLVMBuildAdd(ctx->builder, voffset, tmp, "");
loads[i] = ac_build_llvm7_buffer_load_common(
ctx, rsrc, vindex, tmp,
1 << (load_log_size - 2), cache_policy, can_speculate, false);
}
if (load_log_size >= 2) if (load_log_size >= 2)
loads[i] = ac_to_integer(ctx, loads[i]); loads[i] = ac_to_integer(ctx, loads[i]);
} }
...@@ -2108,37 +1942,12 @@ ac_build_tbuffer_store(struct ac_llvm_context *ctx, ...@@ -2108,37 +1942,12 @@ ac_build_tbuffer_store(struct ac_llvm_context *ctx,
unsigned cache_policy, unsigned cache_policy,
bool structurized) /* only matters for LLVM 8+ */ bool structurized) /* only matters for LLVM 8+ */
{ {
if (HAVE_LLVM >= 0x800) { voffset = LLVMBuildAdd(ctx->builder, voffset ? voffset : ctx->i32_0,
voffset = LLVMBuildAdd(ctx->builder, immoffset, "");
voffset ? voffset : ctx->i32_0,
immoffset, "");
ac_build_llvm8_tbuffer_store(ctx, rsrc, vdata, vindex, voffset, ac_build_llvm8_tbuffer_store(ctx, rsrc, vdata, vindex, voffset,
soffset, num_channels, dfmt, nfmt, soffset, num_channels, dfmt, nfmt,
cache_policy, structurized); cache_policy, structurized);
} else {
LLVMValueRef params[] = {
vdata,
rsrc,
vindex ? vindex : ctx->i32_0,
voffset ? voffset : ctx->i32_0,
soffset ? soffset : ctx->i32_0,
immoffset,
LLVMConstInt(ctx->i32, dfmt, false),
LLVMConstInt(ctx->i32, nfmt, false),
LLVMConstInt(ctx->i1, !!(cache_policy & ac_glc), false),
LLVMConstInt(ctx->i1, !!(cache_policy & ac_slc), false),
};
unsigned func = CLAMP(num_channels, 1, 3) - 1;
const char *type_names[] = {"i32", "v2i32", "v4i32"};
char name[256];
snprintf(name, sizeof(name), "llvm.amdgcn.tbuffer.store.%s",
type_names[func]);
ac_build_intrinsic(ctx, name, ctx->voidt, params, 10,
AC_FUNC_ATTR_INACCESSIBLE_MEM_ONLY);
}
} }
void void
...@@ -2879,22 +2688,10 @@ LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input, ...@@ -2879,22 +2688,10 @@ LLVMValueRef ac_build_bfe(struct ac_llvm_context *ctx, LLVMValueRef input,
width, width,
}; };
LLVMValueRef result = ac_build_intrinsic(ctx, return ac_build_intrinsic(ctx, is_signed ? "llvm.amdgcn.sbfe.i32" :
is_signed ? "llvm.amdgcn.sbfe.i32" : "llvm.amdgcn.ubfe.i32",
"llvm.amdgcn.ubfe.i32", ctx->i32, args, 3, AC_FUNC_ATTR_READNONE);
ctx->i32, args, 3,
AC_FUNC_ATTR_READNONE);
if (HAVE_LLVM < 0x0800) {
/* FIXME: LLVM 7+ returns incorrect result when count is 0.
* https://bugs.freedesktop.org/show_bug.cgi?id=107276
*/
LLVMValueRef zero = ctx->i32_0;
LLVMValueRef icond = LLVMBuildICmp(ctx->builder, LLVMIntEQ, width, zero, "");
result = LLVMBuildSelect(ctx->builder, icond, zero, result, "");
}
return result;
} }
LLVMValueRef ac_build_imad(struct ac_llvm_context *ctx, LLVMValueRef s0, LLVMValueRef ac_build_imad(struct ac_llvm_context *ctx, LLVMValueRef s0,
...@@ -3869,15 +3666,9 @@ ac_build_readlane(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef la ...@@ -3869,15 +3666,9 @@ ac_build_readlane(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef la
LLVMValueRef LLVMValueRef
ac_build_writelane(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef value, LLVMValueRef lane) ac_build_writelane(struct ac_llvm_context *ctx, LLVMValueRef src, LLVMValueRef value, LLVMValueRef lane)
{ {
if (HAVE_LLVM >= 0x0800) { return ac_build_intrinsic(ctx, "llvm.amdgcn.writelane", ctx->i32,
return ac_build_intrinsic(ctx, "llvm.amdgcn.writelane", ctx->i32, (LLVMValueRef []) {value, lane, src}, 3,
(LLVMValueRef []) {value, lane, src}, 3, AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_CONVERGENT);
AC_FUNC_ATTR_READNONE | AC_FUNC_ATTR_CONVERGENT);
}
LLVMValueRef pred = LLVMBuildICmp(ctx->builder, LLVMIntEQ, lane,
ac_get_thread_id(ctx), "");
return LLVMBuildSelect(ctx->builder, pred, value, src, "");
} }
LLVMValueRef LLVMValueRef
......
...@@ -324,16 +324,6 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, ...@@ -324,16 +324,6 @@ LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx,
unsigned cache_policy, unsigned cache_policy,
bool can_speculate); bool can_speculate);
/* load_format that handles the stride & element count better if idxen is
* disabled by LLVM. */
LLVMValueRef ac_build_buffer_load_format_gfx9_safe(struct ac_llvm_context *ctx,
LLVMValueRef rsrc,
LLVMValueRef vindex,
LLVMValueRef voffset,
unsigned num_channels,
unsigned cache_policy,
bool can_speculate);
LLVMValueRef LLVMValueRef
ac_build_tbuffer_load_short(struct ac_llvm_context *ctx, ac_build_tbuffer_load_short(struct ac_llvm_context *ctx,
LLVMValueRef rsrc, LLVMValueRef rsrc,
......
...@@ -133,7 +133,7 @@ const char *ac_get_llvm_processor_name(enum radeon_family family) ...@@ -133,7 +133,7 @@ const char *ac_get_llvm_processor_name(enum radeon_family family)
return "gfx906"; return "gfx906";
case CHIP_RAVEN2: case CHIP_RAVEN2:
case CHIP_RENOIR: case CHIP_RENOIR:
return HAVE_LLVM >= 0x0800 ? "gfx909" : "gfx902"; return "gfx909";
case CHIP_ARCTURUS: case CHIP_ARCTURUS:
return "gfx908"; return "gfx908";
case CHIP_NAVI10: case CHIP_NAVI10:
...@@ -158,8 +158,7 @@ static LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, ...@@ -158,8 +158,7 @@ static LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family,
LLVMTargetRef target = ac_get_llvm_target(triple); LLVMTargetRef target = ac_get_llvm_target(triple);
snprintf(features, sizeof(features), snprintf(features, sizeof(features),
"+DumpCode,-fp32-denormals,+fp64-denormals%s%s%s%s%s%s%s", "+DumpCode,-fp32-denormals,+fp64-denormals%s%s%s%s%s%s",
HAVE_LLVM >= 0x0800 ? "" : ",+vgpr-spilling",
family >= CHIP_NAVI10 && !(tm_options & AC_TM_WAVE32) ? family >= CHIP_NAVI10 && !(tm_options & AC_TM_WAVE32) ?
",+wavefrontsize64,-wavefrontsize32" : "", ",+wavefrontsize64,-wavefrontsize32" : "",
tm_options & AC_TM_SISCHED ? ",+si-scheduler" : "", tm_options & AC_TM_SISCHED ? ",+si-scheduler" : "",
......
...@@ -1308,21 +1308,12 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx, ...@@ -1308,21 +1308,12 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx,
if (instr->sampler_dim == GLSL_SAMPLER_DIM_BUF) { if (instr->sampler_dim == GLSL_SAMPLER_DIM_BUF) {
unsigned mask = nir_ssa_def_components_read(&instr->dest.ssa); unsigned mask = nir_ssa_def_components_read(&instr->dest.ssa);
if (ctx->abi->gfx9_stride_size_workaround) { return ac_build_buffer_load_format(&ctx->ac,
return ac_build_buffer_load_format_gfx9_safe(&ctx->ac, args->resource,
args->resource, args->coords[0],
args->coords[0], ctx->ac.i32_0,
ctx->ac.i32_0, util_last_bit(mask),
util_last_bit(mask), 0, true);
0, true);
} else {
return ac_build_buffer_load_format(&ctx->ac,
args->resource,
args->coords[0],
ctx->ac.i32_0,
util_last_bit(mask),
0, true);
}
} }
args->opcode = ac_image_sample; args->opcode = ac_image_sample;
...@@ -2477,8 +2468,7 @@ static LLVMValueRef get_image_buffer_descriptor(struct ac_nir_context *ctx, ...@@ -2477,8 +2468,7 @@ static LLVMValueRef get_image_buffer_descriptor(struct ac_nir_context *ctx,
bool write, bool atomic) bool write, bool atomic)
{ {
LLVMValueRef rsrc = get_image_descriptor(ctx, instr, AC_DESC_BUFFER, write); LLVMValueRef rsrc = get_image_descriptor(ctx, instr, AC_DESC_BUFFER, write);
if (ctx->abi->gfx9_stride_size_workaround || if (ctx->abi->gfx9_stride_size_workaround_for_atomic && atomic) {
(ctx->abi->gfx9_stride_size_workaround_for_atomic && atomic)) {
LLVMValueRef elem_count = LLVMBuildExtractElement(ctx->ac.builder, rsrc, LLVMConstInt(ctx->ac.i32, 2, 0), ""); LLVMValueRef elem_count = LLVMBuildExtractElement(ctx->ac.builder, rsrc, LLVMConstInt(ctx->ac.i32, 2, 0), "");
LLVMValueRef stride = LLVMBuildExtractElement(ctx->ac.builder, rsrc, LLVMConstInt(ctx->ac.i32, 1, 0), ""); LLVMValueRef stride = LLVMBuildExtractElement(ctx->ac.builder, rsrc, LLVMConstInt(ctx->ac.i32, 1, 0), "");
stride = LLVMBuildLShr(ctx->ac.builder, stride, LLVMConstInt(ctx->ac.i32, 16, 0), ""); stride = LLVMBuildLShr(ctx->ac.builder, stride, LLVMConstInt(ctx->ac.i32, 16, 0), "");