[PATCH] D136088: [AArch64]SME2 instructions that use ZTO operand

Caroline via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 02:59:14 PDT 2022


CarolineConcatto added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp:4241-4242
+  StringRef Name = Tok.getString();
+  if (!Name.equals_insensitive("zt0"))
+    return MatchOperand_NoMatch;
+
----------------
paulwalker-arm wrote:
> I think this is only necessary because you're calling `tryParseScalarRegister`, which looks to be a bit of a hack if I'm honest.
> 
> What about updating `matchRegisterNameAlias` and then calling that instead?  Something like:
> ```
> if ((RegNum = MatchRegisterName(Name)))
>   return Kind == RegKind::LookupTable ? RegNum : 0;
> ```
Oh..I can  use matchRegisterNameAlias. 
By looking others tryParse<smth> it looked like I should use tryParseScalarRegister.



================
Comment at: llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp:4241-4242
+  StringRef Name = Tok.getString();
+  if (!Name.equals_insensitive("zt0"))
+    return MatchOperand_NoMatch;
+
----------------
CarolineConcatto wrote:
> paulwalker-arm wrote:
> > I think this is only necessary because you're calling `tryParseScalarRegister`, which looks to be a bit of a hack if I'm honest.
> > 
> > What about updating `matchRegisterNameAlias` and then calling that instead?  Something like:
> > ```
> > if ((RegNum = MatchRegisterName(Name)))
> >   return Kind == RegKind::LookupTable ? RegNum : 0;
> > ```
> Oh..I can  use matchRegisterNameAlias. 
> By looking others tryParse<smth> it looked like I should use tryParseScalarRegister.
> 
I created a RegKind::LookupTable. But don't know if that is what you meant.
Is that correct? 


================
Comment at: llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp:4252
+
+  if (getTok().is(AsmToken::LBrac)) {
+    Lex(); // eat [
----------------
paulwalker-arm wrote:
> I'm guessing you tried `tryParseVectorIndex` and it didn't work the way you need?
CreateVectorIndex I cannot parse
But I can with CreateImm


================
Comment at: llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp:4261
+            getLoc(), getContext()));
+        Lex(); // eat ]
+        return MatchOperand_Success;
----------------
paulwalker-arm wrote:
> This assumes the next token is a `]`, which it might not be so you'll assemble something that is not valid syntax.  If `tryParseVectorIndex` doesn't just work, please look how it handles the closing bracket.
It has now almost the same code as tryParseVectorIndex. 
But for tryParseZTOperand it creates an Imm
  Operands.push_back(AArch64Operand::CreateImm(
and for tryParseVectorIndex it creates a vector index:
   Operands.push_back(AArch64Operand::CreateVectorIndex(


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D136088/new/

https://reviews.llvm.org/D136088



More information about the llvm-commits mailing list