[PATCH] D132819: [RISCV] Add MC support of RISCV zcmp Extension

Craig Topper via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 26 10:09:10 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:1473
+        ErrorLoc,
+        "operand must like {ra [, s0[-sN]]} or {x1 [, x8[-x9][, x18[-xN]]]}");
+  }
----------------
like -> be

```
"operand must be '{ra [, s0[-sN]]}' or '{x1 [, x8[-x9][, x18[-xN]]]}'"
```


================
Comment at: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:2373
+      if (RegEnd != RISCV::X9)
+        return MatchOperand_ParseFail;
+
----------------
Need to call Error before returning ParseFail


================
Comment at: llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp:2443
+    if (Operands[1]->getReg() == RegNo) {
+      Error(getLoc(), "'rs1' and 'rs2' mast be different");
+      return MatchOperand_ParseFail;
----------------
You can check this in `validateInstruction` instead of during parsing. Then you don't need a custom parser.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D132819



More information about the cfe-commits mailing list