[llvm] [AArch64] Improve host feature detection. (PR #160410)

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 22 11:01:44 PDT 2025


================
@@ -2260,20 +2260,80 @@ StringMap<bool> sys::getHostCPUFeatures() {
   uint32_t Sha2 = CAP_SHA1 | CAP_SHA2;
   Features["aes"] = (crypto & Aes) == Aes;
   Features["sha2"] = (crypto & Sha2) == Sha2;
+
+  // SVE support is disabled in for cores which are identified as supporting
+  // SVE; disable SVE if we don't detect support at runtime.
----------------
efriedma-quic wrote:

You have the right idea.  Really, the map is just incomplete: if a feature isn't in the map, we didn't detect it in either direction, so we fall back to a default based on the target CPU/architecture/etc.

I guess we could just set true/false for every feature we know how to detect, if we're confident in the detection detection logic is reliable.

Maybe we should just doing this detection differently, though; using auxinfo like compiler-rt.

https://github.com/llvm/llvm-project/pull/160410


More information about the llvm-commits mailing list