diff options
Diffstat (limited to 'src/gallium/auxiliary/gallivm/lp_bld_misc.cpp')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 60d88269e50..d988910a7eb 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -630,23 +630,46 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, #if defined(PIPE_ARCH_PPC) MAttrs.push_back(util_cpu_caps.has_altivec ? "+altivec" : "-altivec"); #if (HAVE_LLVM >= 0x0304) -#if (HAVE_LLVM <= 0x0307) || (HAVE_LLVM == 0x0308 && MESA_LLVM_VERSION_PATCH == 0) +#if (HAVE_LLVM < 0x0400) /* * Make sure VSX instructions are disabled - * See LLVM bug https://llvm.org/bugs/show_bug.cgi?id=25503#c7 + * See LLVM bugs: + * https://llvm.org/bugs/show_bug.cgi?id=25503#c7 (fixed in 3.8.1) + * https://llvm.org/bugs/show_bug.cgi?id=26775 (fixed in 3.8.1) + * https://llvm.org/bugs/show_bug.cgi?id=33531 (fixed in 4.0) + * https://llvm.org/bugs/show_bug.cgi?id=34647 (llc performance on certain unusual shader IR; intro'd in 4.0, pending as of 5.0) */ if (util_cpu_caps.has_altivec) { MAttrs.push_back("-vsx"); } #else /* - * However, bug 25503 is fixed, by the same fix that fixed - * bug 26775, in versions of LLVM later than 3.8 (starting with 3.8.1): - * Make sure VSX instructions are ENABLED - * See LLVM bug https://llvm.org/bugs/show_bug.cgi?id=26775 + * Bug 25503 is fixed, by the same fix that fixed + * bug 26775, in versions of LLVM later than 3.8 (starting with 3.8.1). + * BZ 33531 actually comprises more than one bug, all of + * which are fixed in LLVM 4.0. + * + * With LLVM 4.0 or higher: + * Make sure VSX instructions are ENABLED, unless + * a) the entire -mattr option is overridden via GALLIVM_MATTRS, or + * b) VSX instructions are explicitly enabled/disabled via GALLIVM_VSX=1 or 0. */ if (util_cpu_caps.has_altivec) { - MAttrs.push_back("+vsx"); + char *env_mattrs = getenv("GALLIVM_MATTRS"); + if (env_mattrs) { + MAttrs.push_back(env_mattrs); + } + else { + boolean enable_vsx = true; + char *env_vsx = getenv("GALLIVM_VSX"); + if (env_vsx && env_vsx[0] == '0') { + enable_vsx = false; + } + if (enable_vsx) + MAttrs.push_back("+vsx"); + else + MAttrs.push_back("-vsx"); + } } #endif #endif |