diff options
author | Eric Engestrom <[email protected]> | 2019-08-28 00:06:03 +0100 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2019-09-06 22:26:29 +0100 |
commit | 19d9e57f2c0c3e6cd9809dbc6ef65eab163ee255 (patch) | |
tree | bd3a0e3b9cb58cc0354639b2ce0f6c65485ba1aa /src/amd/common | |
parent | bce9c05ca8820bb0f31976e35674485b2ec15a8d (diff) |
amd: replace major llvm version checks with LLVM_VERSION_MAJOR
Signed-off-by: Eric Engestrom <[email protected]>
Acked-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 17 | ||||
-rw-r--r-- | src/amd/common/ac_llvm_util.h | 3 | ||||
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 12 |
3 files changed, 18 insertions, 14 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index f4d91567fa1..94ec569ad9f 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -26,6 +26,7 @@ #include "ac_llvm_build.h" #include <llvm-c/Core.h> +#include <llvm/Config/llvm-config.h> #include "c11/threads.h" @@ -443,7 +444,7 @@ ac_build_optimization_barrier(struct ac_llvm_context *ctx, 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, ""); @@ -455,7 +456,7 @@ ac_build_ballot(struct ac_llvm_context *ctx, { const char *name; - if (HAVE_LLVM >= 0x900) { + if (LLVM_VERSION_MAJOR >= 9) { if (ctx->wave_size == 64) name = "llvm.amdgcn.icmp.i64.i32"; else @@ -485,7 +486,7 @@ ac_build_ballot(struct ac_llvm_context *ctx, 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, @@ -1511,7 +1512,7 @@ ac_build_tbuffer_load_short(struct ac_llvm_context *ctx, { 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. */ @@ -1543,7 +1544,7 @@ ac_build_tbuffer_load_byte(struct ac_llvm_context *ctx, { 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. */ @@ -1685,7 +1686,7 @@ ac_build_opencoded_load_format(struct ac_llvm_context *ctx, 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) { @@ -1955,7 +1956,7 @@ ac_build_tbuffer_store_short(struct ac_llvm_context *ctx, { 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, @@ -1982,7 +1983,7 @@ ac_build_tbuffer_store_byte(struct ac_llvm_context *ctx, { 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, diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h index 8209b6dcabc..60c9a17e447 100644 --- a/src/amd/common/ac_llvm_util.h +++ b/src/amd/common/ac_llvm_util.h @@ -28,6 +28,7 @@ #include <stdbool.h> #include <llvm-c/TargetMachine.h> +#include <llvm/Config/llvm-config.h> #include "amd_family.h" @@ -152,7 +153,7 @@ ac_has_vec3_support(enum chip_class chip, bool use_format) return false; } - return HAVE_LLVM >= 0x900; + return LLVM_VERSION_MAJOR >= 9; } #ifdef __cplusplus diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index 13578770d4a..5ed21b1650b 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -21,6 +21,8 @@ * 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" @@ -1806,7 +1808,7 @@ static LLVMValueRef visit_atomic_ssbo(struct ac_nir_context *ctx, 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. */ @@ -2546,7 +2548,7 @@ static LLVMValueRef get_image_buffer_descriptor(struct ac_nir_context *ctx, 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), ""); @@ -2791,7 +2793,7 @@ static LLVMValueRef visit_image_atomic(struct ac_nir_context *ctx, 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. */ @@ -3052,7 +3054,7 @@ static LLVMValueRef visit_var_atomic(struct ac_nir_context *ctx, 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) { @@ -4723,7 +4725,7 @@ setup_constant_data(struct ac_nir_context *ctx, * 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, |