[clang] [clang] [ARM] Explicitly enable NEON for Windows/Darwin targets (PR #122095)

Martin Storsjö via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 10 08:33:37 PST 2025


================
@@ -659,13 +659,21 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D,
         CPUArgFPUKind != llvm::ARM::FK_INVALID ? CPUArgFPUKind : ArchArgFPUKind;
     (void)llvm::ARM::getFPUFeatures(FPUKind, Features);
   } else {
+    bool Generic = true;
     if (!ForAS) {
       std::string CPU = arm::getARMTargetCPU(CPUName, ArchName, Triple);
+      if (CPU != "generic")
+        Generic = false;
----------------
mstorsjo wrote:

Btw, I do feel that this logic where we explicitly look for `"generic"` is a bit kludgey. It would be slightly neater to just stick this into the existing Android case above (at lines 650-655) - but then the default-neon case overrides arch/os default CPUs from `getLLVMArchKindForARM`, which shows up as different output for `%clang -target x86_64-apple-macosx10.10 -arch armv7s` in `arm-target-features.c` below (where the default cpu for `armv7s` includes fp16 support).

I'm open to opinions on what's the least ugly compromise here. :-)

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


More information about the cfe-commits mailing list