[llvm] [RISCV][AsmParser] Allow parsing vsetvl omitting LMUL parameter (PR #115277)

Aleksei Romanov via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 7 01:01:35 PST 2024


================
@@ -2222,8 +2222,14 @@ bool RISCVAsmParser::parseVTypeToken(const AsmToken &Tok, VTypeState &State,
     State = VTypeState_LMUL;
     return false;
   case VTypeState_LMUL: {
-    if (!Identifier.consume_front("m"))
-      break;
+    // Set LMUL to default if it is omitted.
+    if (!Identifier.consume_front("m")) {
+      Lmul = 1;
+      Fractional = false;
+      State = VTypeState_TailPolicy;
+      return parseVTypeToken(Tok, State, Sew, Lmul, Fractional, TailAgnostic,
----------------
saveasguy wrote:

Not really, if we return false, Lexer will consume next tokens ("comma" and "mask policy" in this case). This is why I change state to TailPolicy and then call parseVTypeToken with the current token to parse tail policy instead of LMUL.

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


More information about the llvm-commits mailing list