[llvm] [RISCV] Report "too many operands" for surplus operands in AsmParser (PR #207142)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 02:03:57 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-risc-v

Author: Mark Zhuang (zqb-all)

<details>
<summary>Changes</summary>

This improves upon the shared near-miss reporting infrastructure added in #<!-- -->205721 by handling a case that was deferred during that PR's review.

Assisted-by: claude-opus

---

Patch is 114.37 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/207142.diff


35 Files Affected:

- (modified) llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp (+15) 
- (modified) llvm/test/MC/RISCV/corev/XCValu-invalid.s (+31-31) 
- (modified) llvm/test/MC/RISCV/corev/XCVbitmanip-invalid.s (+8-8) 
- (modified) llvm/test/MC/RISCV/corev/XCVmac-invalid.s (+22-22) 
- (modified) llvm/test/MC/RISCV/corev/XCVmem-invalid.s (+5-5) 
- (modified) llvm/test/MC/RISCV/corev/XCVsimd-invalid.s (+158-158) 
- (modified) llvm/test/MC/RISCV/insn-invalid.s (+2-2) 
- (modified) llvm/test/MC/RISCV/insn_c-invalid.s (+2-2) 
- (modified) llvm/test/MC/RISCV/insn_xqci-invalid.s (+6-6) 
- (modified) llvm/test/MC/RISCV/priv-invalid.s (+10-13) 
- (modified) llvm/test/MC/RISCV/rv32c-invalid.s (+2-2) 
- (modified) llvm/test/MC/RISCV/rv32i-invalid.s (+4-4) 
- (modified) llvm/test/MC/RISCV/rv32zalrsc-invalid.s (+1-1) 
- (modified) llvm/test/MC/RISCV/rv32zbb-invalid.s (+5-5) 
- (modified) llvm/test/MC/RISCV/rv32zcmop-invalid.s (+2-2) 
- (modified) llvm/test/MC/RISCV/rv64zalrsc-invalid.s (+1-1) 
- (modified) llvm/test/MC/RISCV/rv64zbb-invalid.s (+3-3) 
- (modified) llvm/test/MC/RISCV/rvc-hints-invalid.s (+1-1) 
- (modified) llvm/test/MC/RISCV/rvv/zvvfmm-invalid.s (+5-5) 
- (modified) llvm/test/MC/RISCV/rvv/zvvmm-invalid.s (+4-4) 
- (modified) llvm/test/MC/RISCV/rvv/zvvmtls-invalid.s (+2-2) 
- (modified) llvm/test/MC/RISCV/rvv/zvvmttls-invalid.s (+2-2) 
- (modified) llvm/test/MC/RISCV/rvzicond-invalid.s (+2-2) 
- (modified) llvm/test/MC/RISCV/rvzihintntl-invalid.s (+8-8) 
- (modified) llvm/test/MC/RISCV/rvzihintntlc-invalid.s (+8-8) 
- (modified) llvm/test/MC/RISCV/smrnmi-invalid.s (+1-1) 
- (modified) llvm/test/MC/RISCV/tlsdesc.s (+4-4) 
- (modified) llvm/test/MC/RISCV/xmips-invalid.s (+3-3) 
- (modified) llvm/test/MC/RISCV/xqci-access-pseudos.s (+15-15) 
- (modified) llvm/test/MC/RISCV/xqciint-invalid.s (+9-9) 
- (modified) llvm/test/MC/RISCV/xqcisim-invalid.s (+13-13) 
- (modified) llvm/test/MC/RISCV/xqcisync-invalid.s (+9-9) 
- (modified) llvm/test/MC/RISCV/xtheadcmo-invalid.s (+8-8) 
- (modified) llvm/test/MC/RISCV/xtheadcondmov-invalid.s (+2-2) 
- (modified) llvm/test/MC/RISCV/xtheadsync-invalid.s (+4-4) 


``````````diff
diff --git a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
index 605a155f20e71..48876dc81bd1f 100644
--- a/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
+++ b/llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp
@@ -1705,10 +1705,25 @@ void RISCVAsmParser::FilterNearMisses(
   std::multimap<unsigned, unsigned> OperandMissesSeen;
   SmallSet<FeatureBitset, 4> FeatureMissesSeen;
   bool ReportedTooFewOperands = false;
+  bool ReportedTooManyOperands = false;
 
   for (NearMissInfo &I : NearMissesIn) {
     switch (I.getKind()) {
     case NearMissInfo::NearMissOperand: {
+      // When the matcher finds surplus operands, it records them as
+      // NearMissOperand with InvalidMatchClass. We detect this and report
+      // "too many operands" instead of "invalid operand".
+      if (I.getOperandClass() == InvalidMatchClass) {
+        if (!ReportedTooManyOperands) {
+          SMLoc OperandLoc =
+              ((RISCVOperand &)*Operands[I.getOperandIndex()]).getStartLoc();
+          NearMissesOut.emplace_back(
+              NearMissMessage{OperandLoc, "too many operands for instruction"});
+          ReportedTooManyOperands = true;
+        }
+        break;
+      }
+
       SMLoc OperandLoc =
           ((RISCVOperand &)*Operands[I.getOperandIndex()]).getStartLoc();
       std::string OperandDiag = getCustomOperandDiag(I.getOperandError());
diff --git a/llvm/test/MC/RISCV/corev/XCValu-invalid.s b/llvm/test/MC/RISCV/corev/XCValu-invalid.s
index 550d79c44f6b8..febb363cf9580 100644
--- a/llvm/test/MC/RISCV/corev/XCValu-invalid.s
+++ b/llvm/test/MC/RISCV/corev/XCValu-invalid.s
@@ -14,7 +14,7 @@ cv.addrnr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.addrnr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.addun t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -38,7 +38,7 @@ cv.addun t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.addun t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.extbz t0, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -50,7 +50,7 @@ cv.extbz t0
 # CHECK-ERROR: too few operands for instruction
 
 cv.extbz t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.addnr t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -65,7 +65,7 @@ cv.addnr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.addnr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.clipu t0, t1, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -86,7 +86,7 @@ cv.clipu t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.clipu t0, t1, 0, 0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.minu t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -101,7 +101,7 @@ cv.minu t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.minu t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.abs t0, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -113,7 +113,7 @@ cv.abs t0
 # CHECK-ERROR: too few operands for instruction
 
 cv.abs t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.addrn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -137,7 +137,7 @@ cv.addrn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.addrn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.suburn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -161,7 +161,7 @@ cv.suburn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.suburn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.clip t0, t1, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -182,7 +182,7 @@ cv.clip t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.clip t0, t1, 0, 0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.addunr t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -197,7 +197,7 @@ cv.addunr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.addunr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.addurn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -221,7 +221,7 @@ cv.addurn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.addurn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.subun t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -245,7 +245,7 @@ cv.subun t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.subun t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.subn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -269,7 +269,7 @@ cv.subn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.subn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.subrnr t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -284,7 +284,7 @@ cv.subrnr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.subrnr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.slet t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -299,7 +299,7 @@ cv.slet t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.slet t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.suburnr t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -314,7 +314,7 @@ cv.suburnr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.suburnr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.maxu t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -329,7 +329,7 @@ cv.maxu t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.maxu t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.extbs t0, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -341,7 +341,7 @@ cv.extbs t0
 # CHECK-ERROR: too few operands for instruction
 
 cv.extbs t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.exths t0, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -353,7 +353,7 @@ cv.exths t0
 # CHECK-ERROR: too few operands for instruction
 
 cv.exths t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.max t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -368,7 +368,7 @@ cv.max t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.max t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.subunr t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -383,7 +383,7 @@ cv.subunr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.subunr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.exthz t0, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -395,7 +395,7 @@ cv.exthz t0
 # CHECK-ERROR: too few operands for instruction
 
 cv.exthz t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.clipur t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -410,7 +410,7 @@ cv.clipur t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.clipur t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.addurnr t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -425,7 +425,7 @@ cv.addurnr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.addurnr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.addn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -449,7 +449,7 @@ cv.addn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.addn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.subrn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -473,7 +473,7 @@ cv.subrn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.subrn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.subnr t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -488,7 +488,7 @@ cv.subnr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.subnr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.clipr t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -503,7 +503,7 @@ cv.clipr t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.clipr t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.sletu t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -518,7 +518,7 @@ cv.sletu t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.sletu t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.min t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -533,4 +533,4 @@ cv.min t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.min t0, t1, t2, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
diff --git a/llvm/test/MC/RISCV/corev/XCVbitmanip-invalid.s b/llvm/test/MC/RISCV/corev/XCVbitmanip-invalid.s
index 684b3f220a994..2470c2b4cc767 100644
--- a/llvm/test/MC/RISCV/corev/XCVbitmanip-invalid.s
+++ b/llvm/test/MC/RISCV/corev/XCVbitmanip-invalid.s
@@ -224,10 +224,10 @@ cv.ff1 t0, 0
 # CHECK-ERROR: invalid operand for instruction
 
 cv.ff1 t0, t1, 0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.ff1 t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction 
+# CHECK-ERROR: too many operands for instruction
 
 cv.fl1 t0
 # CHECK-ERROR: too few operands for instruction
@@ -236,10 +236,10 @@ cv.fl1 t0, 0
 # CHECK-ERROR: invalid operand for instruction
 
 cv.fl1 t0, t1, 0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.fl1 t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction 
+# CHECK-ERROR: too many operands for instruction
 
 cv.clb t0
 # CHECK-ERROR: too few operands for instruction
@@ -248,10 +248,10 @@ cv.clb t0, 0
 # CHECK-ERROR: invalid operand for instruction
 
 cv.clb t0, t1, 0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.clb t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction 
+# CHECK-ERROR: too many operands for instruction
 
 cv.cnt t0
 # CHECK-ERROR: too few operands for instruction
@@ -260,8 +260,8 @@ cv.cnt t0, 0
 # CHECK-ERROR: invalid operand for instruction
 
 cv.cnt t0, t1, 0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.cnt t0, t1, t2
-# CHECK-ERROR: invalid operand for instruction 
+# CHECK-ERROR: too many operands for instruction
 
diff --git a/llvm/test/MC/RISCV/corev/XCVmac-invalid.s b/llvm/test/MC/RISCV/corev/XCVmac-invalid.s
index e1a102cd8405a..6b8779b75eeab 100644
--- a/llvm/test/MC/RISCV/corev/XCVmac-invalid.s
+++ b/llvm/test/MC/RISCV/corev/XCVmac-invalid.s
@@ -14,7 +14,7 @@ cv.mac t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.mac t0, t1, t2, t4
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.machhsn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -38,7 +38,7 @@ cv.machhsn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.machhsn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.machhsrn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -62,7 +62,7 @@ cv.machhsrn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.machhsrn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.machhun t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -86,7 +86,7 @@ cv.machhun t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.machhun t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.machhurn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -110,7 +110,7 @@ cv.machhurn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.machhurn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.macsn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -134,7 +134,7 @@ cv.macsn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.macsn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.macsrn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -158,7 +158,7 @@ cv.macsrn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.macsrn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.macun t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -182,7 +182,7 @@ cv.macun t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.macun t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.macurn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -206,7 +206,7 @@ cv.macurn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.macurn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.msu t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -221,7 +221,7 @@ cv.msu t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.msu t0, t1, t2, t4
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulhhs t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -236,7 +236,7 @@ cv.mulhhs t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulhhs t0, t1, t2, t4
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulhhsn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -260,7 +260,7 @@ cv.mulhhsn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulhhsn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulhhsrn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -284,7 +284,7 @@ cv.mulhhsrn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulhhsrn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulhhu t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -299,7 +299,7 @@ cv.mulhhu t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulhhu t0, t1, t2, t4
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulhhun t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -323,7 +323,7 @@ cv.mulhhun t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulhhun t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulhhurn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -347,7 +347,7 @@ cv.mulhhurn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulhhurn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.muls t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -362,7 +362,7 @@ cv.muls t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.muls t0, t1, t2, t4
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulsn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -386,7 +386,7 @@ cv.mulsn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulsn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulsrn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -410,7 +410,7 @@ cv.mulsrn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulsrn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulu t0, t1, 0
 # CHECK-ERROR: invalid operand for instruction
@@ -425,7 +425,7 @@ cv.mulu t0, t1
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulu t0, t1, t2, t4
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulun t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -449,7 +449,7 @@ cv.mulun t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulun t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
 
 cv.mulurn t0, t1, t2, -1
 # CHECK-ERROR: immediate must be an integer in the range [0, 31]
@@ -473,4 +473,4 @@ cv.mulurn t0, t1, t2
 # CHECK-ERROR: too few operands for instruction
 
 cv.mulurn t0, t1, t2, 0, a0
-# CHECK-ERROR: invalid operand for instruction
+# CHECK-ERROR: too many operands for instruction
diff --git a/llvm/test/MC/RISCV/corev/XCVmem-invalid.s b/llvm/test/MC/RISCV/corev/XCVmem-invalid.s
index cbec2f406acc0..adb8b6d98ad8c 100644
--- a/llvm/test/MC/RISCV/corev/XCVmem-invalid.s
+++ b/llvm/test/MC/RISCV/corev/XCVmem-invalid.s
@@ -33,7 +33,7 @@ cv.lb t0, (t2)
 # CHECK-ERROR: :[[@LINE-1]]:15: error: too few operands for instruction
 
 cv.lb t0, (t1), t2, t3
-# CHECK-ERROR: :[[@LINE-1]]:21: error: invalid operand for instruction
+# CHECK-ERROR: :[[@LINE-1]]:21: error: too many operands for instruction
 
 cv.lbu t0, (0), 0
 # CHECK-ERROR: :[[@LINE-1]]:12: error: invalid operand for instruction
@@ -67,7 +67,7 @@ cv.lbu t0, (t2)
 # CHECK-ERROR: :[[@LINE-1]]:16: error: too few operands for instruction
 
 cv.lbu t0, (t1), t2, t3 
-# CHECK-ERROR: :[[@LINE-1]]:22: error: invalid operand for instruction
+# CHECK-ERROR: :[[@LINE-1]]:22: error: too many operands for instruction
 
 cv.lh t0, (0), 0
 # CHECK-ERROR: :[[@LINE-1]]:11: error: invalid operand for instruction
@@ -104,7 +104,7 @@ cv.lh t0, (t1)
 # CHECK-ERROR: :[[@LINE-1]]:15: error: too few operands for instruction
 
 cv.lh t0, (t1), t2, t3
-# CHECK-ERROR: :[[@LINE-1]]:21: error: invalid operand for instruction
+# CHECK-ERROR: :[[@LINE-1]]:21: error: too many operands for instruction
 
 cv.lhu t0, (0), 0
 # CHECK-ERROR: :[[@LINE-1]]:12: error: invalid operand for instruction
@@ -141,7 +141,7 @@ cv.lhu t0, (t1)
 # CHECK-ERROR: :[[@LINE-1]]...
[truncated]

``````````

</details>


https://github.com/llvm/llvm-project/pull/207142


More information about the llvm-commits mailing list