sync with OpenBSD -current

This commit is contained in:
purplerain 2025-01-26 18:10:58 +00:00
parent 1fd36b57f8
commit d263854dd3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
2 changed files with 11 additions and 2 deletions

View file

@ -8,6 +8,7 @@
#include <llvm/Analysis/TargetLibraryInfo.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/LegacyPassManager.h>
#include <llvm/IR/Module.h>
#include <llvm/IR/Verifier.h>
#include <llvm/Target/TargetMachine.h>
#include <llvm/MC/MCSubtargetInfo.h>

View file

@ -402,8 +402,14 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
* which allows us to enable/disable code generation based
* on the results of cpuid on these architectures.
*/
#if LLVM_VERSION_MAJOR >= 19
/* llvm-19+ returns StringMap from getHostCPUFeatures.
*/
auto features = llvm::sys::getHostCPUFeatures();
#else
llvm::StringMap<bool> features;
llvm::sys::getHostCPUFeatures(features);
#endif
for (StringMapIterator<bool> f = features.begin();
f != features.end();
@ -443,8 +449,10 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
/* All avx512 have avx512f */
MAttrs.push_back(util_get_cpu_caps()->has_avx512f ? "+avx512f" : "-avx512f");
MAttrs.push_back(util_get_cpu_caps()->has_avx512cd ? "+avx512cd" : "-avx512cd");
#if LLVM_VERSION_MAJOR < 19
MAttrs.push_back(util_get_cpu_caps()->has_avx512er ? "+avx512er" : "-avx512er");
MAttrs.push_back(util_get_cpu_caps()->has_avx512pf ? "+avx512pf" : "-avx512pf");
#endif
MAttrs.push_back(util_get_cpu_caps()->has_avx512bw ? "+avx512bw" : "-avx512bw");
MAttrs.push_back(util_get_cpu_caps()->has_avx512dq ? "+avx512dq" : "-avx512dq");
MAttrs.push_back(util_get_cpu_caps()->has_avx512vl ? "+avx512vl" : "-avx512vl");