mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-22 05:20:37 +02:00
gallivm: use getHostCPUFeatures on x86/llvm-4.0+.
Use llvm provided API based on cpuid rather than our own manually mantained list of mattr enabling/disabling. Reviewed-by: Roland Scheidegger <sroland@vmware.com>
This commit is contained in:
parent
48416b6f4d
commit
b035d9cab5
1 changed files with 15 additions and 0 deletions
|
|
@ -542,6 +542,20 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
||||||
llvm::SmallVector<std::string, 16> MAttrs;
|
llvm::SmallVector<std::string, 16> MAttrs;
|
||||||
|
|
||||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
#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.
|
||||||
|
*/
|
||||||
|
llvm::StringMap<bool> features;
|
||||||
|
llvm::sys::getHostCPUFeatures(features);
|
||||||
|
|
||||||
|
for (StringMapIterator<bool> f = features.begin();
|
||||||
|
f != features.end();
|
||||||
|
++f) {
|
||||||
|
MAttrs.push_back(((*f).second ? "+" : "-") + (*f).first().str());
|
||||||
|
}
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
* We need to unset attributes because sometimes LLVM mistakenly assumes
|
* We need to unset attributes because sometimes LLVM mistakenly assumes
|
||||||
* certain features are present given the processor name.
|
* certain features are present given the processor name.
|
||||||
|
|
@ -596,6 +610,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
||||||
MAttrs.push_back("-avx512vl");
|
MAttrs.push_back("-avx512vl");
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PIPE_ARCH_PPC)
|
#if defined(PIPE_ARCH_PPC)
|
||||||
MAttrs.push_back(util_cpu_caps.has_altivec ? "+altivec" : "-altivec");
|
MAttrs.push_back(util_cpu_caps.has_altivec ? "+altivec" : "-altivec");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue