summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk9
-rw-r--r--meson.build4
-rw-r--r--scons/llvm.py16
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_arit.c104
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_init.c5
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp38
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.h9
-rw-r--r--src/gallium/state_trackers/clover/llvm/metadata.hpp30
8 files changed, 8 insertions, 207 deletions
diff --git a/Android.mk b/Android.mk
index c7c28885995..df379a40528 100644
--- a/Android.mk
+++ b/Android.mk
@@ -95,14 +95,9 @@ MESA_ENABLE_LLVM := true
endif
define mesa-build-with-llvm
- $(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5 6), \
+ $(if $(filter $(MESA_ANDROID_MAJOR_VERSION), 4 5 6 7), \
$(warning Unsupported LLVM version in Android $(MESA_ANDROID_MAJOR_VERSION)),) \
- $(if $(filter 7,$(MESA_ANDROID_MAJOR_VERSION)), \
- $(eval LOCAL_CFLAGS += -DLLVM_AVAILABLE -DMESA_LLVM_VERSION_STRING=\"3.8\")) \
- $(if $(filter 8,$(MESA_ANDROID_MAJOR_VERSION)), \
- $(eval LOCAL_CFLAGS += -DLLVM_AVAILABLE -DMESA_LLVM_VERSION_STRING=\"3.9\")) \
- $(if $(filter P,$(MESA_ANDROID_MAJOR_VERSION)), \
- $(eval LOCAL_CFLAGS += -DLLVM_AVAILABLE -DMESA_LLVM_VERSION_STRING=\"3.9\")) \
+ $(eval LOCAL_CFLAGS += -DLLVM_AVAILABLE -DMESA_LLVM_VERSION_STRING=\"3.9\")
$(eval LOCAL_SHARED_LIBRARIES += libLLVM)
endef
diff --git a/meson.build b/meson.build
index 400427ee554..b8c19999f01 100644
--- a/meson.build
+++ b/meson.build
@@ -1261,10 +1261,8 @@ if with_amd_vk or with_gallium_radeonsi
_llvm_version = '>= 8.0.0'
elif with_gallium_swr
_llvm_version = '>= 6.0.0'
-elif with_gallium_opencl or with_gallium_r600
- _llvm_version = '>= 3.9.0'
else
- _llvm_version = '>= 3.8.0'
+ _llvm_version = '>= 3.9.0'
endif
_shared_llvm = get_option('shared-llvm')
diff --git a/scons/llvm.py b/scons/llvm.py
index 8d03d7ace06..4464b665751 100644
--- a/scons/llvm.py
+++ b/scons/llvm.py
@@ -37,7 +37,7 @@ import SCons.Errors
import SCons.Util
-required_llvm_version = '3.8'
+required_llvm_version = '3.9'
def generate(env):
@@ -142,7 +142,7 @@ def generate(env):
'LLVMIRReader', 'LLVMAsmParser',
'LLVMDemangle', 'LLVMGlobalISel', 'LLVMDebugInfoMSF',
])
- elif llvm_version >= distutils.version.LooseVersion('3.9'):
+ else:
env.Prepend(LIBS = [
'LLVMX86Disassembler', 'LLVMX86AsmParser',
'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
@@ -159,18 +159,6 @@ def generate(env):
'LLVMSupport',
'LLVMIRReader', 'LLVMASMParser'
])
- else:
- env.Prepend(LIBS = [
- 'LLVMBitWriter', 'LLVMX86Disassembler', 'LLVMX86AsmParser',
- 'LLVMX86CodeGen', 'LLVMSelectionDAG', 'LLVMAsmPrinter',
- 'LLVMCodeGen', 'LLVMScalarOpts', 'LLVMProfileData',
- 'LLVMInstCombine', 'LLVMInstrumentation', 'LLVMTransformUtils', 'LLVMipa',
- 'LLVMAnalysis', 'LLVMX86Desc', 'LLVMMCDisassembler',
- 'LLVMX86Info', 'LLVMX86AsmPrinter', 'LLVMX86Utils',
- 'LLVMMCJIT', 'LLVMTarget', 'LLVMExecutionEngine',
- 'LLVMRuntimeDyld', 'LLVMObject', 'LLVMMCParser',
- 'LLVMBitReader', 'LLVMMC', 'LLVMCore', 'LLVMSupport'
- ])
env.Append(LIBS = [
'imagehlp',
'psapi',
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 9bf74f0a15b..6b7ce9aacf9 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -144,49 +144,6 @@ lp_build_min_simple(struct lp_build_context *bld,
intrinsic = "llvm.ppc.altivec.vminfp";
intr_size = 128;
}
- } else if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 9 &&
- util_cpu_caps.has_avx2 && type.length > 4) {
- intr_size = 256;
- switch (type.width) {
- case 8:
- intrinsic = type.sign ? "llvm.x86.avx2.pmins.b" : "llvm.x86.avx2.pminu.b";
- break;
- case 16:
- intrinsic = type.sign ? "llvm.x86.avx2.pmins.w" : "llvm.x86.avx2.pminu.w";
- break;
- case 32:
- intrinsic = type.sign ? "llvm.x86.avx2.pmins.d" : "llvm.x86.avx2.pminu.d";
- break;
- }
- } else if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 9 &&
- util_cpu_caps.has_sse2 && type.length >= 2) {
- intr_size = 128;
- if ((type.width == 8 || type.width == 16) &&
- (type.width * type.length <= 64) &&
- (gallivm_debug & GALLIVM_DEBUG_PERF)) {
- debug_printf("%s: inefficient code, bogus shuffle due to packing\n",
- __FUNCTION__);
- }
- if (type.width == 8 && !type.sign) {
- intrinsic = "llvm.x86.sse2.pminu.b";
- }
- else if (type.width == 16 && type.sign) {
- intrinsic = "llvm.x86.sse2.pmins.w";
- }
- if (util_cpu_caps.has_sse4_1) {
- if (type.width == 8 && type.sign) {
- intrinsic = "llvm.x86.sse41.pminsb";
- }
- if (type.width == 16 && !type.sign) {
- intrinsic = "llvm.x86.sse41.pminuw";
- }
- if (type.width == 32 && !type.sign) {
- intrinsic = "llvm.x86.sse41.pminud";
- }
- if (type.width == 32 && type.sign) {
- intrinsic = "llvm.x86.sse41.pminsd";
- }
- }
} else if (util_cpu_caps.has_altivec) {
intr_size = 128;
if (type.width == 8) {
@@ -357,50 +314,6 @@ lp_build_max_simple(struct lp_build_context *bld,
intrinsic = "llvm.ppc.altivec.vmaxfp";
intr_size = 128;
}
- } else if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 9 &&
- util_cpu_caps.has_avx2 && type.length > 4) {
- intr_size = 256;
- switch (type.width) {
- case 8:
- intrinsic = type.sign ? "llvm.x86.avx2.pmaxs.b" : "llvm.x86.avx2.pmaxu.b";
- break;
- case 16:
- intrinsic = type.sign ? "llvm.x86.avx2.pmaxs.w" : "llvm.x86.avx2.pmaxu.w";
- break;
- case 32:
- intrinsic = type.sign ? "llvm.x86.avx2.pmaxs.d" : "llvm.x86.avx2.pmaxu.d";
- break;
- }
- } else if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 9 &&
- util_cpu_caps.has_sse2 && type.length >= 2) {
- intr_size = 128;
- if ((type.width == 8 || type.width == 16) &&
- (type.width * type.length <= 64) &&
- (gallivm_debug & GALLIVM_DEBUG_PERF)) {
- debug_printf("%s: inefficient code, bogus shuffle due to packing\n",
- __FUNCTION__);
- }
- if (type.width == 8 && !type.sign) {
- intrinsic = "llvm.x86.sse2.pmaxu.b";
- intr_size = 128;
- }
- else if (type.width == 16 && type.sign) {
- intrinsic = "llvm.x86.sse2.pmaxs.w";
- }
- if (util_cpu_caps.has_sse4_1) {
- if (type.width == 8 && type.sign) {
- intrinsic = "llvm.x86.sse41.pmaxsb";
- }
- if (type.width == 16 && !type.sign) {
- intrinsic = "llvm.x86.sse41.pmaxuw";
- }
- if (type.width == 32 && !type.sign) {
- intrinsic = "llvm.x86.sse41.pmaxud";
- }
- if (type.width == 32 && type.sign) {
- intrinsic = "llvm.x86.sse41.pmaxsd";
- }
- }
} else if (util_cpu_caps.has_altivec) {
intr_size = 128;
if (type.width == 8) {
@@ -1832,20 +1745,9 @@ lp_build_abs(struct lp_build_context *bld,
return a;
if(type.floating) {
- if (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 9) {
- /* Workaround llvm.org/PR27332 */
- LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
- unsigned long long absMask = ~(1ULL << (type.width - 1));
- LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type, ((unsigned long long) absMask));
- a = LLVMBuildBitCast(builder, a, int_vec_type, "");
- a = LLVMBuildAnd(builder, a, mask, "");
- a = LLVMBuildBitCast(builder, a, vec_type, "");
- return a;
- } else {
- char intrinsic[32];
- lp_format_intrinsic(intrinsic, sizeof intrinsic, "llvm.fabs", vec_type);
- return lp_build_intrinsic_unary(builder, intrinsic, vec_type, a);
- }
+ char intrinsic[32];
+ lp_format_intrinsic(intrinsic, sizeof intrinsic, "llvm.fabs", vec_type);
+ return lp_build_intrinsic_unary(builder, intrinsic, vec_type, a);
}
if(type.width*type.length == 128 && util_cpu_caps.has_ssse3 && LLVM_VERSION_MAJOR < 6) {
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c
index 46355e0277c..19d0d5ab031 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_init.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c
@@ -125,11 +125,6 @@ create_pass_manager(struct gallivm_state *gallivm)
* simple, or constant propagation into them, etc.
*/
-#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 9
- // Old versions of LLVM get the DataLayout from the pass manager.
- LLVMAddTargetData(gallivm->target, gallivm->passmgr);
-#endif
-
{
char *td_str;
// New ones from the Module.
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index cf18d6d14f9..3580ea6dd4b 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -509,49 +509,11 @@ lp_free_memory_manager(LLVMMCJITMemoryManagerRef memorymgr)
extern "C" LLVMValueRef
lp_get_called_value(LLVMValueRef call)
{
-#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9)
return LLVMGetCalledValue(call);
-#else
- return llvm::wrap(llvm::CallSite(llvm::unwrap<llvm::Instruction>(call)).getCalledValue());
-#endif
}
extern "C" bool
lp_is_function(LLVMValueRef v)
{
-#if LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9)
return LLVMGetValueKind(v) == LLVMFunctionValueKind;
-#else
- return llvm::isa<llvm::Function>(llvm::unwrap(v));
-#endif
-}
-
-#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 9
-static llvm::AtomicOrdering mapFromLLVMOrdering(LLVMAtomicOrdering Ordering) {
- switch (Ordering) {
- case LLVMAtomicOrderingNotAtomic: return llvm::AtomicOrdering::NotAtomic;
- case LLVMAtomicOrderingUnordered: return llvm::AtomicOrdering::Unordered;
- case LLVMAtomicOrderingMonotonic: return llvm::AtomicOrdering::Monotonic;
- case LLVMAtomicOrderingAcquire: return llvm::AtomicOrdering::Acquire;
- case LLVMAtomicOrderingRelease: return llvm::AtomicOrdering::Release;
- case LLVMAtomicOrderingAcquireRelease:
- return llvm::AtomicOrdering::AcquireRelease;
- case LLVMAtomicOrderingSequentiallyConsistent:
- return llvm::AtomicOrdering::SequentiallyConsistent;
- }
-
- llvm_unreachable("Invalid LLVMAtomicOrdering value!");
-}
-
-LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr,
- LLVMValueRef Cmp, LLVMValueRef New,
- LLVMAtomicOrdering SuccessOrdering,
- LLVMAtomicOrdering FailureOrdering,
- LLVMBool SingleThread)
-{
- return llvm::wrap(llvm::unwrap(B)->CreateAtomicCmpXchg(llvm::unwrap(Ptr), llvm::unwrap(Cmp),
- llvm::unwrap(New), mapFromLLVMOrdering(SuccessOrdering),
- mapFromLLVMOrdering(FailureOrdering),
- SingleThread ? llvm::SynchronizationScope::SingleThread : llvm::SynchronizationScope::CrossThread));
}
-#endif
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.h b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
index eb1eac045fd..363fbded728 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.h
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.h
@@ -76,15 +76,6 @@ lp_get_called_value(LLVMValueRef call);
extern bool
lp_is_function(LLVMValueRef v);
-/* LLVM 3.9 introduces this, provide our own for earlier */
-#if LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 9
-LLVMValueRef LLVMBuildAtomicCmpXchg(LLVMBuilderRef B, LLVMValueRef Ptr,
- LLVMValueRef Cmp, LLVMValueRef New,
- LLVMAtomicOrdering SuccessOrdering,
- LLVMAtomicOrdering FailureOrdering,
- LLVMBool SingleThread);
-#endif
-
#ifdef __cplusplus
}
#endif
diff --git a/src/gallium/state_trackers/clover/llvm/metadata.hpp b/src/gallium/state_trackers/clover/llvm/metadata.hpp
index 4a6f37d8f5d..d23f317c0a5 100644
--- a/src/gallium/state_trackers/clover/llvm/metadata.hpp
+++ b/src/gallium/state_trackers/clover/llvm/metadata.hpp
@@ -58,44 +58,14 @@ namespace clover {
inline bool
is_kernel(const ::llvm::Function &f) {
-#if (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9))
return f.getMetadata("kernel_arg_type");
-#else
- return clover::any_of(is_kernel_node_for(f),
- get_kernel_nodes(*f.getParent()));
-#endif
}
inline iterator_range< ::llvm::MDNode::op_iterator>
get_kernel_metadata_operands(const ::llvm::Function &f,
const std::string &name) {
-#if (LLVM_VERSION_MAJOR > 3 || (LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9))
- // On LLVM v3.9+ kernel argument attributes are stored as
- // function metadata.
const auto data_node = f.getMetadata(name);
return range(data_node->op_begin(), data_node->op_end());
-#else
- using ::llvm::cast;
- using ::llvm::dyn_cast;
- const auto kernel_node = find(is_kernel_node_for(f),
- get_kernel_nodes(*f.getParent()));
-
- const auto data_node = cast< ::llvm::MDNode>(
- find([&](const ::llvm::MDOperand &op) {
- if (auto m = dyn_cast< ::llvm::MDNode>(op))
- if (m->getNumOperands())
- if (auto m_name = dyn_cast< ::llvm::MDString>(
- m->getOperand(0).get()))
- return m_name->getString() == name;
-
- return false;
- },
- kernel_node->operands()));
-
- // Skip the first operand node which is just the metadata
- // attribute name.
- return range(data_node->op_begin() + 1, data_node->op_end());
-#endif
}
}