[PATCH] D41382: [AArch64] Asm: Fix parsing of register aliases that have a name starting with 'z'

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 19 02:38:55 PST 2017


sdesmalen created this revision.
sdesmalen added reviewers: rnk, fhahn, rengolin, efriedma.
Herald added subscribers: kristof.beyls, javed.absar, aemerson.

This fixes an issue as identified by @rnk in https://reviews.llvm.org/rL321029.


https://reviews.llvm.org/D41382

Files:
  lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
  test/MC/AArch64/dot-req.s


Index: test/MC/AArch64/dot-req.s
===================================================================
--- test/MC/AArch64/dot-req.s
+++ test/MC/AArch64/dot-req.s
@@ -42,3 +42,8 @@
 	add peter, x0, x0
 	.unreq peter
 // CHECK: add x6, x0, x0
+
+	zoe .req x6
+	add zoe, x0, x0
+	.unreq zoe
+// CHECK: add x6, x0, x0
Index: lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
===================================================================
--- lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
+++ lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
@@ -1936,10 +1936,6 @@
       .Default(false);
 }
 
-static bool isSVEDataVectorRegister(StringRef Name) {
-  return Name[0] == 'z';
-}
-
 static void parseValidVectorKind(StringRef Name, unsigned &NumElements,
                                  char &ElementKind) {
   assert(isValidVectorKind(Name));
@@ -2007,10 +2003,13 @@
     return -1;
 
   std::string lowerCase = Tok.getString().lower();
-  if (isSVEDataVectorRegister(lowerCase))
+  unsigned RegNum = matchRegisterNameAlias(lowerCase, RegKind::Scalar);
+
+  // Leave the parsing of ZPR/PPR registers (or aliases) to the explicit
+  // tryParse methods for SVE data and predicate vectors.
+  if (AArch64MCRegisterClasses[AArch64::ZPRRegClassID].contains(RegNum))
     return -1;
 
-  unsigned RegNum = matchRegisterNameAlias(lowerCase, RegKind::Scalar);
   // Also handle a few aliases of registers.
   if (RegNum == 0)
     RegNum = StringSwitch<unsigned>(lowerCase)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41382.127474.patch
Type: text/x-patch
Size: 1472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171219/b6c4b479/attachment.bin>


More information about the llvm-commits mailing list