[clang] 220da12 - [NFC][Clang][AArch64] Clean up AArch64TargetInfo::hasFeature
Archibald Elliott via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 28 06:25:30 PST 2022
Author: Archibald Elliott
Date: 2022-02-28T14:25:12Z
New Revision: 220da125c423b71ce1507df84b75f54d274bc63d
URL: https://github.com/llvm/llvm-project/commit/220da125c423b71ce1507df84b75f54d274bc63d
DIFF: https://github.com/llvm/llvm-project/commit/220da125c423b71ce1507df84b75f54d274bc63d.diff
LOG: [NFC][Clang][AArch64] Clean up AArch64TargetInfo::hasFeature
Added:
Modified:
clang/lib/Basic/Targets/AArch64.cpp
Removed:
################################################################################
diff --git a/clang/lib/Basic/Targets/AArch64.cpp b/clang/lib/Basic/Targets/AArch64.cpp
index bd03d88b2d5aa..964cf5c824140 100644
--- a/clang/lib/Basic/Targets/AArch64.cpp
+++ b/clang/lib/Basic/Targets/AArch64.cpp
@@ -511,14 +511,12 @@ AArch64TargetInfo::getVScaleRange(const LangOptions &LangOpts) const {
}
bool AArch64TargetInfo::hasFeature(StringRef Feature) const {
- return Feature == "aarch64" || Feature == "arm64" || Feature == "arm" ||
- (Feature == "neon" && (FPU & NeonMode)) ||
- ((Feature == "sve" || Feature == "sve2" || Feature == "sve2-bitperm" ||
- Feature == "sve2-aes" || Feature == "sve2-sha3" ||
- Feature == "sve2-sm4" || Feature == "f64mm" || Feature == "f32mm" ||
- Feature == "i8mm" || Feature == "bf16") &&
- (FPU & SveMode)) ||
- (Feature == "ls64" && HasLS64);
+ return llvm::StringSwitch<bool>(Feature)
+ .Cases("aarch64", "arm64", "arm", true)
+ .Case("neon", FPU & NeonMode)
+ .Cases("sve", "sve2", "sve2-bitperm", "sve2-aes", "sve2-sha3", "sve2-sm4", "f64mm", "f32mm", "i8mm", "bf16", FPU & SveMode)
+ .Case("ls64", HasLS64)
+ .Default(false);
}
bool AArch64TargetInfo::handleTargetFeatures(std::vector<std::string> &Features,
More information about the cfe-commits
mailing list