#include "ac_llvm_build.h"
#include <llvm-c/Core.h>
+#include <llvm/Config/llvm-config.h>
#include "c11/threads.h"
LLVMValueRef
ac_build_shader_clock(struct ac_llvm_context *ctx)
{
- const char *intr = HAVE_LLVM >= 0x0900 && ctx->chip_class >= GFX8 ?
+ const char *intr = LLVM_VERSION_MAJOR >= 9 && ctx->chip_class >= GFX8 ?
"llvm.amdgcn.s.memrealtime" : "llvm.readcyclecounter";
LLVMValueRef tmp = ac_build_intrinsic(ctx, intr, ctx->i64, NULL, 0, 0);
return LLVMBuildBitCast(ctx->builder, tmp, ctx->v2i32, "");
{
const char *name;
- if (HAVE_LLVM >= 0x900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
if (ctx->wave_size == 64)
name = "llvm.amdgcn.icmp.i64.i32";
else
LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx,
LLVMValueRef value)
{
- const char *name = HAVE_LLVM >= 0x900 ? "llvm.amdgcn.icmp.i64.i1" : "llvm.amdgcn.icmp.i1";
+ const char *name = LLVM_VERSION_MAJOR >= 9 ? "llvm.amdgcn.icmp.i64.i1" : "llvm.amdgcn.icmp.i1";
LLVMValueRef args[3] = {
value,
ctx->i1false,
{
LLVMValueRef res;
- if (HAVE_LLVM >= 0x900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, "");
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
{
LLVMValueRef res;
- if (HAVE_LLVM >= 0x900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
voffset = LLVMBuildAdd(ctx->builder, voffset, immoffset, "");
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
load_log_size += -log_recombine;
}
- assert(load_log_size >= 2 || HAVE_LLVM >= 0x0900);
+ assert(load_log_size >= 2 || LLVM_VERSION_MAJOR >= 9);
LLVMValueRef loads[32]; /* up to 32 bytes */
for (unsigned i = 0; i < load_num_channels; ++i) {
{
vdata = LLVMBuildBitCast(ctx->builder, vdata, ctx->i16, "");
- if (HAVE_LLVM >= 0x900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
ac_build_buffer_store_common(ctx, rsrc, vdata, NULL,
voffset, soffset, 1,
{
vdata = LLVMBuildBitCast(ctx->builder, vdata, ctx->i8, "");
- if (HAVE_LLVM >= 0x900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
/* LLVM 9+ supports i8/i16 with struct/raw intrinsics. */
ac_build_buffer_store_common(ctx, rsrc, vdata, NULL,
voffset, soffset, 1,
#include <stdbool.h>
#include <llvm-c/TargetMachine.h>
+#include <llvm/Config/llvm-config.h>
#include "amd_family.h"
return false;
}
- return HAVE_LLVM >= 0x900;
+ return LLVM_VERSION_MAJOR >= 9;
}
#ifdef __cplusplus
* IN THE SOFTWARE.
*/
+#include <llvm/Config/llvm-config.h>
+
#include "ac_nir_to_llvm.h"
#include "ac_llvm_build.h"
#include "ac_llvm_util.h"
params[arg_count++] = ac_llvm_extract_elem(&ctx->ac, get_src(ctx, instr->src[2]), 0);
params[arg_count++] = descriptor;
- if (HAVE_LLVM >= 0x900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
/* XXX: The new raw/struct atomic intrinsics are buggy with
* LLVM 8, see r358579.
*/
bool write, bool atomic)
{
LLVMValueRef rsrc = get_image_descriptor(ctx, instr, AC_DESC_BUFFER, write);
- if (ctx->ac.chip_class == GFX9 && HAVE_LLVM < 0x900 && atomic) {
+ if (ctx->ac.chip_class == GFX9 && LLVM_VERSION_MAJOR < 9 && atomic) {
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), "");
stride = LLVMBuildLShr(ctx->ac.builder, stride, LLVMConstInt(ctx->ac.i32, 16, 0), "");
params[param_count++] = LLVMBuildExtractElement(ctx->ac.builder, get_src(ctx, instr->src[1]),
ctx->ac.i32_0, ""); /* vindex */
params[param_count++] = ctx->ac.i32_0; /* voffset */
- if (HAVE_LLVM >= 0x900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
/* XXX: The new raw/struct atomic intrinsics are buggy
* with LLVM 8, see r358579.
*/
LLVMValueRef result;
LLVMValueRef src = get_src(ctx, instr->src[src_idx]);
- const char *sync_scope = HAVE_LLVM >= 0x0900 ? "workgroup-one-as" : "workgroup";
+ const char *sync_scope = LLVM_VERSION_MAJOR >= 9 ? "workgroup-one-as" : "workgroup";
if (instr->intrinsic == nir_intrinsic_shared_atomic_comp_swap ||
instr->intrinsic == nir_intrinsic_deref_atomic_comp_swap) {
* the code sections. See https://reviews.llvm.org/D65813.
*/
unsigned address_space =
- HAVE_LLVM < 0x1000 ? AC_ADDR_SPACE_GLOBAL : AC_ADDR_SPACE_CONST;
+ LLVM_VERSION_MAJOR < 10 ? AC_ADDR_SPACE_GLOBAL : AC_ADDR_SPACE_CONST;
LLVMValueRef global =
LLVMAddGlobalInAddressSpace(ctx->ac.module, type,
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
+#include <llvm/Config/llvm-config.h>
#include "radv_debug.h"
#include "radv_private.h"
#include "radv_shader.h"
* load/store memory operations.
* See https://reviews.llvm.org/D61313
*/
- if (HAVE_LLVM < 0x900)
+ if (LLVM_VERSION_MAJOR < 9)
instance->debug_flags |= RADV_DEBUG_NO_LOAD_STORE_OPT;
} else if (!strcmp(name, "Wolfenstein: Youngblood")) {
if (!(instance->debug_flags & RADV_DEBUG_NO_SHADER_BALLOT)) {
features->storageBuffer16BitAccess = enabled;
features->uniformAndStorageBuffer16BitAccess = enabled;
features->storagePushConstant16 = enabled;
- features->storageInputOutput16 = enabled && HAVE_LLVM >= 0x900;
+ features->storageInputOutput16 = enabled && LLVM_VERSION_MAJOR >= 9;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES: {
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR: {
VkPhysicalDeviceShaderAtomicInt64FeaturesKHR *features =
(VkPhysicalDeviceShaderAtomicInt64FeaturesKHR *)ext;
- features->shaderBufferInt64Atomics = HAVE_LLVM >= 0x0900;
- features->shaderSharedInt64Atomics = HAVE_LLVM >= 0x0900;
+ features->shaderBufferInt64Atomics = LLVM_VERSION_MAJOR >= 9;
+ features->shaderSharedInt64Atomics = LLVM_VERSION_MAJOR >= 9;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT: {
Extension('VK_KHR_relaxed_block_layout', 1, True),
Extension('VK_KHR_sampler_mirror_clamp_to_edge', 1, True),
Extension('VK_KHR_sampler_ycbcr_conversion', 1, True),
- Extension('VK_KHR_shader_atomic_int64', 1, 'HAVE_LLVM >= 0x0900'),
+ Extension('VK_KHR_shader_atomic_int64', 1, 'LLVM_VERSION_MAJOR >= 9'),
Extension('VK_KHR_shader_draw_parameters', 1, True),
Extension('VK_KHR_shader_float16_int8', 1, True),
Extension('VK_KHR_storage_buffer_storage_class', 1, True),
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <llvm/Config/llvm-config.h>
#include <amdgpu_drm.h>
#include <assert.h>
#include "radv_amdgpu_cs.h"
return false;
/* LLVM 9.0 is required for GFX10. */
- if (ws->info.chip_class == GFX10 && HAVE_LLVM < 0x0900) {
+ if (ws->info.chip_class == GFX10 && LLVM_VERSION_MAJOR < 9) {
fprintf(stderr, "radv: Navi family support requires LLVM 9 or higher\n");
return false;
}
#include "util/u_video.h"
#include "compiler/nir/nir.h"
+#include <llvm/Config/llvm-config.h>
#include <sys/utsname.h>
static const char *si_get_vendor(struct pipe_screen *pscreen)
case PIPE_CAP_VERTEX_BUFFER_OFFSET_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_VERTEX_BUFFER_STRIDE_4BYTE_ALIGNED_ONLY:
case PIPE_CAP_VERTEX_ELEMENT_SRC_OFFSET_4BYTE_ALIGNED_ONLY:
- return HAVE_LLVM < 0x0900 && !sscreen->info.has_unaligned_shader_loads;
+ return LLVM_VERSION_MAJOR < 9 && !sscreen->info.has_unaligned_shader_loads;
case PIPE_CAP_SPARSE_BUFFER_PAGE_SIZE:
return sscreen->info.has_sparse_vm_mappings ?
case PIPE_CAP_PCI_FUNCTION:
return sscreen->info.pci_func;
case PIPE_CAP_TGSI_ATOMINC_WRAP:
- return HAVE_LLVM >= 0x1000;
+ return LLVM_VERSION_MAJOR >= 10;
default:
return u_pipe_screen_get_param_defaults(pscreen, param);
#include "gallium/winsys/amdgpu/drm/amdgpu_public.h"
#include <xf86drm.h>
+#include <llvm/Config/llvm-config.h>
+
static const struct debug_named_value debug_options[] = {
/* Shader logging options: */
{ "vs", DBG(VS), "Print vertex shaders" },
sscreen->ws = ws;
ws->query_info(ws, &sscreen->info);
- if (sscreen->info.chip_class == GFX10 && HAVE_LLVM < 0x0900) {
+ if (sscreen->info.chip_class == GFX10 && LLVM_VERSION_MAJOR < 9) {
fprintf(stderr, "radeonsi: Navi family support requires LLVM 9 or higher\n");
FREE(sscreen);
return NULL;
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <llvm/Config/llvm-config.h>
+
#include "util/u_memory.h"
#include "util/u_string.h"
#include "tgsi/tgsi_build.h"
shader->info.num_input_vgprs -= num_prolog_vgprs;
if (shader->key.as_ls || ctx->type == PIPE_SHADER_TESS_CTRL) {
- if (USE_LDS_SYMBOLS && HAVE_LLVM >= 0x0900) {
+ if (USE_LDS_SYMBOLS && LLVM_VERSION_MAJOR >= 9) {
/* The LSHS size is not known until draw time, so we append it
* at the end of whatever LDS use there may be in the rest of
* the shader (currently none, unless LLVM decides to do its
ctx->esgs_ring =
ac_build_load_to_sgpr(&ctx->ac, buf_ptr, offset);
} else {
- if (USE_LDS_SYMBOLS && HAVE_LLVM >= 0x0900) {
+ if (USE_LDS_SYMBOLS && LLVM_VERSION_MAJOR >= 9) {
/* Declare the ESGS ring as an explicit LDS symbol. */
declare_esgs_ring(ctx);
} else {
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <llvm/Config/llvm-config.h>
+
#include "si_shader_internal.h"
#include "si_pipe.h"
#include "sid.h"
LLVMBuilderRef builder = ctx->ac.builder;
const struct tgsi_full_instruction * inst = emit_data->inst;
LLVMValueRef ptr, result, arg;
- const char *sync_scope = HAVE_LLVM >= 0x0900 ? "workgroup-one-as" : "workgroup";
+ const char *sync_scope = LLVM_VERSION_MAJOR >= 9 ? "workgroup-one-as" : "workgroup";
ptr = get_memory_ptr(ctx, inst, ctx->i32, 1);