From 013ff2fae13da41c2f5619c4698b0a7b5aa6a06d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Fonseca?= Date: Wed, 22 Oct 2014 13:09:59 +0100 Subject: gallivm,llvmpipe,clover: Bump required LLVM version to 3.3. We'll need to update gallivm for the interface changes in LLVM 3.6, and the fewer the number of older LLVM versions we support the less hairy that will be. As consequence HAVE_AVX define can disappear. (Note HAVE_AVX meant whether LLVM version supports AVX or not. Runtime support for AVX is always checked and enforced independently.) Verified llvmpipe builds and runs with with LLVM 3.3, 3.4, and 3.5. Reviewed-by: Roland Scheidegger --- src/gallium/auxiliary/gallivm/lp_bld.h | 4 +-- src/gallium/auxiliary/gallivm/lp_bld_debug.cpp | 6 +---- src/gallium/auxiliary/gallivm/lp_bld_init.c | 37 ++------------------------ src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 30 ++------------------- 4 files changed, 7 insertions(+), 70 deletions(-) (limited to 'src/gallium/auxiliary') diff --git a/src/gallium/auxiliary/gallivm/lp_bld.h b/src/gallium/auxiliary/gallivm/lp_bld.h index a01c216..7ba925c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld.h +++ b/src/gallium/auxiliary/gallivm/lp_bld.h @@ -53,8 +53,8 @@ #ifndef HAVE_LLVM #error "HAVE_LLVM should be set with LLVM's version number, e.g. (0x0207 for 2.7)" #endif -#if HAVE_LLVM < 0x301 -#error "LLVM 3.1 or newer required" +#if HAVE_LLVM < 0x303 +#error "LLVM 3.3 or newer required" #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index b6b52c8..bad65c2 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -43,11 +43,7 @@ #include -#if HAVE_LLVM >= 0x0303 #include -#else -#include -#endif #include #include @@ -57,7 +53,7 @@ #if HAVE_LLVM >= 0x0305 #define OwningPtr std::unique_ptr -#elif HAVE_LLVM >= 0x0303 +#else #include #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 8d7a0b6..b82cb77 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -45,35 +45,13 @@ /* Only MCJIT is available as of LLVM SVN r216982 */ #if HAVE_LLVM >= 0x0306 - -#define USE_MCJIT 1 -#define HAVE_AVX 1 - -#else - -/** - * AVX is supported in: - * - standard JIT from LLVM 3.2 onwards - * - MC-JIT from LLVM 3.1 - * - MC-JIT supports limited OSes (MacOSX and Linux) - * - standard JIT in LLVM 3.1, with backports - */ -#if defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64) # define USE_MCJIT 1 -# define HAVE_AVX 0 -#elif HAVE_LLVM >= 0x0302 || (HAVE_LLVM == 0x0301 && defined(HAVE_JIT_AVX_SUPPORT)) -# define USE_MCJIT 0 -# define HAVE_AVX 1 -#elif HAVE_LLVM == 0x0301 && (defined(PIPE_OS_LINUX) || defined(PIPE_OS_APPLE)) +#elif defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64) # define USE_MCJIT 1 -# define HAVE_AVX 1 #else # define USE_MCJIT 0 -# define HAVE_AVX 0 #endif -#endif /* HAVE_LLVM >= 0x0306 */ - #if USE_MCJIT void LLVMLinkInMCJIT(); #endif @@ -414,8 +392,7 @@ lp_build_init(void) * See also: * - http://www.anandtech.com/show/4955/the-bulldozer-review-amd-fx8150-tested/2 */ - if (HAVE_AVX && - util_cpu_caps.has_avx && + if (util_cpu_caps.has_avx && util_cpu_caps.has_intel) { lp_native_vector_width = 256; } else { @@ -440,16 +417,6 @@ lp_build_init(void) util_cpu_caps.has_avx2 = 0; } - if (!HAVE_AVX) { - /* - * note these instructions are VEX-only, so can only emit if we use - * avx (don't want to base it on has_avx & has_f16c later as that would - * omit it unnecessarily on amd cpus, see above). - */ - util_cpu_caps.has_f16c = 0; - util_cpu_caps.has_xop = 0; - } - #ifdef PIPE_ARCH_PPC_64 /* Set the NJ bit in VSCR to 0 so denormalized values are handled as * specified by IEEE standard (PowerISA 2.06 - Section 6.3). This guarantees diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 9c2de2c..ab3b3c9 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -64,11 +64,9 @@ #include -#if HAVE_LLVM >= 0x0303 #include #include #include -#endif #include "pipe/p_config.h" #include "util/u_debug.h" @@ -82,15 +80,9 @@ class LLVMEnsureMultithreaded { public: LLVMEnsureMultithreaded() { -#if HAVE_LLVM < 0x0303 - if (!llvm::llvm_is_multithreaded()) { - llvm::llvm_start_multithreaded(); - } -#else if (!LLVMIsMultithreaded()) { LLVMStartMultithreaded(); } -#endif } }; @@ -260,7 +252,6 @@ class DelegatingJITMemoryManager : public llvm::JITMemoryManager { return mgr()->allocateCodeSection(Size, Alignment, SectionID); } #endif -#if HAVE_LLVM >= 0x0303 virtual uint8_t *allocateDataSection(uintptr_t Size, unsigned Alignment, unsigned SectionID, @@ -286,22 +277,15 @@ class DelegatingJITMemoryManager : public llvm::JITMemoryManager { mgr()->registerEHFrames(SectionData); } #endif -#else - virtual uint8_t *allocateDataSection(uintptr_t Size, - unsigned Alignment, - unsigned SectionID) { - return mgr()->allocateDataSection(Size, Alignment, SectionID); - } -#endif virtual void *getPointerToNamedFunction(const std::string &Name, bool AbortOnFailure=true) { return mgr()->getPointerToNamedFunction(Name, AbortOnFailure); } -#if HAVE_LLVM == 0x0303 +#if HAVE_LLVM <= 0x0303 virtual bool applyPermissions(std::string *ErrMsg = 0) { return mgr()->applyPermissions(ErrMsg); } -#elif HAVE_LLVM > 0x0303 +#else virtual bool finalizeMemory(std::string *ErrMsg = 0) { return mgr()->finalizeMemory(ErrMsg); } @@ -509,17 +493,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, ExecutionEngine *JIT; -#if HAVE_LLVM >= 0x0302 JIT = builder.create(); -#else - /* - * Workaround http://llvm.org/PR12833 - */ - StringRef MArch = ""; - StringRef MCPU = ""; - Triple TT(unwrap(M)->getTargetTriple()); - JIT = builder.create(builder.selectTarget(TT, MArch, MCPU, MAttrs)); -#endif if (JIT) { *OutJIT = wrap(JIT); return 0; -- cgit v1.1