summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary
diff options
context:
space:
mode:
authorAdam Jackson <[email protected]>2019-09-06 09:50:32 +0200
committerAdam Jackson <[email protected]>2019-09-11 17:00:43 +0000
commit96b592696f13be09621bc50be31a89fde54b18e2 (patch)
treea935e5c82f0644bbaaa3b3bdcf0e19611fd2c866 /src/gallium/auxiliary
parent585d0956108b82514b3cb842642f8a3f23301ca1 (diff)
gallium: Require LLVM >= 3.9
To go any further than this would be to break the current version of Android. Reviewed-by: Timothy Arceri <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-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
4 files changed, 3 insertions, 153 deletions
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