@@ -130,26 +130,57 @@ DecodeMatrixTileListRegisterClass(MCInst &Inst, unsigned RegMask,
130130 return Success;
131131}
132132
133- static const MCPhysReg MatrixZATileDecoderTable[5 ][16 ] = {
134- {AArch64::ZAB0},
135- {AArch64::ZAH0, AArch64::ZAH1},
136- {AArch64::ZAS0, AArch64::ZAS1, AArch64::ZAS2, AArch64::ZAS3},
137- {AArch64::ZAD0, AArch64::ZAD1, AArch64::ZAD2, AArch64::ZAD3, AArch64::ZAD4,
138- AArch64::ZAD5, AArch64::ZAD6, AArch64::ZAD7},
139- {AArch64::ZAQ0, AArch64::ZAQ1, AArch64::ZAQ2, AArch64::ZAQ3, AArch64::ZAQ4,
140- AArch64::ZAQ5, AArch64::ZAQ6, AArch64::ZAQ7, AArch64::ZAQ8, AArch64::ZAQ9,
141- AArch64::ZAQ10, AArch64::ZAQ11, AArch64::ZAQ12, AArch64::ZAQ13,
142- AArch64::ZAQ14, AArch64::ZAQ15}};
143-
144- template <unsigned NumBitsForTile>
145- static DecodeStatus DecodeMatrixTile (MCInst &Inst, unsigned RegNo,
146- uint64_t Address,
147- const MCDisassembler *Decoder) {
148- unsigned LastReg = (1 << NumBitsForTile) - 1 ;
149- if (RegNo > LastReg)
150- return Fail;
151- Inst.addOperand (
152- MCOperand::createReg (MatrixZATileDecoderTable[NumBitsForTile][RegNo]));
133+ static DecodeStatus DecodeZTRRegisterClass (MCInst &Inst,
134+ const MCDisassembler *Decoder) {
135+ Inst.addOperand (MCOperand::createReg (AArch64::ZT0));
136+ return Success;
137+ }
138+
139+ static DecodeStatus DecodeMPRRegisterClass (MCInst &Inst,
140+ const MCDisassembler *Decoder) {
141+ Inst.addOperand (MCOperand::createReg (AArch64::ZA));
142+ return Success;
143+ }
144+
145+ static DecodeStatus DecodeMPR8RegisterClass (MCInst &Inst,
146+ const MCDisassembler *Decoder) {
147+ Inst.addOperand (MCOperand::createReg (AArch64::ZAB0));
148+ return Success;
149+ }
150+
151+ static DecodeStatus DecodeMPR16RegisterClass (MCInst &Inst, unsigned RegNo,
152+ uint64_t Address,
153+ const MCDisassembler *Decoder) {
154+ MCRegister Reg =
155+ AArch64MCRegisterClasses[AArch64::MPR16RegClassID].getRegister (RegNo);
156+ Inst.addOperand (MCOperand::createReg (Reg));
157+ return Success;
158+ }
159+
160+ static DecodeStatus DecodeMPR32RegisterClass (MCInst &Inst, unsigned RegNo,
161+ uint64_t Address,
162+ const MCDisassembler *Decoder) {
163+ MCRegister Reg =
164+ AArch64MCRegisterClasses[AArch64::MPR32RegClassID].getRegister (RegNo);
165+ Inst.addOperand (MCOperand::createReg (Reg));
166+ return Success;
167+ }
168+
169+ static DecodeStatus DecodeMPR64RegisterClass (MCInst &Inst, unsigned RegNo,
170+ uint64_t Address,
171+ const MCDisassembler *Decoder) {
172+ MCRegister Reg =
173+ AArch64MCRegisterClasses[AArch64::MPR64RegClassID].getRegister (RegNo);
174+ Inst.addOperand (MCOperand::createReg (Reg));
175+ return Success;
176+ }
177+
178+ static DecodeStatus DecodeMPR128RegisterClass (MCInst &Inst, unsigned RegNo,
179+ uint64_t Address,
180+ const MCDisassembler *Decoder) {
181+ MCRegister Reg =
182+ AArch64MCRegisterClasses[AArch64::MPR128RegClassID].getRegister (RegNo);
183+ Inst.addOperand (MCOperand::createReg (Reg));
153184 return Success;
154185}
155186
@@ -1392,6 +1423,11 @@ DecodeSVELogicalImmInstruction(MCInst &Inst, uint32_t insn, uint64_t Addr,
13921423 return Success;
13931424}
13941425
1426+ static DecodeStatus DecodeZeroImm (MCInst &Inst, const MCDisassembler *Decoder) {
1427+ Inst.addOperand (MCOperand::createImm (0 ));
1428+ return Success;
1429+ }
1430+
13951431template <int Bits>
13961432static DecodeStatus DecodeSImm (MCInst &Inst, uint64_t Imm, uint64_t Address,
13971433 const MCDisassembler *Decoder) {
@@ -1540,6 +1576,7 @@ DecodeSMESpillFillInstruction(MCInst &Inst, uint32_t Bits, uint64_t Addr,
15401576 unsigned RnBits = fieldFromInstruction (Bits, 5 , 5 );
15411577 unsigned Imm4Bits = fieldFromInstruction (Bits, 0 , 4 );
15421578
1579+ DecodeMPRRegisterClass (Inst, Decoder);
15431580 DecodeSimpleRegisterClass<AArch64::MatrixIndexGPR32_12_15RegClassID, 0 , 4 >(
15441581 Inst, RvBits, Addr, Decoder);
15451582 Inst.addOperand (MCOperand::createImm (Imm4Bits));
@@ -1583,33 +1620,6 @@ DecodeStatus AArch64Disassembler::getInstruction(MCInst &MI, uint64_t &Size,
15831620 for (const auto *Table : Tables) {
15841621 DecodeStatus Result =
15851622 decodeInstruction (Table, MI, Insn, Address, this , STI);
1586-
1587- const MCInstrDesc &Desc = MCII->get (MI.getOpcode ());
1588-
1589- // For Scalable Matrix Extension (SME) instructions that have an implicit
1590- // operand for the accumulator (ZA) or implicit immediate zero which isn't
1591- // encoded, manually insert operand.
1592- for (unsigned i = 0 ; i < Desc.getNumOperands (); i++) {
1593- if (Desc.operands ()[i].OperandType == MCOI::OPERAND_REGISTER) {
1594- switch (Desc.operands ()[i].RegClass ) {
1595- default :
1596- break ;
1597- case AArch64::MPRRegClassID:
1598- MI.insert (MI.begin () + i, MCOperand::createReg (AArch64::ZA));
1599- break ;
1600- case AArch64::MPR8RegClassID:
1601- MI.insert (MI.begin () + i, MCOperand::createReg (AArch64::ZAB0));
1602- break ;
1603- case AArch64::ZTRRegClassID:
1604- MI.insert (MI.begin () + i, MCOperand::createReg (AArch64::ZT0));
1605- break ;
1606- }
1607- } else if (Desc.operands ()[i].OperandType ==
1608- AArch64::OPERAND_IMPLICIT_IMM_0) {
1609- MI.insert (MI.begin () + i, MCOperand::createImm (0 ));
1610- }
1611- }
1612-
16131623 if (Result != MCDisassembler::Fail)
16141624 return Result;
16151625 }
0 commit comments