24 changes: 24 additions & 0 deletions llvm/lib/Target/AArch64/Disassembler/AArch64Disassembler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ static DecodeStatus DecodeDDDRegisterClass(MCInst &Inst, unsigned RegNo,
static DecodeStatus DecodeDDDDRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t Address,
const void *Decoder);
static DecodeStatus DecodeZPRRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t Address,
const void *Decode);

static DecodeStatus DecodeFixedPointScaleImm32(MCInst &Inst, unsigned Imm,
uint64_t Address,
Expand Down Expand Up @@ -436,6 +439,27 @@ static DecodeStatus DecodeGPR32spRegisterClass(MCInst &Inst, unsigned RegNo,
Inst.addOperand(MCOperand::createReg(Register));
return Success;
}
static const unsigned ZPRDecoderTable[] = {
AArch64::Z0, AArch64::Z1, AArch64::Z2, AArch64::Z3,
AArch64::Z4, AArch64::Z5, AArch64::Z6, AArch64::Z7,
AArch64::Z8, AArch64::Z9, AArch64::Z10, AArch64::Z11,
AArch64::Z12, AArch64::Z13, AArch64::Z14, AArch64::Z15,
AArch64::Z16, AArch64::Z17, AArch64::Z18, AArch64::Z19,
AArch64::Z20, AArch64::Z21, AArch64::Z22, AArch64::Z23,
AArch64::Z24, AArch64::Z25, AArch64::Z26, AArch64::Z27,
AArch64::Z28, AArch64::Z29, AArch64::Z30, AArch64::Z31
};

static DecodeStatus DecodeZPRRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t Address,
const void* Decoder) {
if (RegNo > 31)
return Fail;

unsigned Register = ZPRDecoderTable[RegNo];
Inst.addOperand(MCOperand::createReg(Register));
return Success;
}

static const unsigned VectorDecoderTable[] = {
AArch64::Q0, AArch64::Q1, AArch64::Q2, AArch64::Q3, AArch64::Q4,
Expand Down
20 changes: 20 additions & 0 deletions llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1340,3 +1340,23 @@ void AArch64InstPrinter::printComplexRotationOp(const MCInst *MI, unsigned OpNo,
O << "#" << (Val * Angle) + Remainder;
}

template <char suffix>
void AArch64InstPrinter::printSVERegOp(const MCInst *MI, unsigned OpNum,
const MCSubtargetInfo &STI,
raw_ostream &O) {
switch (suffix) {
case 0:
case 'b':
case 'h':
case 's':
case 'd':
case 'q':
break;
default: llvm_unreachable("Invalid kind specifier.");
}

unsigned Reg = MI->getOperand(OpNum).getReg();
O << getRegisterName(Reg);
if (suffix != 0)
O << '.' << suffix;
}
3 changes: 3 additions & 0 deletions llvm/lib/Target/AArch64/InstPrinter/AArch64InstPrinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ class AArch64InstPrinter : public MCInstPrinter {
void printGPRSeqPairsClassOperand(const MCInst *MI, unsigned OpNum,
const MCSubtargetInfo &STI,
raw_ostream &O);
template <char = 0>
void printSVERegOp(const MCInst *MI, unsigned OpNum,
const MCSubtargetInfo &STI, raw_ostream &O);
};

class AArch64AppleInstPrinter : public AArch64InstPrinter {
Expand Down