Commit 3fbdcd94 authored by Samuel Pitoiset's avatar Samuel Pitoiset

amd: remove support for LLVM 6.0

User are encouraged to switch to LLVM 7.0 released in September 2018.
Signed-off-by: Samuel Pitoiset's avatarSamuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: 's avatarMarek Olšák <marek.olsak@amd.com>
parent 3b2ad8b2
...@@ -107,8 +107,8 @@ dnl LLVM versions ...@@ -107,8 +107,8 @@ dnl LLVM versions
LLVM_REQUIRED_GALLIUM=3.3.0 LLVM_REQUIRED_GALLIUM=3.3.0
LLVM_REQUIRED_OPENCL=3.9.0 LLVM_REQUIRED_OPENCL=3.9.0
LLVM_REQUIRED_R600=3.9.0 LLVM_REQUIRED_R600=3.9.0
LLVM_REQUIRED_RADEONSI=6.0.0 LLVM_REQUIRED_RADEONSI=7.0.0
LLVM_REQUIRED_RADV=6.0.0 LLVM_REQUIRED_RADV=7.0.0
LLVM_REQUIRED_SWR=6.0.0 LLVM_REQUIRED_SWR=6.0.0
dnl Check for progs dnl Check for progs
......
...@@ -1176,7 +1176,7 @@ if with_gallium_opencl ...@@ -1176,7 +1176,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 = '>= 6.0.0' _llvm_version = '>= 7.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
......
...@@ -75,7 +75,7 @@ ac_llvm_context_init(struct ac_llvm_context *ctx, ...@@ -75,7 +75,7 @@ ac_llvm_context_init(struct ac_llvm_context *ctx,
ctx->i16 = LLVMIntTypeInContext(ctx->context, 16); ctx->i16 = LLVMIntTypeInContext(ctx->context, 16);
ctx->i32 = LLVMIntTypeInContext(ctx->context, 32); ctx->i32 = LLVMIntTypeInContext(ctx->context, 32);
ctx->i64 = LLVMIntTypeInContext(ctx->context, 64); ctx->i64 = LLVMIntTypeInContext(ctx->context, 64);
ctx->intptr = HAVE_32BIT_POINTERS ? ctx->i32 : ctx->i64; ctx->intptr = ctx->i32;
ctx->f16 = LLVMHalfTypeInContext(ctx->context); ctx->f16 = LLVMHalfTypeInContext(ctx->context);
ctx->f32 = LLVMFloatTypeInContext(ctx->context); ctx->f32 = LLVMFloatTypeInContext(ctx->context);
ctx->f64 = LLVMDoubleTypeInContext(ctx->context); ctx->f64 = LLVMDoubleTypeInContext(ctx->context);
...@@ -1403,99 +1403,28 @@ ac_build_ddxy(struct ac_llvm_context *ctx, ...@@ -1403,99 +1403,28 @@ ac_build_ddxy(struct ac_llvm_context *ctx,
int idx, int idx,
LLVMValueRef val) LLVMValueRef val)
{ {
unsigned tl_lanes[4], trbl_lanes[4];
LLVMValueRef tl, trbl, args[2]; LLVMValueRef tl, trbl, args[2];
LLVMValueRef result; LLVMValueRef result;
if (HAVE_LLVM >= 0x0700) { for (unsigned i = 0; i < 4; ++i) {
unsigned tl_lanes[4], trbl_lanes[4]; tl_lanes[i] = i & mask;
trbl_lanes[i] = (i & mask) + idx;
for (unsigned i = 0; i < 4; ++i) {
tl_lanes[i] = i & mask;
trbl_lanes[i] = (i & mask) + idx;
}
tl = ac_build_quad_swizzle(ctx, val,
tl_lanes[0], tl_lanes[1],
tl_lanes[2], tl_lanes[3]);
trbl = ac_build_quad_swizzle(ctx, val,
trbl_lanes[0], trbl_lanes[1],
trbl_lanes[2], trbl_lanes[3]);
} else if (ctx->chip_class >= VI) {
LLVMValueRef thread_id, tl_tid, trbl_tid;
thread_id = ac_get_thread_id(ctx);
tl_tid = LLVMBuildAnd(ctx->builder, thread_id,
LLVMConstInt(ctx->i32, mask, false), "");
trbl_tid = LLVMBuildAdd(ctx->builder, tl_tid,
LLVMConstInt(ctx->i32, idx, false), "");
args[0] = LLVMBuildMul(ctx->builder, tl_tid,
LLVMConstInt(ctx->i32, 4, false), "");
args[1] = val;
tl = ac_build_intrinsic(ctx,
"llvm.amdgcn.ds.bpermute", ctx->i32,
args, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_CONVERGENT);
args[0] = LLVMBuildMul(ctx->builder, trbl_tid,
LLVMConstInt(ctx->i32, 4, false), "");
trbl = ac_build_intrinsic(ctx,
"llvm.amdgcn.ds.bpermute", ctx->i32,
args, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_CONVERGENT);
} else {
uint32_t masks[2] = {};
switch (mask) {
case AC_TID_MASK_TOP_LEFT:
masks[0] = 0x8000;
if (idx == 1)
masks[1] = 0x8055;
else
masks[1] = 0x80aa;
break;
case AC_TID_MASK_TOP:
masks[0] = 0x8044;
masks[1] = 0x80ee;
break;
case AC_TID_MASK_LEFT:
masks[0] = 0x80a0;
masks[1] = 0x80f5;
break;
default:
assert(0);
}
args[0] = val;
args[1] = LLVMConstInt(ctx->i32, masks[0], false);
tl = ac_build_intrinsic(ctx,
"llvm.amdgcn.ds.swizzle", ctx->i32,
args, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_CONVERGENT);
args[1] = LLVMConstInt(ctx->i32, masks[1], false);
trbl = ac_build_intrinsic(ctx,
"llvm.amdgcn.ds.swizzle", ctx->i32,
args, 2,
AC_FUNC_ATTR_READNONE |
AC_FUNC_ATTR_CONVERGENT);
} }
tl = ac_build_quad_swizzle(ctx, val,
tl_lanes[0], tl_lanes[1],
tl_lanes[2], tl_lanes[3]);
trbl = ac_build_quad_swizzle(ctx, val,
trbl_lanes[0], trbl_lanes[1],
trbl_lanes[2], trbl_lanes[3]);
tl = LLVMBuildBitCast(ctx->builder, tl, ctx->f32, ""); tl = LLVMBuildBitCast(ctx->builder, tl, ctx->f32, "");
trbl = LLVMBuildBitCast(ctx->builder, trbl, ctx->f32, ""); trbl = LLVMBuildBitCast(ctx->builder, trbl, ctx->f32, "");
result = LLVMBuildFSub(ctx->builder, trbl, tl, ""); result = LLVMBuildFSub(ctx->builder, trbl, tl, "");
if (HAVE_LLVM >= 0x0700) { result = ac_build_intrinsic(ctx, "llvm.amdgcn.wqm.f32", ctx->f32,
result = ac_build_intrinsic(ctx, &result, 1, 0);
"llvm.amdgcn.wqm.f32", ctx->f32,
&result, 1, 0);
}
return result; return result;
} }
...@@ -1740,171 +1669,6 @@ static const char *get_atomic_name(enum ac_atomic_op op) ...@@ -1740,171 +1669,6 @@ static const char *get_atomic_name(enum ac_atomic_op op)
unreachable("bad atomic op"); unreachable("bad atomic op");
} }
/* LLVM 6 and older */
static LLVMValueRef ac_build_image_opcode_llvm6(struct ac_llvm_context *ctx,
struct ac_image_args *a)
{
LLVMValueRef args[16];
LLVMTypeRef retty = ctx->v4f32;
const char *name = NULL;
const char *atomic_subop = "";
char intr_name[128], coords_type[64];
bool sample = a->opcode == ac_image_sample ||
a->opcode == ac_image_gather4 ||
a->opcode == ac_image_get_lod;
bool atomic = a->opcode == ac_image_atomic ||
a->opcode == ac_image_atomic_cmpswap;
bool da = a->dim == ac_image_cube ||
a->dim == ac_image_1darray ||
a->dim == ac_image_2darray ||
a->dim == ac_image_2darraymsaa;
if (a->opcode == ac_image_get_lod)
da = false;
unsigned num_coords =
a->opcode != ac_image_get_resinfo ? ac_num_coords(a->dim) : 0;
LLVMValueRef addr;
unsigned num_addr = 0;
if (a->opcode == ac_image_get_lod) {
switch (a->dim) {
case ac_image_1darray:
num_coords = 1;
break;
case ac_image_2darray:
case ac_image_cube:
num_coords = 2;
break;
default:
break;
}
}
if (a->offset)
args[num_addr++] = ac_to_integer(ctx, a->offset);
if (a->bias)
args[num_addr++] = ac_to_integer(ctx, a->bias);
if (a->compare)
args[num_addr++] = ac_to_integer(ctx, a->compare);
if (a->derivs[0]) {
unsigned num_derivs = ac_num_derivs(a->dim);
for (unsigned i = 0; i < num_derivs; ++i)
args[num_addr++] = ac_to_integer(ctx, a->derivs[i]);
}
for (unsigned i = 0; i < num_coords; ++i)
args[num_addr++] = ac_to_integer(ctx, a->coords[i]);
if (a->lod)
args[num_addr++] = ac_to_integer(ctx, a->lod);
unsigned pad_goal = util_next_power_of_two(num_addr);
while (num_addr < pad_goal)
args[num_addr++] = LLVMGetUndef(ctx->i32);
addr = ac_build_gather_values(ctx, args, num_addr);
unsigned num_args = 0;
if (atomic || a->opcode == ac_image_store || a->opcode == ac_image_store_mip) {
args[num_args++] = a->data[0];
if (a->opcode == ac_image_atomic_cmpswap)
args[num_args++] = a->data[1];
}
unsigned coords_arg = num_args;
if (sample)
args[num_args++] = ac_to_float(ctx, addr);
else
args[num_args++] = ac_to_integer(ctx, addr);
args[num_args++] = a->resource;
if (sample)
args[num_args++] = a->sampler;
if (!atomic) {
args[num_args++] = LLVMConstInt(ctx->i32, a->dmask, 0);
if (sample)
args[num_args++] = LLVMConstInt(ctx->i1, a->unorm, 0);
args[num_args++] = a->cache_policy & ac_glc ? ctx->i1true : ctx->i1false;
args[num_args++] = a->cache_policy & ac_slc ? ctx->i1true : ctx->i1false;
args[num_args++] = ctx->i1false; /* lwe */
args[num_args++] = LLVMConstInt(ctx->i1, da, 0);
} else {
args[num_args++] = ctx->i1false; /* r128 */
args[num_args++] = LLVMConstInt(ctx->i1, da, 0);
args[num_args++] = a->cache_policy & ac_slc ? ctx->i1true : ctx->i1false;
}
switch (a->opcode) {
case ac_image_sample:
name = "llvm.amdgcn.image.sample";
break;
case ac_image_gather4:
name = "llvm.amdgcn.image.gather4";
break;
case ac_image_load:
name = "llvm.amdgcn.image.load";
break;
case ac_image_load_mip:
name = "llvm.amdgcn.image.load.mip";
break;
case ac_image_store:
name = "llvm.amdgcn.image.store";
retty = ctx->voidt;
break;
case ac_image_store_mip:
name = "llvm.amdgcn.image.store.mip";
retty = ctx->voidt;
break;
case ac_image_atomic:
case ac_image_atomic_cmpswap:
name = "llvm.amdgcn.image.atomic.";
retty = ctx->i32;
if (a->opcode == ac_image_atomic_cmpswap) {
atomic_subop = "cmpswap";
} else {
atomic_subop = get_atomic_name(a->atomic);
}
break;
case ac_image_get_lod:
name = "llvm.amdgcn.image.getlod";
break;
case ac_image_get_resinfo:
name = "llvm.amdgcn.image.getresinfo";
break;
default:
unreachable("invalid image opcode");
}
ac_build_type_name_for_intr(LLVMTypeOf(args[coords_arg]), coords_type,
sizeof(coords_type));
if (atomic) {
snprintf(intr_name, sizeof(intr_name), "llvm.amdgcn.image.atomic.%s.%s",
atomic_subop, coords_type);
} else {
bool lod_suffix =
a->lod && (a->opcode == ac_image_sample || a->opcode == ac_image_gather4);
snprintf(intr_name, sizeof(intr_name), "%s%s%s%s.v4f32.%s.v8i32",
name,
a->compare ? ".c" : "",
a->bias ? ".b" :
lod_suffix ? ".l" :
a->derivs[0] ? ".d" :
a->level_zero ? ".lz" : "",
a->offset ? ".o" : "",
coords_type);
}
LLVMValueRef result =
ac_build_intrinsic(ctx, intr_name, retty, args, num_args,
a->attributes);
if (!sample && retty == ctx->v4f32) {
result = LLVMBuildBitCast(ctx->builder, result,
ctx->v4i32, "");
}
return result;
}
LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
struct ac_image_args *a) struct ac_image_args *a)
{ {
...@@ -1929,9 +1693,6 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx, ...@@ -1929,9 +1693,6 @@ LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
(a->level_zero ? 1 : 0) + (a->level_zero ? 1 : 0) +
(a->derivs[0] ? 1 : 0) <= 1); (a->derivs[0] ? 1 : 0) <= 1);
if (HAVE_LLVM < 0x0700)
return ac_build_image_opcode_llvm6(ctx, a);
if (a->opcode == ac_image_get_lod) { if (a->opcode == ac_image_get_lod) {
switch (dim) { switch (dim) {
case ac_image_1darray: case ac_image_1darray:
...@@ -2720,9 +2481,6 @@ LLVMTypeRef ac_array_in_const_addr_space(LLVMTypeRef elem_type) ...@@ -2720,9 +2481,6 @@ LLVMTypeRef ac_array_in_const_addr_space(LLVMTypeRef elem_type)
LLVMTypeRef ac_array_in_const32_addr_space(LLVMTypeRef elem_type) LLVMTypeRef ac_array_in_const32_addr_space(LLVMTypeRef elem_type)
{ {
if (!HAVE_32BIT_POINTERS)
return ac_array_in_const_addr_space(elem_type);
return LLVMPointerType(LLVMArrayType(elem_type, 0), return LLVMPointerType(LLVMArrayType(elem_type, 0),
AC_ADDR_SPACE_CONST_32BIT); AC_ADDR_SPACE_CONST_32BIT);
} }
......
...@@ -34,14 +34,12 @@ ...@@ -34,14 +34,12 @@
extern "C" { extern "C" {
#endif #endif
#define HAVE_32BIT_POINTERS (HAVE_LLVM >= 0x0700)
enum { enum {
AC_ADDR_SPACE_FLAT = HAVE_LLVM >= 0x0700 ? 0 : 4, /* Slower than global. */ AC_ADDR_SPACE_FLAT = 0, /* Slower than global. */
AC_ADDR_SPACE_GLOBAL = 1, AC_ADDR_SPACE_GLOBAL = 1,
AC_ADDR_SPACE_GDS = HAVE_LLVM >= 0x0700 ? 2 : 5, AC_ADDR_SPACE_GDS = 2,
AC_ADDR_SPACE_LDS = 3, AC_ADDR_SPACE_LDS = 3,
AC_ADDR_SPACE_CONST = HAVE_LLVM >= 0x0700 ? 4 : 2, /* Global allowing SMEM. */ AC_ADDR_SPACE_CONST = 4, /* Global allowing SMEM. */
AC_ADDR_SPACE_CONST_32BIT = 6, /* same as CONST, but the pointer type has 32 bits */ AC_ADDR_SPACE_CONST_32BIT = 6, /* same as CONST, but the pointer type has 32 bits */
}; };
......
...@@ -39,9 +39,6 @@ ...@@ -39,9 +39,6 @@
#include <llvm/Transforms/IPO.h> #include <llvm/Transforms/IPO.h>
#include <llvm/IR/LegacyPassManager.h> #include <llvm/IR/LegacyPassManager.h>
#if HAVE_LLVM < 0x0700
#include "llvm/Support/raw_ostream.h"
#endif
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes) void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes)
{ {
...@@ -132,9 +129,7 @@ struct ac_compiler_passes *ac_create_llvm_passes(LLVMTargetMachineRef tm) ...@@ -132,9 +129,7 @@ struct ac_compiler_passes *ac_create_llvm_passes(LLVMTargetMachineRef tm)
llvm::TargetMachine *TM = reinterpret_cast<llvm::TargetMachine*>(tm); llvm::TargetMachine *TM = reinterpret_cast<llvm::TargetMachine*>(tm);
if (TM->addPassesToEmitFile(p->passmgr, p->ostream, if (TM->addPassesToEmitFile(p->passmgr, p->ostream,
#if HAVE_LLVM >= 0x0700
nullptr, nullptr,
#endif
llvm::TargetMachine::CGFT_ObjectFile)) { llvm::TargetMachine::CGFT_ObjectFile)) {
fprintf(stderr, "amd: TargetMachine can't emit a file of this type!\n"); fprintf(stderr, "amd: TargetMachine can't emit a file of this type!\n");
delete p; delete p;
...@@ -170,7 +165,5 @@ void ac_llvm_add_barrier_noop_pass(LLVMPassManagerRef passmgr) ...@@ -170,7 +165,5 @@ void ac_llvm_add_barrier_noop_pass(LLVMPassManagerRef passmgr)
void ac_enable_global_isel(LLVMTargetMachineRef tm) void ac_enable_global_isel(LLVMTargetMachineRef tm)
{ {
#if HAVE_LLVM >= 0x0700
reinterpret_cast<llvm::TargetMachine*>(tm)->setGlobalISel(true); reinterpret_cast<llvm::TargetMachine*>(tm)->setGlobalISel(true);
#endif
} }
...@@ -30,9 +30,7 @@ ...@@ -30,9 +30,7 @@
#include <llvm-c/Support.h> #include <llvm-c/Support.h>
#include <llvm-c/Transforms/IPO.h> #include <llvm-c/Transforms/IPO.h>
#include <llvm-c/Transforms/Scalar.h> #include <llvm-c/Transforms/Scalar.h>
#if HAVE_LLVM >= 0x0700
#include <llvm-c/Transforms/Utils.h> #include <llvm-c/Transforms/Utils.h>
#endif
#include "c11/threads.h" #include "c11/threads.h"
#include "gallivm/lp_bld_misc.h" #include "gallivm/lp_bld_misc.h"
#include "util/u_math.h" #include "util/u_math.h"
...@@ -132,9 +130,9 @@ const char *ac_get_llvm_processor_name(enum radeon_family family) ...@@ -132,9 +130,9 @@ const char *ac_get_llvm_processor_name(enum radeon_family family)
case CHIP_RAVEN: case CHIP_RAVEN:
return "gfx902"; return "gfx902";
case CHIP_VEGA12: case CHIP_VEGA12:
return HAVE_LLVM >= 0x0700 ? "gfx904" : "gfx902"; return "gfx904";
case CHIP_VEGA20: case CHIP_VEGA20:
return HAVE_LLVM >= 0x0700 ? "gfx906" : "gfx902"; return "gfx906";
case CHIP_RAVEN2: case CHIP_RAVEN2:
return "gfx902"; /* TODO: use gfx909 when it's available */ return "gfx902"; /* TODO: use gfx909 when it's available */
default: default:
...@@ -303,7 +301,6 @@ ac_count_scratch_private_memory(LLVMValueRef function) ...@@ -303,7 +301,6 @@ ac_count_scratch_private_memory(LLVMValueRef function)
bool bool
ac_init_llvm_compiler(struct ac_llvm_compiler *compiler, ac_init_llvm_compiler(struct ac_llvm_compiler *compiler,
bool okay_to_leak_target_library_info,
enum radeon_family family, enum radeon_family family,
enum ac_target_machine_options tm_options) enum ac_target_machine_options tm_options)
{ {
...@@ -324,12 +321,10 @@ ac_init_llvm_compiler(struct ac_llvm_compiler *compiler, ...@@ -324,12 +321,10 @@ ac_init_llvm_compiler(struct ac_llvm_compiler *compiler,
goto fail; goto fail;
} }
if (okay_to_leak_target_library_info || (HAVE_LLVM >= 0x0700)) { compiler->target_library_info =
compiler->target_library_info = ac_create_target_library_info(triple);
ac_create_target_library_info(triple); if (!compiler->target_library_info)
if (!compiler->target_library_info) goto fail;
goto fail;
}
compiler->passmgr = ac_create_passmgr(compiler->target_library_info, compiler->passmgr = ac_create_passmgr(compiler->target_library_info,
tm_options & AC_TM_CHECK_IR); tm_options & AC_TM_CHECK_IR);
...@@ -347,11 +342,8 @@ ac_destroy_llvm_compiler(struct ac_llvm_compiler *compiler) ...@@ -347,11 +342,8 @@ ac_destroy_llvm_compiler(struct ac_llvm_compiler *compiler)
{ {
if (compiler->passmgr) if (compiler->passmgr)
LLVMDisposePassManager(compiler->passmgr); LLVMDisposePassManager(compiler->passmgr);
#if HAVE_LLVM >= 0x0700
/* This crashes on LLVM 5.0 and 6.0 and Ubuntu 18.04, so leak it there. */
if (compiler->target_library_info) if (compiler->target_library_info)
ac_dispose_target_library_info(compiler->target_library_info); ac_dispose_target_library_info(compiler->target_library_info);
#endif
if (compiler->low_opt_tm) if (compiler->low_opt_tm)
LLVMDisposeTargetMachine(compiler->low_opt_tm); LLVMDisposeTargetMachine(compiler->low_opt_tm);
if (compiler->tm) if (compiler->tm)
......
...@@ -134,7 +134,6 @@ void ac_init_llvm_once(void); ...@@ -134,7 +134,6 @@ void ac_init_llvm_once(void);
bool ac_init_llvm_compiler(struct ac_llvm_compiler *compiler, bool ac_init_llvm_compiler(struct ac_llvm_compiler *compiler,
bool okay_to_leak_target_library_info,
enum radeon_family family, enum radeon_family family,
enum ac_target_machine_options tm_options); enum ac_target_machine_options tm_options);
void ac_destroy_llvm_compiler(struct ac_llvm_compiler *compiler); void ac_destroy_llvm_compiler(struct ac_llvm_compiler *compiler);
......
...@@ -429,22 +429,16 @@ static LLVMValueRef emit_bitfield_extract(struct ac_llvm_context *ctx, ...@@ -429,22 +429,16 @@ static LLVMValueRef emit_bitfield_extract(struct ac_llvm_context *ctx,
{ {
LLVMValueRef result; LLVMValueRef result;
if (HAVE_LLVM < 0x0700) { /* FIXME: LLVM 7+ returns incorrect result when count is 0.
LLVMValueRef icond = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), ""); * https://bugs.freedesktop.org/show_bug.cgi?id=107276
result = ac_build_bfe(ctx, srcs[0], srcs[1], srcs[2], is_signed); */
result = LLVMBuildSelect(ctx->builder, icond, srcs[0], result, ""); LLVMValueRef zero = ctx->i32_0;
} else { LLVMValueRef icond1 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), "");
/* FIXME: LLVM 7 returns incorrect result when count is 0. LLVMValueRef icond2 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], zero, "");
* https://bugs.freedesktop.org/show_bug.cgi?id=107276
*/
LLVMValueRef zero = ctx->i32_0;
LLVMValueRef icond1 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], LLVMConstInt(ctx->i32, 32, false), "");
LLVMValueRef icond2 = LLVMBuildICmp(ctx->builder, LLVMIntEQ, srcs[2], zero, "");
result = ac_build_bfe(ctx, srcs[0], srcs[1], srcs[2], is_signed); result = ac_build_bfe(ctx, srcs[0], srcs[1], srcs[2], is_signed);
result = LLVMBuildSelect(ctx->builder, icond1, srcs[0], result, ""); result = LLVMBuildSelect(ctx->builder, icond1, srcs[0], result, "");
result = LLVMBuildSelect(ctx->builder, icond2, zero, result, ""); result = LLVMBuildSelect(ctx->builder, icond2, zero, result, "");
}
return result; return result;
} }
......
...@@ -594,7 +594,7 @@ radv_emit_userdata_address(struct radv_cmd_buffer *cmd_buffer, ...@@ -594,7 +594,7 @@ radv_emit_userdata_address(struct radv_cmd_buffer *cmd_buffer,
if (loc->sgpr_idx == -1) if (loc->sgpr_idx == -1)
return; return;
assert(loc->num_sgprs == (HAVE_32BIT_POINTERS ? 1 : 2)); assert(loc->num_sgprs == 1);
assert(!loc->indirect); assert(!loc->indirect);
radv_emit_shader_pointer(cmd_buffer->device, cmd_buffer->cs, radv_emit_shader_pointer(cmd_buffer->device, cmd_buffer->cs,
...@@ -624,14 +624,12 @@ radv_emit_descriptor_pointers(struct radv_cmd_buffer *cmd_buffer, ...@@ -624,14 +624,12 @@ radv_emit_descriptor_pointers(struct radv_cmd_buffer *cmd_buffer,
struct radv_userdata_info *loc = &locs->descriptor_sets[start]; struct radv_userdata_info *loc = &locs->descriptor_sets[start];
unsigned sh_offset = sh_base + loc->sgpr_idx * 4; unsigned sh_offset = sh_base + loc->sgpr_idx * 4;
radv_emit_shader_pointer_head(cs, sh_offset, count, radv_emit_shader_pointer_head(cs, sh_offset, count, true);
HAVE_32BIT_POINTERS);
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
struct radv_descriptor_set *set = struct radv_descriptor_set *set =
descriptors_state->sets[start + i]; descriptors_state->sets[start + i];
radv_emit_shader_pointer_body(device, cs, set->va, radv_emit_shader_pointer_body(device, cs, set->va, true);
HAVE_32BIT_POINTERS);
} }
} }
} }
...@@ -1740,8 +1738,7 @@ radv_flush_indirect_descriptor_sets(struct radv_cmd_buffer *cmd_buffer, ...@@ -1740,8 +1738,7 @@ radv_flush_indirect_descriptor_sets(struct radv_cmd_buffer *cmd_buffer,
{ {
struct radv_descriptor_state *descriptors_state = struct radv_descriptor_state *descriptors_state =
radv_get_descriptors_state(cmd_buffer, bind_point); radv_get_descriptors_state(cmd_buffer, bind_point);
uint8_t ptr_size = HAVE_32BIT_POINTERS ? 1 : 2; uint32_t size = MAX_SETS * 4;
uint32_t size = MAX_SETS * 4 * ptr_size;
uint32_t offset; uint32_t offset;
void *ptr; void *ptr;
...@@ -1750,14 +1747,12 @@ radv_flush_indirect_descriptor_sets(struct radv_cmd_buffer *cmd_buffer, ...@@ -1750,14 +1747,12 @@ radv_flush_indirect_descriptor_sets(struct radv_cmd_buffer *cmd_buffer,
return; return;
for (unsigned i = 0; i < MAX_SETS; i++) { for (unsigned i = 0; i < MAX_SETS; i++) {
uint32_t *uptr = ((uint32_t *)ptr) + i * ptr_size; uint32_t *uptr = ((uint32_t *)ptr) + i;
uint64_t set_va = 0; uint64_t set_va = 0;
struct radv_descriptor_set *set = descriptors_state->sets[i]; struct radv_descriptor_set *set = descriptors_state->sets[i];
if (descriptors_state->valid & (1u << i)) if (descriptors_state->valid & (1u << i))
set_va = set->va; set_va = set->va;
uptr[0] = set_va & 0xffffffff; uptr[0] = set_va & 0xffffffff;
if (ptr_size == 2)
uptr[1] = set_va >> 32;
} }
uint64_t va = radv_buffer_get_va(cmd_buffer->upload.upload_bo); uint64_t va = radv_buffer_get_va(cmd_buffer->upload.upload_bo);
......
...@@ -747,7 +747,7 @@ void radv_GetPhysicalDeviceFeatures( ...@@ -747,7 +747,7 @@ void radv_GetPhysicalDeviceFeatures(
.shaderCullDistance = true, .shaderCullDistance = true,
.shaderFloat64 = true, .shaderFloat64 = true,
.shaderInt64 = true, .shaderInt64 = true,
.shaderInt16 = pdevice->rad_info.chip_class >= GFX9 && HAVE_LLVM >= 0x700, .shaderInt16 = pdevice->rad_info.chip_class >= GFX9,
.sparseBinding = true, .sparseBinding = true,
.variableMultisampleRate = true, .variableMultisampleRate = true,
.inheritedQueries = true, .inheritedQueries = true,
...@@ -789,7 +789,7 @@ void radv_GetPhysicalDeviceFeatures2( ...@@ -789,7 +789,7 @@ void radv_GetPhysicalDeviceFeatures2(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: { case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES: {
VkPhysicalDevice16BitStorageFeatures *features = VkPhysicalDevice16BitStorageFeatures *features =
(VkPhysicalDevice16BitStorageFeatures*)ext; (VkPhysicalDevice16BitStorageFeatures*)ext;
bool enabled = HAVE_LLVM >= 0x0700 && pdevice->rad_info.chip_class >= VI; bool enabled = pdevice->rad_info.chip_class >= VI;
features->storageBuffer16BitAccess = enabled; features->storageBuffer16BitAccess = enabled;
features->uniformAndStorageBuffer16BitAccess = enabled; features->uniformAndStorageBuffer16BitAccess = enabled;
features->storagePushConstant16 = enabled; features->storagePushConstant16 = enabled;
......
...@@ -51,7 +51,7 @@ class Extension: ...@@ -51,7 +51,7 @@ class Extension:
# and dEQP-VK.api.info.device fail due to the duplicated strings. # and dEQP-VK.api.info.device fail due to the duplicated strings.
EXTENSIONS = [ EXTENSIONS = [
Extension('VK_ANDROID_native_buffer', 5, 'ANDROID && device->rad_info.has_syncobj_wait_for_submit'), Extension('VK_ANDROID_native_buffer', 5, 'ANDROID && device->rad_info.has_syncobj_wait_for_submit'),
Extension('VK_KHR_16bit_storage', 1, 'HAVE_LLVM >= 0x0700'), Extension('VK_KHR_16bit_storage', 1, True),
Extension('VK_KHR_bind_memory2', 1, True), Extension('VK_KHR_bind_memory2', 1, True),
Extension('VK_KHR_create_renderpass2', 1, True), Extension('VK_KHR_create_renderpass2', 1, True),
Extension('VK_KHR_dedicated_allocation', 1, True), Extension('VK_KHR_dedicated_allocation', 1, True),
......
...@@ -40,7 +40,6 @@ public: ...@@ -40,7 +40,6 @@ public:
bool init(void) bool init(void)
{ {
if (!ac_init_llvm_compiler(&llvm_info, if (!ac_init_llvm_compiler(&llvm_info,
true,
family, family,
tm_options)) tm_options))
return false; return false;
...@@ -99,7 +98,6 @@ bool radv_compile_to_binary(struct ac_llvm_compiler *info, ...@@ -99,7 +98,6 @@ bool radv_compile_to_binary(struct ac_llvm_compiler *info,
} }
bool radv_init_llvm_compiler(struct ac_llvm_compiler *info, bool radv_init_llvm_compiler(struct ac_llvm_compiler *info,
bool okay_to_leak_target_library_info,