@@ -121,7 +121,7 @@ class RISCVAsmParser : public MCTargetAsmParser {
121121
122122 bool parseVTypeToken (const AsmToken &Tok, VTypeState &State, unsigned &Sew,
123123 unsigned &Lmul, bool &Fractional, bool &TailAgnostic,
124- bool &MaskAgnostic);
124+ bool &MaskAgnostic, bool &AltFmt );
125125 bool generateVTypeError (SMLoc ErrorLoc);
126126
127127 bool generateXSfmmVTypeError (SMLoc ErrorLoc);
@@ -2261,14 +2261,23 @@ ParseStatus RISCVAsmParser::parseJALOffset(OperandVector &Operands) {
22612261bool RISCVAsmParser::parseVTypeToken (const AsmToken &Tok, VTypeState &State,
22622262 unsigned &Sew, unsigned &Lmul,
22632263 bool &Fractional, bool &TailAgnostic,
2264- bool &MaskAgnostic) {
2264+ bool &MaskAgnostic, bool &AltFmt ) {
22652265 if (Tok.isNot (AsmToken::Identifier))
22662266 return true ;
22672267
22682268 StringRef Identifier = Tok.getIdentifier ();
22692269 if (State < VTypeState::SeenSew && Identifier.consume_front (" e" )) {
2270- if (Identifier.getAsInteger (10 , Sew))
2271- return true ;
2270+ if (Identifier.getAsInteger (10 , Sew)) {
2271+ if (Identifier == " 16alt" ) {
2272+ AltFmt = true ;
2273+ Sew = 16 ;
2274+ } else if (Identifier == " 8alt" ) {
2275+ AltFmt = true ;
2276+ Sew = 8 ;
2277+ } else {
2278+ return true ;
2279+ }
2280+ }
22722281 if (!RISCVVType::isValidSEW (Sew))
22732282 return true ;
22742283
@@ -2340,11 +2349,12 @@ ParseStatus RISCVAsmParser::parseVTypeI(OperandVector &Operands) {
23402349 bool Fractional = false ;
23412350 bool TailAgnostic = false ;
23422351 bool MaskAgnostic = false ;
2352+ bool AltFmt = false ;
23432353
23442354 VTypeState State = VTypeState::SeenNothingYet;
23452355 do {
23462356 if (parseVTypeToken (getTok (), State, Sew, Lmul, Fractional, TailAgnostic,
2347- MaskAgnostic)) {
2357+ MaskAgnostic, AltFmt )) {
23482358 // The first time, errors return NoMatch rather than Failure
23492359 if (State == VTypeState::SeenNothingYet)
23502360 return ParseStatus::NoMatch;
@@ -2370,12 +2380,17 @@ ParseStatus RISCVAsmParser::parseVTypeI(OperandVector &Operands) {
23702380 }
23712381
23722382 unsigned VTypeI =
2373- RISCVVType::encodeVTYPE (VLMUL, Sew, TailAgnostic, MaskAgnostic);
2383+ RISCVVType::encodeVTYPE (VLMUL, Sew, TailAgnostic, MaskAgnostic, AltFmt );
23742384 Operands.push_back (RISCVOperand::createVType (VTypeI, S));
23752385 return ParseStatus::Success;
23762386}
23772387
23782388bool RISCVAsmParser::generateVTypeError (SMLoc ErrorLoc) {
2389+ if (STI->hasFeature (RISCV::FeatureStdExtZvfbfa))
2390+ return Error (
2391+ ErrorLoc,
2392+ " operand must be "
2393+ " e[8|8alt|16|16alt|32|64],m[1|2|4|8|f2|f4|f8],[ta|tu],[ma|mu]" );
23792394 return Error (
23802395 ErrorLoc,
23812396 " operand must be "
0 commit comments