[clang] [llvm] [RISCV] Add MC layer support for XSfmm*. (PR #133031)
Craig Topper via cfe-commits
cfe-commits at lists.llvm.org
Tue May 20 10:07:01 PDT 2025
================
@@ -2331,6 +2337,65 @@ bool RISCVAsmParser::generateVTypeError(SMLoc ErrorLoc) {
"e[8|16|32|64],m[1|2|4|8|f2|f4|f8],[ta|tu],[ma|mu]");
}
+ParseStatus RISCVAsmParser::parseXSfmmVType(OperandVector &Operands) {
+ SMLoc S = getLoc();
+
+ unsigned Widen = 0;
+ unsigned SEW = 0;
+ bool AltFmt = false;
+ StringRef Identifier;
+
+ if (getTok().isNot(AsmToken::Identifier))
+ goto Fail;
+
+ Identifier = getTok().getIdentifier();
+
+ if (!Identifier.consume_front("e"))
+ goto Fail;
+
+ if (Identifier.getAsInteger(10, SEW)) {
+ if (Identifier != "16alt")
+ goto Fail;
+
+ AltFmt = true;
+ SEW = 16;
+ }
+ if (!RISCVVType::isValidSEW(SEW))
+ goto Fail;
+
+ Lex();
+
+ if (!parseOptionalToken(AsmToken::Comma))
+ goto Fail;
+
+ if (getTok().isNot(AsmToken::Identifier))
+ goto Fail;
+
+ Identifier = getTok().getIdentifier();
+
+ if (!Identifier.consume_front("w"))
+ goto Fail;
+ if (Identifier.getAsInteger(10, Widen))
+ goto Fail;
+ if (Widen != 1 && Widen != 2 && Widen != 4)
+ goto Fail;
+
+ Lex();
+
+ if (getLexer().is(AsmToken::EndOfStatement)) {
----------------
topperc wrote:
I believe this check was trying to make sure there aren't additional operands left for this instruction. We're parsing multiple comma separated identifiers here as a single custom operand. Looks like we are missing a test for that.
https://github.com/llvm/llvm-project/pull/133031
More information about the cfe-commits
mailing list