summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBen Crocker <[email protected]>2017-09-28 14:09:12 -0400
committerRoland Scheidegger <[email protected]>2017-10-05 02:13:47 +0200
commite93f056a4e5babde516c9ef53ae3547f68f1b824 (patch)
tree9c0ae8104a8c022289e40cd8ff19520ef82d7f94 /src
parent5c75f0c8bb876c1f4c85cda5ed10a4d632d24f56 (diff)
gallivm/ppc64le: adjust VSX code generation control.
In lp_build_create_jit_compiler_for_module(), advance the minimum version of LLVM for VSX code generation to 4.0; this is the minimum revision at which several known VSX code generation bugs are fixed: https://llvm.org/bugs/show_bug.cgi?id=25503 (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) An llc performance bug introduced in LLVM 4.0, https://llvm.org/bugs/show_bug.cgi?id=34647 is still pending as of LLVM 5.0, but only has a pronounced effect on one of the Piglit tests: ext_transform_feedback-max-varyings. All changes tested via Piglit. Cc: "17.2" <[email protected]> Signed-off-by: Ben Crocker <[email protected]> Acked-by: Roland Scheidegger <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/gallivm/lp_bld_misc.cpp37
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