From dd708166aaea75852d998ad8297f06f576fa08a6 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 3 Aug 2024 05:09:10 +0300 Subject: [PATCH] Improve intel and apple detection --- Utilities/JITLLVM.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/Utilities/JITLLVM.cpp b/Utilities/JITLLVM.cpp index 616979f474..10e4174072 100644 --- a/Utilities/JITLLVM.cpp +++ b/Utilities/JITLLVM.cpp @@ -751,10 +751,30 @@ llvm::StringRef fallback_cpu_detection() return "znver5"; // Return newest known model here } } - else if (brand.startswith("Virtual Apple")) + else if (brand.contains("Intel")) + { + if (!utils::has_avx()) + { + return "nehalem"; + } + if (!utils::has_avx2()) + { + return "ivybridge"; + } + if (!utils::has_avx512()) + { + return "skylake"; + } + if (utils::has_avx512_icl()) + { + return "cannonlake"; + } + return "icelake-client"; + } + else if (brand.startswith("VirtualApple")) { // No AVX. This will change in MacOS 15+, at which point we may revise this. - return "nehalem"; + return utils::has_avx() ? "haswell" : "nehalem"; } #elif defined(ARCH_ARM64)