[llvm] [ARM][TableGen][MC] Change the ARM mnemonic operands to be optional for ASM parsing (PR #83436)

Alfie Richards via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 02:05:09 PST 2024


================
@@ -10984,6 +11087,12 @@ unsigned ARMAsmParser::checkTargetMatchPredicate(MCInst &Inst) {
     if (!hasV8Ops() && (Inst.getOperand(0).getReg() == ARM::SP))
       return Match_RequiresV8;
     break;
+  case ARM::tMUL:
+    // The second source operand must be the same register as the destination
+    // operand.
+    if (Inst.getOperand(0).getReg() != Inst.getOperand(3).getReg())
+      return Match_RequiresDestinationRegisterMatchASourceRegister;
----------------
AlfieRichardsArm wrote:

There's weirdness in this case. I can't quite remember why. I think because of `cvtThumbMultiply` being the custom match class that tries to swap `Rn` and `Rm` if needed to get them to match the normal method for this check doesn't work? 

Without this the matching of `muls r1, r2, r3` hits the error at llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp:8036 when validating the narrow version so doesn't attempt to match the wide version. 

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


More information about the llvm-commits mailing list