Mesa (staging/19.0): gallivm: guess CPU features also on ARM

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Apr 23 18:49:17 UTC 2019


Module: Mesa
Branch: staging/19.0
Commit: b5090681643d190f14df60bdcdbfe02fa959ea08
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=b5090681643d190f14df60bdcdbfe02fa959ea08

Author: Lubomir Rintel <lkundrak at v3.sk>
Date:   Mon Mar 11 19:16:40 2019 +0100

gallivm: guess CPU features also on ARM

getHostCPUFeatures() is also available on ARM, for even longer time than
for x86. Use it -- it potentially enables instructions that may speed
things up.

Signed-off-by: Lubomir Rintel <lkundrak at v3.sk>
Cc: <mesa-stable at lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/518
Reviewed-by: Matt Turner <mattst88 at gmail.com>
(cherry picked from commit bc6bfc861fd3484c4cc51f24ccb0bf64239fcfd7)

---

 src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
index fcbdd5050fe..f3b5784fce7 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
@@ -556,11 +556,11 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
 
    llvm::SmallVector<std::string, 16> MAttrs;
 
-#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
-#if HAVE_LLVM >= 0x0400
-   /* llvm-3.7+ implements sys::getHostCPUFeatures for x86,
-    * which allows us to enable/disable code generation based
-    * on the results of cpuid.
+#if HAVE_LLVM >= 0x0400 && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_ARM))
+   /* llvm-3.3+ implements sys::getHostCPUFeatures for Arm
+    * and llvm-3.7+ for x86, which allows us to enable/disable
+    * code generation based on the results of cpuid on these
+    * architectures.
     */
    llvm::StringMap<bool> features;
    llvm::sys::getHostCPUFeatures(features);
@@ -570,7 +570,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
         ++f) {
       MAttrs.push_back(((*f).second ? "+" : "-") + (*f).first().str());
    }
-#else
+#elif defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
    /*
     * We need to unset attributes because sometimes LLVM mistakenly assumes
     * certain features are present given the processor name.
@@ -625,7 +625,6 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
    MAttrs.push_back("-avx512vl");
 #endif
 #endif
-#endif
 
 #if defined(PIPE_ARCH_PPC)
    MAttrs.push_back(util_cpu_caps.has_altivec ? "+altivec" : "-altivec");




More information about the mesa-commit mailing list