@@ -178,6 +178,10 @@ class AMDGPUOperand : public MCParsedAsmOperand {
178178 ImmTyBitOp3,
179179 ImmTyMatrixAFMT,
180180 ImmTyMatrixBFMT,
181+ ImmTyMatrixAScale,
182+ ImmTyMatrixBScale,
183+ ImmTyMatrixAScaleFmt,
184+ ImmTyMatrixBScaleFmt,
181185 ImmTyMatrixAReuse,
182186 ImmTyMatrixBReuse,
183187 ImmTyScaleSel,
@@ -428,6 +432,10 @@ class AMDGPUOperand : public MCParsedAsmOperand {
428432 bool isIndexKey32bit () const { return isImmTy (ImmTyIndexKey32bit); }
429433 bool isMatrixAFMT () const { return isImmTy (ImmTyMatrixAFMT); }
430434 bool isMatrixBFMT () const { return isImmTy (ImmTyMatrixBFMT); }
435+ bool isMatrixAScale () const { return isImmTy (ImmTyMatrixAScale); }
436+ bool isMatrixBScale () const { return isImmTy (ImmTyMatrixBScale); }
437+ bool isMatrixAScaleFmt () const { return isImmTy (ImmTyMatrixAScaleFmt); }
438+ bool isMatrixBScaleFmt () const { return isImmTy (ImmTyMatrixBScaleFmt); }
431439 bool isMatrixAReuse () const { return isImmTy (ImmTyMatrixAReuse); }
432440 bool isMatrixBReuse () const { return isImmTy (ImmTyMatrixBReuse); }
433441 bool isTFE () const { return isImmTy (ImmTyTFE); }
@@ -1183,6 +1191,10 @@ class AMDGPUOperand : public MCParsedAsmOperand {
11831191 case ImmTyBitOp3: OS << " BitOp3" ; break ;
11841192 case ImmTyMatrixAFMT: OS << " ImmTyMatrixAFMT" ; break ;
11851193 case ImmTyMatrixBFMT: OS << " ImmTyMatrixBFMT" ; break ;
1194+ case ImmTyMatrixAScale: OS << " ImmTyMatrixAScale" ; break ;
1195+ case ImmTyMatrixBScale: OS << " ImmTyMatrixBScale" ; break ;
1196+ case ImmTyMatrixAScaleFmt: OS << " ImmTyMatrixAScaleFmt" ; break ;
1197+ case ImmTyMatrixBScaleFmt: OS << " ImmTyMatrixBScaleFmt" ; break ;
11861198 case ImmTyMatrixAReuse: OS << " ImmTyMatrixAReuse" ; break ;
11871199 case ImmTyMatrixBReuse: OS << " ImmTyMatrixBReuse" ; break ;
11881200 case ImmTyScaleSel: OS << " ScaleSel" ; break ;
@@ -1728,6 +1740,14 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
17281740 AMDGPUOperand::ImmTy Type);
17291741 ParseStatus parseMatrixAFMT (OperandVector &Operands);
17301742 ParseStatus parseMatrixBFMT (OperandVector &Operands);
1743+ ParseStatus tryParseMatrixScale (OperandVector &Operands, StringRef Name,
1744+ AMDGPUOperand::ImmTy Type);
1745+ ParseStatus parseMatrixAScale (OperandVector &Operands);
1746+ ParseStatus parseMatrixBScale (OperandVector &Operands);
1747+ ParseStatus tryParseMatrixScaleFmt (OperandVector &Operands, StringRef Name,
1748+ AMDGPUOperand::ImmTy Type);
1749+ ParseStatus parseMatrixAScaleFmt (OperandVector &Operands);
1750+ ParseStatus parseMatrixBScaleFmt (OperandVector &Operands);
17311751
17321752 ParseStatus parseDfmtNfmt (int64_t &Format);
17331753 ParseStatus parseUfmt (int64_t &Format);
@@ -7356,6 +7376,42 @@ ParseStatus AMDGPUAsmParser::parseMatrixBFMT(OperandVector &Operands) {
73567376 AMDGPUOperand::ImmTyMatrixBFMT);
73577377}
73587378
7379+ ParseStatus AMDGPUAsmParser::tryParseMatrixScale (OperandVector &Operands,
7380+ StringRef Name,
7381+ AMDGPUOperand::ImmTy Type) {
7382+ return parseStringOrIntWithPrefix (
7383+ Operands, Name, {" MATRIX_SCALE_ROW0" , " MATRIX_SCALE_ROW1" }, Type);
7384+ }
7385+
7386+ ParseStatus AMDGPUAsmParser::parseMatrixAScale (OperandVector &Operands) {
7387+ return tryParseMatrixScale (Operands, " matrix_a_scale" ,
7388+ AMDGPUOperand::ImmTyMatrixAScale);
7389+ }
7390+
7391+ ParseStatus AMDGPUAsmParser::parseMatrixBScale (OperandVector &Operands) {
7392+ return tryParseMatrixScale (Operands, " matrix_b_scale" ,
7393+ AMDGPUOperand::ImmTyMatrixBScale);
7394+ }
7395+
7396+ ParseStatus AMDGPUAsmParser::tryParseMatrixScaleFmt (OperandVector &Operands,
7397+ StringRef Name,
7398+ AMDGPUOperand::ImmTy Type) {
7399+ return parseStringOrIntWithPrefix (
7400+ Operands, Name,
7401+ {" MATRIX_SCALE_FMT_E8" , " MATRIX_SCALE_FMT_E5M3" , " MATRIX_SCALE_FMT_E4M3" },
7402+ Type);
7403+ }
7404+
7405+ ParseStatus AMDGPUAsmParser::parseMatrixAScaleFmt (OperandVector &Operands) {
7406+ return tryParseMatrixScaleFmt (Operands, " matrix_a_scale_fmt" ,
7407+ AMDGPUOperand::ImmTyMatrixAScaleFmt);
7408+ }
7409+
7410+ ParseStatus AMDGPUAsmParser::parseMatrixBScaleFmt (OperandVector &Operands) {
7411+ return tryParseMatrixScaleFmt (Operands, " matrix_b_scale_fmt" ,
7412+ AMDGPUOperand::ImmTyMatrixBScaleFmt);
7413+ }
7414+
73597415// dfmt and nfmt (in a tbuffer instruction) are parsed as one to allow their
73607416// values to live in a joint format operand in the MCInst encoding.
73617417ParseStatus AMDGPUAsmParser::parseDfmtNfmt (int64_t &Format) {
@@ -9489,6 +9545,34 @@ void AMDGPUAsmParser::cvtVOP3P(MCInst &Inst, const OperandVector &Operands,
94899545 AMDGPUOperand::ImmTyMatrixBFMT, 0 );
94909546 }
94919547
9548+ int MatrixAScaleIdx =
9549+ AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::matrix_a_scale);
9550+ if (MatrixAScaleIdx != -1 ) {
9551+ addOptionalImmOperand (Inst, Operands, OptIdx,
9552+ AMDGPUOperand::ImmTyMatrixAScale, 0 );
9553+ }
9554+
9555+ int MatrixBScaleIdx =
9556+ AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::matrix_b_scale);
9557+ if (MatrixBScaleIdx != -1 ) {
9558+ addOptionalImmOperand (Inst, Operands, OptIdx,
9559+ AMDGPUOperand::ImmTyMatrixBScale, 0 );
9560+ }
9561+
9562+ int MatrixAScaleFmtIdx =
9563+ AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::matrix_a_scale_fmt);
9564+ if (MatrixAScaleFmtIdx != -1 ) {
9565+ addOptionalImmOperand (Inst, Operands, OptIdx,
9566+ AMDGPUOperand::ImmTyMatrixAScaleFmt, 0 );
9567+ }
9568+
9569+ int MatrixBScaleFmtIdx =
9570+ AMDGPU::getNamedOperandIdx (Opc, AMDGPU::OpName::matrix_b_scale_fmt);
9571+ if (MatrixBScaleFmtIdx != -1 ) {
9572+ addOptionalImmOperand (Inst, Operands, OptIdx,
9573+ AMDGPUOperand::ImmTyMatrixBScaleFmt, 0 );
9574+ }
9575+
94929576 if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::matrix_a_reuse))
94939577 addOptionalImmOperand (Inst, Operands, OptIdx,
94949578 AMDGPUOperand::ImmTyMatrixAReuse, 0 );
0 commit comments