From 0be1c41e6378a5b6c24f4c0b2a90cc60ab84400e Mon Sep 17 00:00:00 2001 From: kd-11 Date: Sat, 3 Aug 2024 16:27:33 +0300 Subject: [PATCH] Improve AMD CPU detection --- Utilities/JITLLVM.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Utilities/JITLLVM.cpp b/Utilities/JITLLVM.cpp index f42245c3d7..ecb56e2769 100644 --- a/Utilities/JITLLVM.cpp +++ b/Utilities/JITLLVM.cpp @@ -735,6 +735,11 @@ llvm::StringRef fallback_cpu_detection() { switch (family) { + case 0x10: + return "amdfam10"; + case 0x15: + // Bulldozer class, includes piledriver, excavator, steamroller, etc + return utils::has_avx2() ? "bdver4" : "bdver1"; case 0x17: case 0x18: // No major differences between znver1 and znver2, return the lesser @@ -749,7 +754,9 @@ llvm::StringRef fallback_cpu_detection() // Return zen4 as a workaround until the next LLVM upgrade. return "znver4"; default: - return "znver4"; // Return newest known model here + return utils::has_avx512() + ? "znver4" + : "znver3"; } } else if (brand.contains("Intel"))