[llvm] 61b0a49 - [llvm][ARM] Refactor isMnemonicVPTPredicable
David Spickett via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 02:39:15 PDT 2023
Author: David Spickett
Date: 2023-03-23T09:39:08Z
New Revision: 61b0a492ccb1ab62c8c8aa1b154ce4c7d69a6da2
URL: https://github.com/llvm/llvm-project/commit/61b0a492ccb1ab62c8c8aa1b154ce4c7d69a6da2
DIFF: https://github.com/llvm/llvm-project/commit/61b0a492ccb1ab62c8c8aa1b154ce4c7d69a6da2.diff
LOG: [llvm][ARM] Refactor isMnemonicVPTPredicable
Fixes #61607
Several names were repeated in this giant list. I have refactored
it and removed the duplicates.
Reviewed By: dmgreen
Differential Revision: https://reviews.llvm.org/D146619
Added:
Modified:
llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index e0bc431fd4bd8..6cbb7120e2667 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -12887,71 +12887,41 @@ bool ARMAsmParser::isMnemonicVPTPredicable(StringRef Mnemonic,
if (!hasMVE())
return false;
- return Mnemonic.startswith("vabav") || Mnemonic.startswith("vaddv") ||
- Mnemonic.startswith("vaddlv") || Mnemonic.startswith("vminnmv") ||
- Mnemonic.startswith("vminnmav") || Mnemonic.startswith("vminv") ||
- Mnemonic.startswith("vminav") || Mnemonic.startswith("vmaxnmv") ||
- Mnemonic.startswith("vmaxnmav") || Mnemonic.startswith("vmaxv") ||
- Mnemonic.startswith("vmaxav") || Mnemonic.startswith("vmladav") ||
- Mnemonic.startswith("vrmlaldavh") || Mnemonic.startswith("vrmlalvh") ||
- Mnemonic.startswith("vmlsdav") || Mnemonic.startswith("vmlav") ||
- Mnemonic.startswith("vmlaldav") || Mnemonic.startswith("vmlalv") ||
- Mnemonic.startswith("vmaxnm") || Mnemonic.startswith("vminnm") ||
- Mnemonic.startswith("vmax") || Mnemonic.startswith("vmin") ||
- Mnemonic.startswith("vshlc") || Mnemonic.startswith("vmovlt") ||
- Mnemonic.startswith("vmovlb") || Mnemonic.startswith("vshll") ||
- Mnemonic.startswith("vrshrn") || Mnemonic.startswith("vshrn") ||
- Mnemonic.startswith("vqrshrun") || Mnemonic.startswith("vqshrun") ||
- Mnemonic.startswith("vqrshrn") || Mnemonic.startswith("vqshrn") ||
- Mnemonic.startswith("vbic") || Mnemonic.startswith("vrev64") ||
- Mnemonic.startswith("vrev32") || Mnemonic.startswith("vrev16") ||
- Mnemonic.startswith("vmvn") || Mnemonic.startswith("veor") ||
- Mnemonic.startswith("vorn") || Mnemonic.startswith("vorr") ||
- Mnemonic.startswith("vand") || Mnemonic.startswith("vmul") ||
- Mnemonic.startswith("vqrdmulh") || Mnemonic.startswith("vqdmulh") ||
- Mnemonic.startswith("vsub") || Mnemonic.startswith("vadd") ||
- Mnemonic.startswith("vqsub") || Mnemonic.startswith("vqadd") ||
- Mnemonic.startswith("vabd") || Mnemonic.startswith("vrhadd") ||
- Mnemonic.startswith("vhsub") || Mnemonic.startswith("vhadd") ||
- Mnemonic.startswith("vdup") || Mnemonic.startswith("vcls") ||
- Mnemonic.startswith("vclz") || Mnemonic.startswith("vneg") ||
- Mnemonic.startswith("vabs") || Mnemonic.startswith("vqneg") ||
- Mnemonic.startswith("vqabs") ||
- (Mnemonic.startswith("vrint") && Mnemonic != "vrintr") ||
- Mnemonic.startswith("vcmla") || Mnemonic.startswith("vfma") ||
- Mnemonic.startswith("vfms") || Mnemonic.startswith("vcadd") ||
- Mnemonic.startswith("vadd") || Mnemonic.startswith("vsub") ||
- Mnemonic.startswith("vshl") || Mnemonic.startswith("vqshl") ||
- Mnemonic.startswith("vqrshl") || Mnemonic.startswith("vrshl") ||
- Mnemonic.startswith("vsri") || Mnemonic.startswith("vsli") ||
- Mnemonic.startswith("vrshr") || Mnemonic.startswith("vshr") ||
- Mnemonic.startswith("vpsel") || Mnemonic.startswith("vcmp") ||
- Mnemonic.startswith("vqdmladh") || Mnemonic.startswith("vqrdmladh") ||
- Mnemonic.startswith("vqdmlsdh") || Mnemonic.startswith("vqrdmlsdh") ||
- Mnemonic.startswith("vcmul") || Mnemonic.startswith("vrmulh") ||
- Mnemonic.startswith("vqmovn") || Mnemonic.startswith("vqmovun") ||
- Mnemonic.startswith("vmovnt") || Mnemonic.startswith("vmovnb") ||
- Mnemonic.startswith("vmaxa") || Mnemonic.startswith("vmaxnma") ||
- Mnemonic.startswith("vhcadd") || Mnemonic.startswith("vadc") ||
- Mnemonic.startswith("vsbc") || Mnemonic.startswith("vrshr") ||
- Mnemonic.startswith("vshr") || Mnemonic.startswith("vstrb") ||
- Mnemonic.startswith("vldrb") ||
- (Mnemonic.startswith("vstrh") && Mnemonic != "vstrhi") ||
- (Mnemonic.startswith("vldrh") && Mnemonic != "vldrhi") ||
- Mnemonic.startswith("vstrw") || Mnemonic.startswith("vldrw") ||
- Mnemonic.startswith("vldrd") || Mnemonic.startswith("vstrd") ||
- Mnemonic.startswith("vqdmull") || Mnemonic.startswith("vbrsr") ||
- Mnemonic.startswith("vfmas") || Mnemonic.startswith("vmlas") ||
- Mnemonic.startswith("vmla") || Mnemonic.startswith("vqdmlash") ||
- Mnemonic.startswith("vqdmlah") || Mnemonic.startswith("vqrdmlash") ||
- Mnemonic.startswith("vqrdmlah") || Mnemonic.startswith("viwdup") ||
- Mnemonic.startswith("vdwdup") || Mnemonic.startswith("vidup") ||
- Mnemonic.startswith("vddup") || Mnemonic.startswith("vctp") ||
- Mnemonic.startswith("vpnot") || Mnemonic.startswith("vbic") ||
- Mnemonic.startswith("vrmlsldavh") || Mnemonic.startswith("vmlsldav") ||
- Mnemonic.startswith("vcvt") ||
- MS.isVPTPredicableCDEInstr(Mnemonic) ||
- (Mnemonic.startswith("vmov") &&
- !(ExtraToken == ".f16" || ExtraToken == ".32" ||
- ExtraToken == ".16" || ExtraToken == ".8"));
+ if (MS.isVPTPredicableCDEInstr(Mnemonic) ||
+ (Mnemonic.startswith("vldrh") && Mnemonic != "vldrhi") ||
+ (Mnemonic.startswith("vmov") &&
+ !(ExtraToken == ".f16" || ExtraToken == ".32" || ExtraToken == ".16" ||
+ ExtraToken == ".8")) ||
+ (Mnemonic.startswith("vrint") && Mnemonic != "vrintr") ||
+ (Mnemonic.startswith("vstrh") && Mnemonic != "vstrhi"))
+ return true;
+
+ const char *predicable_prefixes[] = {
+ "vabav", "vabd", "vabs", "vadc", "vadd",
+ "vaddlv", "vaddv", "vand", "vbic", "vbrsr",
+ "vcadd", "vcls", "vclz", "vcmla", "vcmp",
+ "vcmul", "vctp", "vcvt", "vddup", "vdup",
+ "vdwdup", "veor", "vfma", "vfmas", "vfms",
+ "vhadd", "vhcadd", "vhsub", "vidup", "viwdup",
+ "vldrb", "vldrd", "vldrw", "vmax", "vmaxa",
+ "vmaxav", "vmaxnm", "vmaxnma", "vmaxnmav", "vmaxnmv",
+ "vmaxv", "vmin", "vminav", "vminnm", "vminnmav",
+ "vminnmv", "vminv", "vmla", "vmladav", "vmlaldav",
+ "vmlalv", "vmlas", "vmlav", "vmlsdav", "vmlsldav",
+ "vmovlb", "vmovlt", "vmovnb", "vmovnt", "vmul",
+ "vmvn", "vneg", "vorn", "vorr", "vpnot",
+ "vpsel", "vqabs", "vqadd", "vqdmladh", "vqdmlah",
+ "vqdmlash", "vqdmlsdh", "vqdmulh", "vqdmull", "vqmovn",
+ "vqmovun", "vqneg", "vqrdmladh", "vqrdmlah", "vqrdmlash",
+ "vqrdmlsdh", "vqrdmulh", "vqrshl", "vqrshrn", "vqrshrun",
+ "vqshl", "vqshrn", "vqshrun", "vqsub", "vrev16",
+ "vrev32", "vrev64", "vrhadd", "vrmlaldavh", "vrmlalvh",
+ "vrmlsldavh", "vrmulh", "vrshl", "vrshr", "vrshrn",
+ "vsbc", "vshl", "vshlc", "vshll", "vshr",
+ "vshrn", "vsli", "vsri", "vstrb", "vstrd",
+ "vstrw", "vsub"};
+
+ return std::any_of(
+ std::begin(predicable_prefixes), std::end(predicable_prefixes),
+ [&Mnemonic](const char *prefix) { return Mnemonic.startswith(prefix); });
}
More information about the llvm-commits
mailing list