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" <mesa-stable@lists.freedesktop.org>
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
Acked-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
Ben Crocker 2017-09-28 14:09:12 -04:00 committed by Roland Scheidegger
parent 5c75f0c8bb
commit e93f056a4e
1 changed files with 30 additions and 7 deletions

View File

@ -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