[Mesa-dev] [Mesa-stable] [PATCH 3/3] gallivm: Reenable PPC VSX (v3)

Emil Velikov emil.l.velikov at gmail.com
Thu Feb 9 14:17:19 UTC 2017


Hi Ben,

On 19 January 2017 at 01:44, Ben Crocker <bcrocker at redhat.com> wrote:
> Reenable the PPC64LE Vector-Scalar Extension for LLVM versions >= 3.8.1,
> now that LLVM bug 26775 and its corollary, 25503, are fixed.
>
> Amendment: remove extraneous spaces in macro def & invocations.
>
> We would prefer a runtime check, e.g. via an LLVMQueryString
> (analogous to glGetString, eglQueryString) or LLVMGetVersion API,
> but no such API exists at this time.
>
Please keep the mesa-stable line within the commit message. Similar to
how you'd do for kernel stable patches.

> Signed-off-by: Ben Crocker <bcrocker at redhat.com>
> ---
>  src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 15 ++++++++++++++-
>  1 file changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> index cac81b9..ff6bbb9 100644
> --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
> @@ -50,6 +50,8 @@
>
>  #include <stddef.h>
>
> +#define LLVM_VERSION(MAJOR_MINOR, PATCH_LEVEL) ((MAJOR_MINOR << 8) + PATCH_LEVEL)
> +
Afaict the following should also work, plus it's bit easier to read
and more consistent to what we have in mesa.

>  // Workaround http://llvm.org/PR23628
>  #if HAVE_LLVM >= 0x0307
>  #  pragma push_macro("DEBUG")
> @@ -614,7 +616,8 @@ 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 >= 0x0304) && \
> +   (LLVM_VERSION(HAVE_LLVM, MESA_LLVM_VERSION_PATCH) <= LLVM_VERSION(0x0308, 0x00))

#if HAVE_LLVM >= 0x0304
+#if HAVE_LLVM < 0x0307 || (HAVE_LLVM == 0x0308 && MESA_LLVM_VERSION_PATCH == 0)

>     /*
>      * Make sure VSX instructions are disabled
>      * See LLVM bug https://llvm.org/bugs/show_bug.cgi?id=25503#c7
> @@ -622,6 +625,16 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
>     if (util_cpu_caps.has_altivec) {
>        MAttrs.push_back("-vsx");
>     }
> +#elif LLVM_VERSION(HAVE_LLVM, MESA_LLVM_VERSION_PATCH) > LLVM_VERSION(0x0308, 0x00))
+#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
> +    */
> +   if (util_cpu_caps.has_altivec) {
> +      MAttrs.push_back("+vsx");
> +   }
+#endif

Thanks
Emil


More information about the mesa-dev mailing list