[NFC][Clang][AArch64] Clean up AArch64TargetInfo::hasFeature
authorArchibald Elliott <archibald.elliott@arm.com>
Fri, 25 Feb 2022 18:39:34 +0000 (18:39 +0000)
committerArchibald Elliott <archibald.elliott@arm.com>
Mon, 28 Feb 2022 14:25:12 +0000 (14:25 +0000)
clang/lib/Basic/Targets/AArch64.cpp

index bd03d88..964cf5c 100644 (file)
@@ -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,