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@v3.sk>
Cc: <mesa-stable@lists.freedesktop.org>
Closes: https://gitlab.freedesktop.org/mesa/mesa/merge_requests/518
Reviewed-by: Matt Turner <mattst88@gmail.com>
llvm::SmallVector<std::string, 16> MAttrs;
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);
*/
llvm::StringMap<bool> features;
llvm::sys::getHostCPUFeatures(features);
++f) {
MAttrs.push_back(((*f).second ? "+" : "-") + (*f).first().str());
}
++f) {
MAttrs.push_back(((*f).second ? "+" : "-") + (*f).first().str());
}
+#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.
/*
* We need to unset attributes because sometimes LLVM mistakenly assumes
* certain features are present given the processor name.
MAttrs.push_back("-avx512vl");
#endif
#endif
MAttrs.push_back("-avx512vl");
#endif
#endif
#if defined(PIPE_ARCH_PPC)
MAttrs.push_back(util_cpu_caps.has_altivec ? "+altivec" : "-altivec");
#if defined(PIPE_ARCH_PPC)
MAttrs.push_back(util_cpu_caps.has_altivec ? "+altivec" : "-altivec");