@@ -178,6 +178,10 @@ class AMDGPUOperand : public MCParsedAsmOperand {
178
178
ImmTyBitOp3,
179
179
ImmTyMatrixAFMT,
180
180
ImmTyMatrixBFMT,
181
+ ImmTyMatrixAScale,
182
+ ImmTyMatrixBScale,
183
+ ImmTyMatrixAScaleFmt,
184
+ ImmTyMatrixBScaleFmt,
181
185
ImmTyMatrixAReuse,
182
186
ImmTyMatrixBReuse,
183
187
ImmTyScaleSel,
@@ -428,6 +432,10 @@ class AMDGPUOperand : public MCParsedAsmOperand {
428
432
bool isIndexKey32bit () const { return isImmTy (ImmTyIndexKey32bit); }
429
433
bool isMatrixAFMT () const { return isImmTy (ImmTyMatrixAFMT); }
430
434
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); }
431
439
bool isMatrixAReuse () const { return isImmTy (ImmTyMatrixAReuse); }
432
440
bool isMatrixBReuse () const { return isImmTy (ImmTyMatrixBReuse); }
433
441
bool isTFE () const { return isImmTy (ImmTyTFE); }
@@ -1183,6 +1191,10 @@ class AMDGPUOperand : public MCParsedAsmOperand {
1183
1191
case ImmTyBitOp3: OS << " BitOp3" ; break ;
1184
1192
case ImmTyMatrixAFMT: OS << " ImmTyMatrixAFMT" ; break ;
1185
1193
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 ;
1186
1198
case ImmTyMatrixAReuse: OS << " ImmTyMatrixAReuse" ; break ;
1187
1199
case ImmTyMatrixBReuse: OS << " ImmTyMatrixBReuse" ; break ;
1188
1200
case ImmTyScaleSel: OS << " ScaleSel" ; break ;
@@ -1728,6 +1740,14 @@ class AMDGPUAsmParser : public MCTargetAsmParser {
1728
1740
AMDGPUOperand::ImmTy Type);
1729
1741
ParseStatus parseMatrixAFMT (OperandVector &Operands);
1730
1742
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);
1731
1751
1732
1752
ParseStatus parseDfmtNfmt (int64_t &Format);
1733
1753
ParseStatus parseUfmt (int64_t &Format);
@@ -7356,6 +7376,42 @@ ParseStatus AMDGPUAsmParser::parseMatrixBFMT(OperandVector &Operands) {
7356
7376
AMDGPUOperand::ImmTyMatrixBFMT);
7357
7377
}
7358
7378
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
+
7359
7415
// dfmt and nfmt (in a tbuffer instruction) are parsed as one to allow their
7360
7416
// values to live in a joint format operand in the MCInst encoding.
7361
7417
ParseStatus AMDGPUAsmParser::parseDfmtNfmt (int64_t &Format) {
@@ -9489,6 +9545,34 @@ void AMDGPUAsmParser::cvtVOP3P(MCInst &Inst, const OperandVector &Operands,
9489
9545
AMDGPUOperand::ImmTyMatrixBFMT, 0 );
9490
9546
}
9491
9547
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
+
9492
9576
if (AMDGPU::hasNamedOperand (Opc, AMDGPU::OpName::matrix_a_reuse))
9493
9577
addOptionalImmOperand (Inst, Operands, OptIdx,
9494
9578
AMDGPUOperand::ImmTyMatrixAReuse, 0 );
0 commit comments