[clang] [Clang] Remove AArch64TargetInfo::setArchFeatures (PR #146107)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 27 09:25:38 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-aarch64
Author: Sander de Smalen (sdesmalen-arm)
<details>
<summary>Changes</summary>
When compiling with `-march=armv9-a+nosve` we found that Clang still defines the `__ARM_FEATURE_SVE2` macro, which is explicitly set in `setArchFeatures` when compiling for armv9-a.
After some experimenting, I found out that the list of features passed into `AArch64TargetInfo::handleTargetFeatures` has already been expanded and takes into account `+no[feature]` and has already expanded features like `armv9-a`.
>From that I conclude that `setArchFeatures` is no longer required.
---
Full diff: https://github.com/llvm/llvm-project/pull/146107.diff
2 Files Affected:
- (modified) clang/lib/Basic/Targets/AArch64.cpp (-74)
- (modified) clang/lib/Basic/Targets/AArch64.h (-2)
``````````diff
diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index 124b340b62d9f..e57feafe3ae24 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -125,79 +125,6 @@ static constexpr auto BuiltinAArch64Infos =
#include "clang/Basic/BuiltinsAArch64.def"
});
-void AArch64TargetInfo::setArchFeatures() {
- if (*ArchInfo == llvm::AArch64::ARMV8R) {
- HasDotProd = true;
- HasDIT = true;
- HasFlagM = true;
- HasRCPC = true;
- FPU |= NeonMode;
- HasCCPP = true;
- HasCRC = true;
- HasLSE = true;
- HasRDM = true;
- } else if (ArchInfo->Version.getMajor() == 8) {
- if (ArchInfo->Version.getMinor() >= 7u) {
- HasWFxT = true;
- }
- if (ArchInfo->Version.getMinor() >= 6u) {
- HasBFloat16 = true;
- HasMatMul = true;
- }
- if (ArchInfo->Version.getMinor() >= 5u) {
- HasAlternativeNZCV = true;
- HasFRInt3264 = true;
- HasSSBS = true;
- HasSB = true;
- HasPredRes = true;
- HasBTI = true;
- }
- if (ArchInfo->Version.getMinor() >= 4u) {
- HasDotProd = true;
- HasDIT = true;
- HasFlagM = true;
- }
- if (ArchInfo->Version.getMinor() >= 3u) {
- HasRCPC = true;
- FPU |= NeonMode;
- }
- if (ArchInfo->Version.getMinor() >= 2u) {
- HasCCPP = true;
- }
- if (ArchInfo->Version.getMinor() >= 1u) {
- HasCRC = true;
- HasLSE = true;
- HasRDM = true;
- }
- } else if (ArchInfo->Version.getMajor() == 9) {
- if (ArchInfo->Version.getMinor() >= 2u) {
- HasWFxT = true;
- }
- if (ArchInfo->Version.getMinor() >= 1u) {
- HasBFloat16 = true;
- HasMatMul = true;
- }
- FPU |= SveMode;
- HasSVE2 = true;
- HasFullFP16 = true;
- HasAlternativeNZCV = true;
- HasFRInt3264 = true;
- HasSSBS = true;
- HasSB = true;
- HasPredRes = true;
- HasBTI = true;
- HasDotProd = true;
- HasDIT = true;
- HasFlagM = true;
- HasRCPC = true;
- FPU |= NeonMode;
- HasCCPP = true;
- HasCRC = true;
- HasLSE = true;
- HasRDM = true;
- }
-}
-
AArch64TargetInfo::AArch64TargetInfo(const llvm::Triple &Triple,
const TargetOptions &Opts)
: TargetInfo(Triple), ABI("aapcs") {
@@ -1266,7 +1193,6 @@ bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
}
setDataLayout();
- setArchFeatures();
if (HasNoFP) {
FPU &= ~FPUMode;
diff --git a/clang/lib/Basic/Targets/AArch64.h b/clang/lib/Basic/Targets/AArch64.h
index 1951e0679d2ec..56adfa97efb1a 100644
--- a/clang/lib/Basic/Targets/AArch64.h
+++ b/clang/lib/Basic/Targets/AArch64.h
@@ -158,8 +158,6 @@ class LLVM_LIBRARY_VISIBILITY AArch64TargetInfo : public TargetInfo {
return false;
}
- void setArchFeatures();
-
void getTargetDefinesARMV81A(const LangOptions &Opts,
MacroBuilder &Builder) const;
void getTargetDefinesARMV82A(const LangOptions &Opts,
``````````
</details>
https://github.com/llvm/llvm-project/pull/146107
More information about the cfe-commits
mailing list