[clang] [ARM][Driver] Ensure NEON is enabled and disabled correctly (PR #137595)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 28 05:23:16 PDT 2025
================
@@ -781,6 +781,30 @@ llvm::ARM::FPUKind arm::getARMTargetFeatures(const Driver &D,
if (FPUKind == llvm::ARM::FK_FPV5_D16 || FPUKind == llvm::ARM::FK_FPV5_SP_D16)
Features.push_back("-mve.fp");
+ // If SIMD has been disabled and the selected FPU support NEON, then features
+ // that rely on NEON Instructions should also be disabled. Cases where NEON
+ // needs activating to support another feature is handled below with the
+ // crypto feature.
+ bool HasSimd = false;
+ const auto ItSimd =
+ llvm::find_if(llvm::reverse(Features),
+ [](const StringRef F) { return F.contains("neon"); });
+ const bool FoundSimd = ItSimd != Features.rend();
+ const bool FPUSupportsNeon = (llvm::ARM::FPUNames[FPUKind].NeonSupport ==
+ llvm::ARM::NeonSupportLevel::Neon) ||
+ (llvm::ARM::FPUNames[FPUKind].NeonSupport ==
+ llvm::ARM::NeonSupportLevel::Crypto);
+ if (FoundSimd)
----------------
sivan-shani wrote:
Replace `FoundSimd` condition-check with `ItSimd != Features.rend()` The variable is redundant.
https://github.com/llvm/llvm-project/pull/137595
More information about the cfe-commits
mailing list