#define LLVMInsertBasicBlock ILLEGAL_LLVM_FUNCTION
#define LLVMCreateBuilder ILLEGAL_LLVM_FUNCTION
-#if HAVE_LLVM >= 0x0800
+#if LLVM_VERSION_MAJOR >= 8
#define GALLIVM_HAVE_CORO 1
#else
#define GALLIVM_HAVE_CORO 0
#include <float.h>
+#include <llvm/Config/llvm-config.h>
+
#include "util/u_memory.h"
#include "util/u_debug.h"
#include "util/u_math.h"
return bld->one;
if (!type.floating && !type.fixed) {
- if (HAVE_LLVM >= 0x0900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
char intrin[32];
intrinsic = type.sign ? "llvm.sadd.sat" : "llvm.uadd.sat";
lp_format_intrinsic(intrin, sizeof intrin, intrinsic, bld->vec_type);
if (util_cpu_caps.has_sse2) {
if (type.width == 8)
intrinsic = type.sign ? "llvm.x86.sse2.padds.b" :
- HAVE_LLVM < 0x0800 ? "llvm.x86.sse2.paddus.b" : NULL;
+ LLVM_VERSION_MAJOR < 8 ? "llvm.x86.sse2.paddus.b" : NULL;
if (type.width == 16)
intrinsic = type.sign ? "llvm.x86.sse2.padds.w" :
- HAVE_LLVM < 0x0800 ? "llvm.x86.sse2.paddus.w" : NULL;
+ LLVM_VERSION_MAJOR < 8 ? "llvm.x86.sse2.paddus.w" : NULL;
} else if (util_cpu_caps.has_altivec) {
if (type.width == 8)
intrinsic = type.sign ? "llvm.ppc.altivec.vaddsbs" : "llvm.ppc.altivec.vaddubs";
if (util_cpu_caps.has_avx2) {
if (type.width == 8)
intrinsic = type.sign ? "llvm.x86.avx2.padds.b" :
- HAVE_LLVM < 0x0800 ? "llvm.x86.avx2.paddus.b" : NULL;
+ LLVM_VERSION_MAJOR < 8 ? "llvm.x86.avx2.paddus.b" : NULL;
if (type.width == 16)
intrinsic = type.sign ? "llvm.x86.avx2.padds.w" :
- HAVE_LLVM < 0x0800 ? "llvm.x86.avx2.paddus.w" : NULL;
+ LLVM_VERSION_MAJOR < 8 ? "llvm.x86.avx2.paddus.w" : NULL;
}
}
}
return bld->zero;
if (!type.floating && !type.fixed) {
- if (HAVE_LLVM >= 0x0900) {
+ if (LLVM_VERSION_MAJOR >= 9) {
char intrin[32];
intrinsic = type.sign ? "llvm.ssub.sat" : "llvm.usub.sat";
lp_format_intrinsic(intrin, sizeof intrin, intrinsic, bld->vec_type);
if (util_cpu_caps.has_sse2) {
if (type.width == 8)
intrinsic = type.sign ? "llvm.x86.sse2.psubs.b" :
- HAVE_LLVM < 0x0800 ? "llvm.x86.sse2.psubus.b" : NULL;
+ LLVM_VERSION_MAJOR < 8 ? "llvm.x86.sse2.psubus.b" : NULL;
if (type.width == 16)
intrinsic = type.sign ? "llvm.x86.sse2.psubs.w" :
- HAVE_LLVM < 0x0800 ? "llvm.x86.sse2.psubus.w" : NULL;
+ LLVM_VERSION_MAJOR < 8 ? "llvm.x86.sse2.psubus.w" : NULL;
} else if (util_cpu_caps.has_altivec) {
if (type.width == 8)
intrinsic = type.sign ? "llvm.ppc.altivec.vsubsbs" : "llvm.ppc.altivec.vsububs";
if (util_cpu_caps.has_avx2) {
if (type.width == 8)
intrinsic = type.sign ? "llvm.x86.avx2.psubs.b" :
- HAVE_LLVM < 0x0800 ? "llvm.x86.avx2.psubus.b" : NULL;
+ LLVM_VERSION_MAJOR < 8 ? "llvm.x86.avx2.psubus.b" : NULL;
if (type.width == 16)
intrinsic = type.sign ? "llvm.x86.avx2.psubs.w" :
- HAVE_LLVM < 0x0800 ? "llvm.x86.avx2.psubus.w" : NULL;
+ LLVM_VERSION_MAJOR < 8 ? "llvm.x86.avx2.psubus.w" : NULL;
}
}
}
* for signed), which the fallback code does not, without this llvm
* will likely still produce atrocious code.
*/
- if (HAVE_LLVM < 0x0700 &&
+ if (LLVM_VERSION_MAJOR < 7 &&
(bld->type.length == 4 || bld->type.length == 8) &&
((util_cpu_caps.has_sse2 && (bld->type.sign == 0)) ||
util_cpu_caps.has_sse4_1)) {
}
}
- if(type.width*type.length == 128 && util_cpu_caps.has_ssse3 && HAVE_LLVM < 0x0600) {
+ if(type.width*type.length == 128 && util_cpu_caps.has_ssse3 && LLVM_VERSION_MAJOR < 6) {
switch(type.width) {
case 8:
return lp_build_intrinsic_unary(builder, "llvm.x86.ssse3.pabs.b.128", vec_type, a);
return lp_build_intrinsic_unary(builder, "llvm.x86.ssse3.pabs.d.128", vec_type, a);
}
}
- else if (type.width*type.length == 256 && util_cpu_caps.has_avx2 && HAVE_LLVM < 0x0600) {
+ else if (type.width*type.length == 256 && util_cpu_caps.has_avx2 && LLVM_VERSION_MAJOR < 6) {
switch(type.width) {
case 8:
return lp_build_intrinsic_unary(builder, "llvm.x86.avx2.pabs.b", vec_type, a);
#include "lp_bld_intr.h"
#include "lp_bld_flow.h"
-#if HAVE_LLVM < 0x0600
+#if LLVM_VERSION_MAJOR < 6
/* not a wrapper, just lets it compile */
static LLVMTypeRef LLVMTokenTypeInContext(LLVMContextRef C)
{
*/
+#include <llvm/Config/llvm-config.h>
+
#include "util/u_format.h"
#include "util/u_math.h"
#include "util/u_string.h"
LLVMBuilderRef builder = gallivm->builder;
assert(bld8->type.width == 8);
assert(bld8->type.length == 16 || bld8->type.length == 32);
- if (HAVE_LLVM < 0x0600) {
+ if (LLVM_VERSION_MAJOR < 6) {
LLVMValueRef intrargs[2];
char *intr_name = bld8->type.length == 32 ? "llvm.x86.avx2.pavg.b" :
"llvm.x86.sse2.pavg.b";
#include "lp_bld_misc.h"
#include "lp_bld_init.h"
+#include <llvm/Config/llvm-config.h>
#include <llvm-c/Analysis.h>
#include <llvm-c/Transforms/Scalar.h>
-#if HAVE_LLVM >= 0x0700
+#if LLVM_VERSION_MAJOR >= 7
#include <llvm-c/Transforms/Utils.h>
#endif
#include <llvm-c/BitWriter.h>
* @author Jose Fonseca <jfonseca@vmware.com>
*/
+#include <llvm/Config/llvm-config.h>
#include "util/u_debug.h"
#include "util/u_string.h"
}
-#if HAVE_LLVM < 0x0400
+#if LLVM_VERSION_MAJOR < 4
static LLVMAttribute lp_attr_to_llvm_attr(enum lp_func_attr attr)
{
switch (attr) {
int attr_idx, enum lp_func_attr attr)
{
-#if HAVE_LLVM < 0x0400
+#if LLVM_VERSION_MAJOR < 4
LLVMAttribute llvm_attr = lp_attr_to_llvm_attr(attr);
if (LLVMIsAFunction(function_or_call)) {
if (attr_idx == -1) {
{
LLVMModuleRef module = LLVMGetGlobalParent(LLVMGetBasicBlockParent(LLVMGetInsertBlock(builder)));
LLVMValueRef function, call;
- bool set_callsite_attrs = HAVE_LLVM >= 0x0400 &&
+ bool set_callsite_attrs = LLVM_VERSION_MAJOR >= 4 &&
!(attr_mask & LP_FUNC_ATTR_LEGACY);
function = LLVMGetNamedFunction(module, name);
#ifndef LP_BLD_INTR_H
#define LP_BLD_INTR_H
+#include <llvm/Config/llvm-config.h>
#include "gallivm/lp_bld.h"
#include "gallivm/lp_bld_init.h"
LP_FUNC_ATTR_NOUNWIND = (1 << 4),
LP_FUNC_ATTR_READNONE = (1 << 5),
LP_FUNC_ATTR_READONLY = (1 << 6),
- LP_FUNC_ATTR_WRITEONLY = HAVE_LLVM >= 0x0400 ? (1 << 7) : 0,
- LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY = HAVE_LLVM >= 0x0400 ? (1 << 8) : 0,
- LP_FUNC_ATTR_CONVERGENT = HAVE_LLVM >= 0x0400 ? (1 << 9) : 0,
+ LP_FUNC_ATTR_WRITEONLY = LLVM_VERSION_MAJOR >= 4 ? (1 << 7) : 0,
+ LP_FUNC_ATTR_INACCESSIBLE_MEM_ONLY = LLVM_VERSION_MAJOR >= 4 ? (1 << 8) : 0,
+ LP_FUNC_ATTR_CONVERGENT = LLVM_VERSION_MAJOR >= 4 ? (1 << 9) : 0,
/* Legacy intrinsic that needs attributes on function declarations
* and they must match the internal LLVM definition exactly, otherwise
# undef DEBUG
#endif
+#include <llvm/Config/llvm-config.h>
#include <llvm-c/Core.h>
#if HAVE_LLVM >= 0x0306
#include <llvm-c/Support.h>
mgr()->registerEHFrames(SectionData);
}
#endif
-#if HAVE_LLVM >= 0x0500
+#if LLVM_VERSION_MAJOR >= 5
virtual void deregisterEHFrames() {
mgr()->deregisterEHFrames();
}
llvm::SmallVector<std::string, 16> MAttrs;
-#if HAVE_LLVM >= 0x0400 && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM))
+#if LLVM_VERSION_MAJOR >= 4 && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM))
/* llvm-3.3+ implements sys::getHostCPUFeatures for Arm
* and llvm-3.7+ for x86, which allows us to enable/disable
* code generation based on the results of cpuid on these
#if defined(PIPE_ARCH_PPC)
MAttrs.push_back(util_cpu_caps.has_altivec ? "+altivec" : "-altivec");
#if (HAVE_LLVM >= 0x0304)
-#if (HAVE_LLVM < 0x0400)
+#if (LLVM_VERSION_MAJOR < 4)
/*
* Make sure VSX instructions are disabled
* See LLVM bugs: