diff --git a/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp b/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp --- a/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp +++ b/llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp @@ -79,11 +79,16 @@ } static DecodeStatus decodeRegisterClass(MCInst &Inst, uint64_t RegNo, - const unsigned *Regs, unsigned Size) { + const unsigned *Regs, unsigned Size, + bool IsAddr = false) { assert(RegNo < Size && "Invalid register"); - RegNo = Regs[RegNo]; - if (RegNo == 0) - return MCDisassembler::Fail; + if (IsAddr && RegNo == 0) { + RegNo = SystemZ::NoRegister; + } else { + RegNo = Regs[RegNo]; + if (RegNo == 0) + return MCDisassembler::Fail; + } Inst.addOperand(MCOperand::createReg(RegNo)); return MCDisassembler::Success; } @@ -112,10 +117,16 @@ return decodeRegisterClass(Inst, RegNo, SystemZMC::GR128Regs, 16); } +static DecodeStatus +DecodeADDR32BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, + const MCDisassembler *Decoder) { + return decodeRegisterClass(Inst, RegNo, SystemZMC::GR32Regs, 16, true); +} + static DecodeStatus DecodeADDR64BitRegisterClass(MCInst &Inst, uint64_t RegNo, uint64_t Address, const MCDisassembler *Decoder) { - return decodeRegisterClass(Inst, RegNo, SystemZMC::GR64Regs, 16); + return decodeRegisterClass(Inst, RegNo, SystemZMC::GR64Regs, 16, true); } static DecodeStatus DecodeFP32BitRegisterClass(MCInst &Inst, uint64_t RegNo, @@ -242,12 +253,28 @@ return decodeSImmOperand<16>(Inst, Imm); } +static DecodeStatus decodeS20ImmOperand(MCInst &Inst, uint64_t Imm, + uint64_t Address, + const MCDisassembler *Decoder) { + return decodeSImmOperand<20>(Inst, Imm); +} + static DecodeStatus decodeS32ImmOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, const MCDisassembler *Decoder) { return decodeSImmOperand<32>(Inst, Imm); } +template +static DecodeStatus decodeLenOperand(MCInst &Inst, uint64_t Imm, + uint64_t Address, + const MCDisassembler *Decoder) { + if (!isUInt(Imm)) + return MCDisassembler::Fail; + Inst.addOperand(MCOperand::createImm(Imm + 1)); + return MCDisassembler::Success; +} + template static DecodeStatus decodePCDBLOperand(MCInst &Inst, uint64_t Imm, uint64_t Address, bool isBranch, @@ -292,158 +319,6 @@ return decodePCDBLOperand<32>(Inst, Imm, Address, false, Decoder); } -static DecodeStatus decodeBDAddr12Operand(MCInst &Inst, uint64_t Field, - const unsigned *Regs) { - uint64_t Base = Field >> 12; - uint64_t Disp = Field & 0xfff; - assert(Base < 16 && "Invalid BDAddr12"); - Inst.addOperand(MCOperand::createReg(Base == 0 ? 0 : Regs[Base])); - Inst.addOperand(MCOperand::createImm(Disp)); - return MCDisassembler::Success; -} - -static DecodeStatus decodeBDAddr20Operand(MCInst &Inst, uint64_t Field, - const unsigned *Regs) { - uint64_t Base = Field >> 20; - uint64_t Disp = ((Field << 12) & 0xff000) | ((Field >> 8) & 0xfff); - assert(Base < 16 && "Invalid BDAddr20"); - Inst.addOperand(MCOperand::createReg(Base == 0 ? 0 : Regs[Base])); - Inst.addOperand(MCOperand::createImm(SignExtend64<20>(Disp))); - return MCDisassembler::Success; -} - -static DecodeStatus decodeBDXAddr12Operand(MCInst &Inst, uint64_t Field, - const unsigned *Regs) { - uint64_t Index = Field >> 16; - uint64_t Base = (Field >> 12) & 0xf; - uint64_t Disp = Field & 0xfff; - assert(Index < 16 && "Invalid BDXAddr12"); - Inst.addOperand(MCOperand::createReg(Base == 0 ? 0 : Regs[Base])); - Inst.addOperand(MCOperand::createImm(Disp)); - Inst.addOperand(MCOperand::createReg(Index == 0 ? 0 : Regs[Index])); - return MCDisassembler::Success; -} - -static DecodeStatus decodeBDXAddr20Operand(MCInst &Inst, uint64_t Field, - const unsigned *Regs) { - uint64_t Index = Field >> 24; - uint64_t Base = (Field >> 20) & 0xf; - uint64_t Disp = ((Field & 0xfff00) >> 8) | ((Field & 0xff) << 12); - assert(Index < 16 && "Invalid BDXAddr20"); - Inst.addOperand(MCOperand::createReg(Base == 0 ? 0 : Regs[Base])); - Inst.addOperand(MCOperand::createImm(SignExtend64<20>(Disp))); - Inst.addOperand(MCOperand::createReg(Index == 0 ? 0 : Regs[Index])); - return MCDisassembler::Success; -} - -static DecodeStatus decodeBDLAddr12Len4Operand(MCInst &Inst, uint64_t Field, - const unsigned *Regs) { - uint64_t Length = Field >> 16; - uint64_t Base = (Field >> 12) & 0xf; - uint64_t Disp = Field & 0xfff; - assert(Length < 16 && "Invalid BDLAddr12Len4"); - Inst.addOperand(MCOperand::createReg(Base == 0 ? 0 : Regs[Base])); - Inst.addOperand(MCOperand::createImm(Disp)); - Inst.addOperand(MCOperand::createImm(Length + 1)); - return MCDisassembler::Success; -} - -static DecodeStatus decodeBDLAddr12Len8Operand(MCInst &Inst, uint64_t Field, - const unsigned *Regs) { - uint64_t Length = Field >> 16; - uint64_t Base = (Field >> 12) & 0xf; - uint64_t Disp = Field & 0xfff; - assert(Length < 256 && "Invalid BDLAddr12Len8"); - Inst.addOperand(MCOperand::createReg(Base == 0 ? 0 : Regs[Base])); - Inst.addOperand(MCOperand::createImm(Disp)); - Inst.addOperand(MCOperand::createImm(Length + 1)); - return MCDisassembler::Success; -} - -static DecodeStatus decodeBDRAddr12Operand(MCInst &Inst, uint64_t Field, - const unsigned *Regs) { - uint64_t Length = Field >> 16; - uint64_t Base = (Field >> 12) & 0xf; - uint64_t Disp = Field & 0xfff; - assert(Length < 16 && "Invalid BDRAddr12"); - Inst.addOperand(MCOperand::createReg(Base == 0 ? 0 : Regs[Base])); - Inst.addOperand(MCOperand::createImm(Disp)); - Inst.addOperand(MCOperand::createReg(Regs[Length])); - return MCDisassembler::Success; -} - -static DecodeStatus decodeBDVAddr12Operand(MCInst &Inst, uint64_t Field, - const unsigned *Regs) { - uint64_t Index = Field >> 16; - uint64_t Base = (Field >> 12) & 0xf; - uint64_t Disp = Field & 0xfff; - assert(Index < 32 && "Invalid BDVAddr12"); - Inst.addOperand(MCOperand::createReg(Base == 0 ? 0 : Regs[Base])); - Inst.addOperand(MCOperand::createImm(Disp)); - Inst.addOperand(MCOperand::createReg(SystemZMC::VR128Regs[Index])); - return MCDisassembler::Success; -} - -static DecodeStatus decodeBDAddr32Disp12Operand(MCInst &Inst, uint64_t Field, - uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDAddr12Operand(Inst, Field, SystemZMC::GR32Regs); -} - -static DecodeStatus decodeBDAddr32Disp20Operand(MCInst &Inst, uint64_t Field, - uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDAddr20Operand(Inst, Field, SystemZMC::GR32Regs); -} - -static DecodeStatus decodeBDAddr64Disp12Operand(MCInst &Inst, uint64_t Field, - uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDAddr12Operand(Inst, Field, SystemZMC::GR64Regs); -} - -static DecodeStatus decodeBDAddr64Disp20Operand(MCInst &Inst, uint64_t Field, - uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDAddr20Operand(Inst, Field, SystemZMC::GR64Regs); -} - -static DecodeStatus -decodeBDXAddr64Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDXAddr12Operand(Inst, Field, SystemZMC::GR64Regs); -} - -static DecodeStatus -decodeBDXAddr64Disp20Operand(MCInst &Inst, uint64_t Field, uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDXAddr20Operand(Inst, Field, SystemZMC::GR64Regs); -} - -static DecodeStatus -decodeBDLAddr64Disp12Len4Operand(MCInst &Inst, uint64_t Field, uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDLAddr12Len4Operand(Inst, Field, SystemZMC::GR64Regs); -} - -static DecodeStatus -decodeBDLAddr64Disp12Len8Operand(MCInst &Inst, uint64_t Field, uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDLAddr12Len8Operand(Inst, Field, SystemZMC::GR64Regs); -} - -static DecodeStatus -decodeBDRAddr64Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDRAddr12Operand(Inst, Field, SystemZMC::GR64Regs); -} - -static DecodeStatus -decodeBDVAddr64Disp12Operand(MCInst &Inst, uint64_t Field, uint64_t Address, - const MCDisassembler *Decoder) { - return decodeBDVAddr12Operand(Inst, Field, SystemZMC::GR64Regs); -} - #include "SystemZGenDisassemblerTables.inc" DecodeStatus SystemZDisassembler::getInstruction(MCInst &MI, uint64_t &Size, diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp --- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp +++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp @@ -73,30 +73,16 @@ // The index or length, if any, is encoded first, followed by the base, // followed by the displacement. In a 20-bit displacement, // the low 12 bits are encoded before the high 8 bits. - uint64_t getBDAddr12Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const; - uint64_t getBDAddr20Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const; - uint64_t getBDXAddr12Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const; - uint64_t getBDXAddr20Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const; - uint64_t getBDLAddr12Len4Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const; - uint64_t getBDLAddr12Len8Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const; - uint64_t getBDRAddr12Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const; - uint64_t getBDVAddr12Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const; + template + uint64_t getLenEncoding(const MCInst &MI, unsigned OpNum, + SmallVectorImpl &Fixups, + const MCSubtargetInfo &STI) const; + uint64_t getDisp12Encoding(const MCInst &MI, unsigned OpNum, + SmallVectorImpl &Fixups, + const MCSubtargetInfo &STI) const; + uint64_t getDisp20Encoding(const MCInst &MI, unsigned OpNum, + SmallVectorImpl &Fixups, + const MCSubtargetInfo &STI) const; // Operand OpNum of MI needs a PC-relative fixup of kind Kind at // Offset bytes from the start of MI. Add the fixup to Fixups @@ -201,91 +187,26 @@ llvm_unreachable("Unexpected operand type!"); } -uint64_t SystemZMCCodeEmitter:: -getBDAddr12Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const { - uint64_t Base = getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI); - uint64_t Disp = getDispOpValue(MI, OpNum + 1, Fixups, SystemZ::FK_390_12); - assert(isUInt<4>(Base) && isUInt<12>(Disp)); - return (Base << 12) | Disp; -} - -uint64_t SystemZMCCodeEmitter:: -getBDAddr20Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const { - uint64_t Base = getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI); - uint64_t Disp = getDispOpValue(MI, OpNum + 1, Fixups, SystemZ::FK_390_20); - assert(isUInt<4>(Base) && isInt<20>(Disp)); - return (Base << 20) | ((Disp & 0xfff) << 8) | ((Disp & 0xff000) >> 12); -} - -uint64_t SystemZMCCodeEmitter:: -getBDXAddr12Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const { - uint64_t Base = getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI); - uint64_t Disp = getDispOpValue(MI, OpNum + 1, Fixups, SystemZ::FK_390_12); - uint64_t Index = getMachineOpValue(MI, MI.getOperand(OpNum + 2), Fixups, STI); - assert(isUInt<4>(Base) && isUInt<12>(Disp) && isUInt<4>(Index)); - return (Index << 16) | (Base << 12) | Disp; -} - -uint64_t SystemZMCCodeEmitter:: -getBDXAddr20Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const { - uint64_t Base = getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI); - uint64_t Disp = getDispOpValue(MI, OpNum + 1, Fixups, SystemZ::FK_390_20); - uint64_t Index = getMachineOpValue(MI, MI.getOperand(OpNum + 2), Fixups, STI); - assert(isUInt<4>(Base) && isInt<20>(Disp) && isUInt<4>(Index)); - return (Index << 24) | (Base << 20) | ((Disp & 0xfff) << 8) - | ((Disp & 0xff000) >> 12); -} - -uint64_t SystemZMCCodeEmitter:: -getBDLAddr12Len4Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const { - uint64_t Base = getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI); - uint64_t Disp = getDispOpValue(MI, OpNum + 1, Fixups, SystemZ::FK_390_12); - uint64_t Len = getMachineOpValue(MI, MI.getOperand(OpNum + 2), Fixups, STI) - 1; - assert(isUInt<4>(Base) && isUInt<12>(Disp) && isUInt<4>(Len)); - return (Len << 16) | (Base << 12) | Disp; -} - -uint64_t SystemZMCCodeEmitter:: -getBDLAddr12Len8Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const { - uint64_t Base = getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI); - uint64_t Disp = getDispOpValue(MI, OpNum + 1, Fixups, SystemZ::FK_390_12); - uint64_t Len = getMachineOpValue(MI, MI.getOperand(OpNum + 2), Fixups, STI) - 1; - assert(isUInt<4>(Base) && isUInt<12>(Disp) && isUInt<8>(Len)); - return (Len << 16) | (Base << 12) | Disp; +template +uint64_t +SystemZMCCodeEmitter::getLenEncoding(const MCInst &MI, unsigned OpNum, + SmallVectorImpl &Fixups, + const MCSubtargetInfo &STI) const { + return getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI) - 1; } -uint64_t SystemZMCCodeEmitter:: -getBDRAddr12Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const { - uint64_t Base = getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI); - uint64_t Disp = getDispOpValue(MI, OpNum + 1, Fixups, SystemZ::FK_390_12); - uint64_t Len = getMachineOpValue(MI, MI.getOperand(OpNum + 2), Fixups, STI); - assert(isUInt<4>(Base) && isUInt<12>(Disp) && isUInt<4>(Len)); - return (Len << 16) | (Base << 12) | Disp; +uint64_t +SystemZMCCodeEmitter::getDisp12Encoding(const MCInst &MI, unsigned OpNum, + SmallVectorImpl &Fixups, + const MCSubtargetInfo &STI) const { + return getDispOpValue(MI, OpNum, Fixups, SystemZ::FixupKind::FK_390_12); } -uint64_t SystemZMCCodeEmitter:: -getBDVAddr12Encoding(const MCInst &MI, unsigned OpNum, - SmallVectorImpl &Fixups, - const MCSubtargetInfo &STI) const { - uint64_t Base = getMachineOpValue(MI, MI.getOperand(OpNum), Fixups, STI); - uint64_t Disp = getDispOpValue(MI, OpNum + 1, Fixups, SystemZ::FK_390_12); - uint64_t Index = getMachineOpValue(MI, MI.getOperand(OpNum + 2), Fixups, STI); - assert(isUInt<4>(Base) && isUInt<12>(Disp) && isUInt<5>(Index)); - return (Index << 16) | (Base << 12) | Disp; +uint64_t +SystemZMCCodeEmitter::getDisp20Encoding(const MCInst &MI, unsigned OpNum, + SmallVectorImpl &Fixups, + const MCSubtargetInfo &STI) const { + return getDispOpValue(MI, OpNum, Fixups, SystemZ::FixupKind::FK_390_20); } uint64_t diff --git a/llvm/lib/Target/SystemZ/SystemZInstrFormats.td b/llvm/lib/Target/SystemZ/SystemZInstrFormats.td --- a/llvm/lib/Target/SystemZ/SystemZInstrFormats.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrFormats.td @@ -172,11 +172,9 @@ // bits<4> Rn : register input or output for operand n // bits<5> Vn : vector register input or output for operand n // bits In : immediate value of width m for operand n -// bits<4> BDn : address operand n, which has a base and a displacement -// bits XBDn : address operand n, which has an index, a base and a -// displacement -// bits VBDn : address operand n, which has a vector index, a base and a -// displacement +// bits<4> Bn : base register for address operand n +// bits Dn : displacement for address operand n +// bits<5> Vn : vector index for address operand n // bits<4> Xn : index register for address operand n // bits<4> Mn : mode value for operand n // @@ -452,12 +450,14 @@ bits<4> R1; bits<8> I2; bits<4> M3; - bits<16> BD4; + bits<4> B4; + bits<12> D4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = M3; - let Inst{31-16} = BD4; + let Inst{31-28} = B4; + let Inst{27-16} = D4; let Inst{15-8} = I2; let Inst{7-0} = op{7-0}; } @@ -596,12 +596,14 @@ bits<4> R1; bits<4> R2; bits<4> M3; - bits<16> BD4; + bits<4> B4; + bits<12> D4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R2; - let Inst{31-16} = BD4; + let Inst{31-28} = B4; + let Inst{27-16} = D4; let Inst{15-12} = M3; let Inst{11-8} = 0; let Inst{7-0} = op{7-0}; @@ -613,11 +615,15 @@ field bits<32> SoftFail = 0; bits<4> R1; - bits<20> XBD2; + bits<4> X2; + bits<4> B2; + bits<12> D2; let Inst{31-24} = op; let Inst{23-20} = R1; - let Inst{19-0} = XBD2; + let Inst{19-16} = X2; + let Inst{15-12} = B2; + let Inst{11-0} = D2; let HasIndex = 1; } @@ -628,11 +634,15 @@ field bits<32> SoftFail = 0; bits<4> M1; - bits<20> XBD2; + bits<4> X2; + bits<4> B2; + bits<12> D2; let Inst{31-24} = op; let Inst{23-20} = M1; - let Inst{19-0} = XBD2; + let Inst{19-16} = X2; + let Inst{15-12} = B2; + let Inst{11-0} = D2; let HasIndex = 1; } @@ -643,12 +653,16 @@ field bits<48> SoftFail = 0; bits<4> R1; - bits<20> XBD2; + bits<4> X2; + bits<4> B2; + bits<12> D2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; - let Inst{35-16} = XBD2; + let Inst{35-32} = X2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = M3; let Inst{11-8} = 0; let Inst{7-0} = op{7-0}; @@ -663,11 +677,15 @@ bits<4> R1; bits<4> R3; - bits<20> XBD2; + bits<4> X2; + bits<4> B2; + bits<12> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R3; - let Inst{35-16} = XBD2; + let Inst{35-32} = X2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = R1; let Inst{11-8} = 0; let Inst{7-0} = op{7-0}; @@ -681,11 +699,16 @@ field bits<48> SoftFail = 0; bits<4> R1; - bits<28> XBD2; + bits<4> X2; + bits<4> B2; + bits<20> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; - let Inst{35-8} = XBD2; + let Inst{35-32} = X2; + let Inst{31-28} = B2; + let Inst{27-16} = D2{11-0}; + let Inst{15-8} = D2{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; @@ -698,11 +721,16 @@ field bits<48> SoftFail = 0; bits<4> M1; - bits<28> XBD2; + bits<4> X2; + bits<4> B2; + bits<20> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = M1; - let Inst{35-8} = XBD2; + let Inst{35-32} = X2; + let Inst{31-28} = B2; + let Inst{27-16} = D2{11-0}; + let Inst{15-8} = D2{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; @@ -716,12 +744,14 @@ bits<4> R1; bits<4> R3; - bits<16> BD2; + bits<4> B2; + bits<12> D2; let Inst{31-24} = op; let Inst{23-20} = R1; let Inst{19-16} = R3; - let Inst{15-0} = BD2; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstRSb op, dag outs, dag ins, string asmstr, list pattern> @@ -731,12 +761,33 @@ bits<4> R1; bits<4> M3; - bits<16> BD2; + bits<4> B2; + bits<12> D2; let Inst{31-24} = op; let Inst{23-20} = R1; let Inst{19-16} = M3; - let Inst{15-0} = BD2; + let Inst{15-12} = B2; + let Inst{11-0} = D2; +} + +class InstRSEa op, dag outs, dag ins, string asmstr, list pattern> + : InstSystemZ<6, outs, ins, asmstr, pattern> { + field bits<48> Inst; + field bits<48> SoftFail = 0; + + bits<4> R1; + bits<4> R3; + bits<4> B2; + bits<12> D2; + + let Inst{47-40} = op{15-8}; + let Inst{39-36} = R1; + let Inst{35-32} = R3; + let Inst{31-28} = B2; + let Inst{27-16} = D2; + let Inst{15-8} = 0; + let Inst{7-0} = op{7-0}; } class InstRSI op, dag outs, dag ins, string asmstr, list pattern> @@ -759,12 +810,15 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<20> BDL1; + bits<4> B1; + bits<12> D1; + bits<4> L1; let Inst{47-40} = op{15-8}; - let Inst{39-36} = BDL1{19-16}; + let Inst{39-36} = L1; let Inst{35-32} = 0; - let Inst{31-16} = BDL1{15-0}; + let Inst{31-28} = B1; + let Inst{27-16} = D1; let Inst{15-8} = 0; let Inst{7-0} = op{7-0}; } @@ -775,11 +829,15 @@ field bits<48> SoftFail = 0; bits<4> R1; - bits<24> BDL2; + bits<4> B2; + bits<12> D2; + bits<8> L2; bits<4> M3; let Inst{47-40} = op{15-8}; - let Inst{39-16} = BDL2; + let Inst{39-32} = L2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = R1; let Inst{11-8} = M3; let Inst{7-0} = op{7-0}; @@ -792,12 +850,15 @@ bits<4> R1; bits<4> R3; - bits<24> BD2; + bits<4> B2; + bits<20> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = R3; - let Inst{31-8} = BD2; + let Inst{31-28} = B2; + let Inst{27-16} = D2{11-0}; + let Inst{15-8} = D2{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; @@ -810,12 +871,15 @@ bits<4> R1; bits<4> M3; - bits<24> BD2; + bits<4> B2; + bits<20> D2; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = M3; - let Inst{31-8} = BD2; + let Inst{31-28} = B2; + let Inst{27-16} = D2{11-0}; + let Inst{15-8} = D2{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; @@ -826,12 +890,14 @@ field bits<32> Inst; field bits<32> SoftFail = 0; - bits<16> BD1; + bits<4> B1; + bits<12> D1; bits<8> I2; let Inst{31-24} = op; let Inst{23-16} = I2; - let Inst{15-0} = BD1; + let Inst{15-12} = B1; + let Inst{11-0} = D1; } class InstSIL op, dag outs, dag ins, string asmstr, list pattern> @@ -839,11 +905,13 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<16> BD1; + bits<4> B1; + bits<12> D1; bits<16> I2; let Inst{47-32} = op; - let Inst{31-16} = BD1; + let Inst{31-28} = B1; + let Inst{27-16} = D1; let Inst{15-0} = I2; } @@ -852,12 +920,15 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<24> BD1; + bits<4> B1; + bits<20> D1; bits<8> I2; let Inst{47-40} = op{15-8}; let Inst{39-32} = I2; - let Inst{31-8} = BD1; + let Inst{31-28} = B1; + let Inst{27-16} = D1{11-0}; + let Inst{15-8} = D1{19-12}; let Inst{7-0} = op{7-0}; let Has20BitOffset = 1; @@ -870,12 +941,14 @@ bits<4> M1; bits<16> RI2; - bits<16> BD3; + bits<4> B3; + bits<12> D3; let Inst{47-40} = op; let Inst{39-36} = M1; let Inst{35-32} = 0; - let Inst{31-16} = BD3; + let Inst{31-28} = B3; + let Inst{27-16} = D3; let Inst{15-0} = RI2; } @@ -884,12 +957,18 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<24> BDL1; - bits<16> BD2; + bits<4> B1; + bits<12> D1; + bits<8> L1; + bits<4> B2; + bits<12> D2; let Inst{47-40} = op; - let Inst{39-16} = BDL1; - let Inst{15-0} = BD2; + let Inst{39-32} = L1; + let Inst{31-28} = B1; + let Inst{27-16} = D1; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstSSb op, dag outs, dag ins, string asmstr, list pattern> @@ -897,14 +976,20 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<20> BDL1; - bits<20> BDL2; + bits<4> B1; + bits<12> D1; + bits<4> L1; + bits<4> B2; + bits<12> D2; + bits<4> L2; let Inst{47-40} = op; - let Inst{39-36} = BDL1{19-16}; - let Inst{35-32} = BDL2{19-16}; - let Inst{31-16} = BDL1{15-0}; - let Inst{15-0} = BDL2{15-0}; + let Inst{39-36} = L1; + let Inst{35-32} = L2; + let Inst{31-28} = B1; + let Inst{27-16} = D1; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstSSc op, dag outs, dag ins, string asmstr, list pattern> @@ -912,15 +997,20 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<20> BDL1; - bits<16> BD2; + bits<4> B1; + bits<12> D1; + bits<4> L1; + bits<4> B2; + bits<12> D2; bits<4> I3; let Inst{47-40} = op; - let Inst{39-36} = BDL1{19-16}; + let Inst{39-36} = L1; let Inst{35-32} = I3; - let Inst{31-16} = BDL1{15-0}; - let Inst{15-0} = BD2; + let Inst{31-28} = B1; + let Inst{27-16} = D1; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstSSd op, dag outs, dag ins, string asmstr, list pattern> @@ -928,15 +1018,20 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<20> RBD1; - bits<16> BD2; + bits<4> R1; + bits<4> B1; + bits<12> D1; + bits<4> B2; + bits<12> D2; bits<4> R3; let Inst{47-40} = op; - let Inst{39-36} = RBD1{19-16}; + let Inst{39-36} = R1; let Inst{35-32} = R3; - let Inst{31-16} = RBD1{15-0}; - let Inst{15-0} = BD2; + let Inst{31-28} = B1; + let Inst{27-16} = D1; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstSSe op, dag outs, dag ins, string asmstr, list pattern> @@ -945,15 +1040,19 @@ field bits<48> SoftFail = 0; bits<4> R1; - bits<16> BD2; + bits<4> B2; + bits<12> D2; bits<4> R3; - bits<16> BD4; + bits<4> B4; + bits<12> D4; let Inst{47-40} = op; let Inst{39-36} = R1; let Inst{35-32} = R3; - let Inst{31-16} = BD2; - let Inst{15-0} = BD4; + let Inst{31-28} = B2; + let Inst{27-16} = D2; + let Inst{15-12} = B4; + let Inst{11-0} = D4; } class InstSSf op, dag outs, dag ins, string asmstr, list pattern> @@ -961,13 +1060,18 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<16> BD1; - bits<24> BDL2; + bits<4> B1; + bits<12> D1; + bits<4> B2; + bits<12> D2; + bits<8> L2; let Inst{47-40} = op; - let Inst{39-32} = BDL2{23-16}; - let Inst{31-16} = BD1; - let Inst{15-0} = BDL2{15-0}; + let Inst{39-32} = L2; + let Inst{31-28} = B1; + let Inst{27-16} = D1; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstSSE op, dag outs, dag ins, string asmstr, list pattern> @@ -975,12 +1079,16 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<16> BD1; - bits<16> BD2; + bits<4> B1; + bits<12> D1; + bits<4> B2; + bits<12> D2; let Inst{47-32} = op; - let Inst{31-16} = BD1; - let Inst{15-0} = BD2; + let Inst{31-28} = B1; + let Inst{27-16} = D1; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstSSF op, dag outs, dag ins, string asmstr, list pattern> @@ -988,15 +1096,19 @@ field bits<48> Inst; field bits<48> SoftFail = 0; - bits<16> BD1; - bits<16> BD2; + bits<4> B1; + bits<12> D1; + bits<4> B2; + bits<12> D2; bits<4> R3; let Inst{47-40} = op{11-4}; let Inst{39-36} = R3; let Inst{35-32} = op{3-0}; - let Inst{31-16} = BD1; - let Inst{15-0} = BD2; + let Inst{31-28} = B1; + let Inst{27-16} = D1; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstS op, dag outs, dag ins, string asmstr, list pattern> @@ -1004,10 +1116,12 @@ field bits<32> Inst; field bits<32> SoftFail = 0; - bits<16> BD2; + bits<4> B2; + bits<12> D2; let Inst{31-16} = op; - let Inst{15-0} = BD2; + let Inst{15-12} = B2; + let Inst{11-0} = D2; } class InstVRIa op, dag outs, dag ins, string asmstr, list pattern> @@ -1493,14 +1607,16 @@ field bits<48> SoftFail = 0; bits<5> V1; - bits<16> BD2; + bits<4> B2; + bits<12> D2; bits<5> V3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = V3{3-0}; - let Inst{31-16} = BD2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10} = V3{4}; @@ -1514,14 +1630,16 @@ field bits<48> SoftFail = 0; bits<5> V1; - bits<16> BD2; + bits<4> B2; + bits<12> D2; bits<4> R3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; let Inst{35-32} = R3; - let Inst{31-16} = BD2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = M4; let Inst{11} = V1{4}; let Inst{10-8} = 0; @@ -1534,14 +1652,16 @@ field bits<48> SoftFail = 0; bits<4> R1; - bits<16> BD2; + bits<4> B2; + bits<12> D2; bits<5> V3; bits<4> M4; let Inst{47-40} = op{15-8}; let Inst{39-36} = R1; let Inst{35-32} = V3{3-0}; - let Inst{31-16} = BD2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = M4; let Inst{11} = 0; let Inst{10} = V3{4}; @@ -1555,13 +1675,15 @@ field bits<48> SoftFail = 0; bits<5> V1; - bits<16> BD2; + bits<4> B2; + bits<12> D2; bits<4> R3; let Inst{47-40} = op{15-8}; let Inst{39-36} = 0; let Inst{35-32} = R3; - let Inst{31-16} = BD2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = V1{3-0}; let Inst{11-9} = 0; let Inst{8} = V1{4}; @@ -1574,15 +1696,19 @@ field bits<48> SoftFail = 0; bits<5> V1; - bits<21> VBD2; + bits<5> V2; + bits<4> B2; + bits<12> D2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; - let Inst{35-16} = VBD2{19-0}; + let Inst{35-32} = V2{3-0}; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = M3; let Inst{11} = V1{4}; - let Inst{10} = VBD2{20}; + let Inst{10} = V2{4}; let Inst{9-8} = 0; let Inst{7-0} = op{7-0}; } @@ -1593,12 +1719,16 @@ field bits<48> SoftFail = 0; bits<5> V1; - bits<20> XBD2; + bits<4> X2; + bits<4> B2; + bits<12> D2; bits<4> M3; let Inst{47-40} = op{15-8}; let Inst{39-36} = V1{3-0}; - let Inst{35-16} = XBD2; + let Inst{35-32} = X2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = M3; let Inst{11} = V1{4}; let Inst{10-8} = 0; @@ -1611,12 +1741,14 @@ field bits<48> SoftFail = 0; bits<5> V1; - bits<16> BD2; + bits<4> B2; + bits<12> D2; bits<8> I3; let Inst{47-40} = op{15-8}; let Inst{39-32} = I3; - let Inst{31-16} = BD2; + let Inst{31-28} = B2; + let Inst{27-16} = D2; let Inst{15-12} = V1{3-0}; let Inst{11-9} = 0; let Inst{8} = V1{4}; @@ -1703,14 +1835,11 @@ let Inst{31-24} = enc{31-24}; } -// RSE is like RSY except with a 12 bit displacement (instead of 20). class DirectiveInsnRSE pattern> - : InstRSYa<6, outs, ins, asmstr, pattern> { + : InstRSEa<6, outs, ins, asmstr, pattern> { bits <48> enc; let Inst{47-40} = enc{47-40}; - let Inst{31-16} = BD2{15-0}; - let Inst{15-8} = 0; let Inst{7-0} = enc{7-0}; } @@ -2131,7 +2260,7 @@ class StoreInherentS opcode, SDPatternOperator operator, bits<5> bytes> - : InstS { let mayStore = 1; let AccessBytes = bytes; @@ -2143,7 +2272,8 @@ class SideEffectInherentS opcode, SDPatternOperator operator> : InstS { - let BD2 = 0; + let B2 = 0; + let D2 = 0; } class SideEffectInherentRRE opcode> @@ -2163,11 +2293,11 @@ mnemonic#"\t$R1, $RI2", []>; class CallRR opcode> - : InstRR; class CallRX opcode> - : InstRXa; class CondBranchRI opcode, @@ -2219,27 +2349,40 @@ : InstRR; -class FixedCondBranchRR opcode, - SDPatternOperator operator = null_frag> - : InstRR { +class AsmFixedCondBranchRR opcode> + : InstRR { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; let R1 = V.ccmask; } +class UncondBranchRR opcode, + SDPatternOperator operator> + : InstRR { + let R1 = 0xf; +} + +class AsmUncondBranchRR opcode> + : InstRR { + let R1 = 0xf; +} + class CondBranchRX opcode> - : InstRXb { let CCMaskFirst = 1; } class AsmCondBranchRX opcode> - : InstRXb; class FixedCondBranchRX opcode> - : InstRXb { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; @@ -2247,21 +2390,23 @@ } class CondBranchRXY opcode> - : InstRXYb { let CCMaskFirst = 1; let mayLoad = 1; } class AsmCondBranchRXY opcode> - : InstRXYb { let mayLoad = 1; } class FixedCondBranchRXY opcode, SDPatternOperator operator = null_frag> - : InstRXYb { let isAsmParserOnly = V.alternate; @@ -2381,18 +2526,19 @@ class CmpBranchRRS opcode, RegisterOperand cls> : InstRRS; class AsmCmpBranchRRS opcode, RegisterOperand cls> : InstRRS; class FixedCmpBranchRRS opcode, RegisterOperand cls> - : InstRRS { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; @@ -2409,18 +2555,19 @@ class CmpBranchRIS opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIS; class AsmCmpBranchRIS opcode, RegisterOperand cls, ImmOpWithPattern imm> : InstRIS; class FixedCmpBranchRIS opcode, RegisterOperand cls, ImmOpWithPattern imm> - : InstRIS { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; @@ -2436,12 +2583,14 @@ class CmpBranchRSYb opcode, RegisterOperand cls> - : InstRSYb; class AsmCmpBranchRSYb opcode, RegisterOperand cls> - : InstRSYb; multiclass CmpBranchRSYbPair opcode, @@ -2453,7 +2602,7 @@ class FixedCmpBranchRSYb opcode, RegisterOperand cls> - : InstRSYb { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; @@ -2489,14 +2638,16 @@ } class BranchUnaryRX opcode, RegisterOperand cls> - : InstRXa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; } class BranchUnaryRXY opcode, RegisterOperand cls> - : InstRXYa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; @@ -2519,7 +2670,7 @@ class BranchBinaryRS opcode, RegisterOperand cls> : InstRSa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; @@ -2527,7 +2678,8 @@ class BranchBinaryRSY opcode, RegisterOperand cls> : InstRSYa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; @@ -2535,14 +2687,14 @@ class LoadMultipleRS opcode, RegisterOperand cls, AddressingMode mode = bdaddr12only> - : InstRSa { let mayLoad = 1; } class LoadMultipleRSY opcode, RegisterOperand cls, AddressingMode mode = bdaddr20only> - : InstRSYa { let mayLoad = 1; } @@ -2559,7 +2711,7 @@ class LoadMultipleSSe opcode, RegisterOperand cls> : InstSSe { let mayLoad = 1; } @@ -2567,11 +2719,11 @@ multiclass LoadMultipleVRSaAlign opcode> { let mayLoad = 1 in { def Align : InstVRSa; let M4 = 0 in def "" : InstVRSa; } } @@ -2591,7 +2743,7 @@ class StoreRX opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr12only> - : InstRXa { let OpKey = mnemonic#"r"#cls; @@ -2603,7 +2755,7 @@ class StoreRXY opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr20only> - : InstRXYa { let OpKey = mnemonic#"r"#cls; @@ -2626,7 +2778,8 @@ class StoreVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, bits<4> type = 0> - : InstVRX { let M3 = type; @@ -2635,7 +2788,8 @@ } class StoreVRXGeneric opcode> - : InstVRX { let mayStore = 1; } @@ -2643,17 +2797,20 @@ multiclass StoreVRXAlign opcode> { let mayStore = 1, AccessBytes = 16 in { def Align : InstVRX; let M3 = 0 in - def "" : InstVRX; } } class StoreLengthVRSb opcode, SDPatternOperator operator, bits<5> bytes> - : InstVRSb { let M4 = 0; @@ -2663,7 +2820,8 @@ class StoreLengthVRSd opcode, SDPatternOperator operator, bits<5> bytes> - : InstVRSd { let mayStore = 1; @@ -2672,7 +2830,8 @@ class StoreLengthVSI opcode, SDPatternOperator operator, bits<5> bytes> - : InstVSI { let mayStore = 1; @@ -2681,14 +2840,14 @@ class StoreMultipleRS opcode, RegisterOperand cls, AddressingMode mode = bdaddr12only> - : InstRSa { let mayStore = 1; } class StoreMultipleRSY opcode, RegisterOperand cls, AddressingMode mode = bdaddr20only> - : InstRSYa { let mayStore = 1; } @@ -2706,11 +2865,12 @@ multiclass StoreMultipleVRSaAlign opcode> { let mayStore = 1 in { def Align : InstVRSa; let M4 = 0 in def "" : InstVRSa; } } @@ -2723,7 +2883,7 @@ // only use the StoreSI* instruction if the matched address is suitable. class StoreSI opcode, SDPatternOperator operator, ImmOpWithPattern imm> - : InstSI { let mayStore = 1; @@ -2731,7 +2891,7 @@ class StoreSIY opcode, SDPatternOperator operator, ImmOpWithPattern imm> - : InstSIY { let mayStore = 1; @@ -2739,7 +2899,7 @@ class StoreSIL opcode, SDPatternOperator operator, ImmOpWithPattern imm> - : InstSIL { let mayStore = 1; @@ -2756,7 +2916,8 @@ } class StoreSSE opcode> - : InstSSE { let mayStore = 1; } @@ -2764,8 +2925,9 @@ class CondStoreRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { + : InstRSYb { let mayStore = 1; let AccessBytes = bytes; let CCMaskLast = 1; @@ -2776,7 +2938,7 @@ class AsmCondStoreRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayStore = 1; let AccessBytes = bytes; @@ -2786,7 +2948,7 @@ class FixedCondStoreRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayStore = 1; let AccessBytes = bytes; @@ -2823,7 +2985,7 @@ class SideEffectUnaryS opcode, SDPatternOperator operator, bits<5> bytes, AddressingMode mode = bdaddr12only> - : InstS { let mayLoad = 1; let AccessBytes = bytes; @@ -2832,7 +2994,7 @@ class SideEffectUnarySIY opcode, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstSIY { let mayLoad = 1; let AccessBytes = bytes; @@ -2842,18 +3004,18 @@ class SideEffectAddressS opcode, SDPatternOperator operator, AddressingMode mode = bdaddr12only> - : InstS; class LoadAddressRX opcode, SDPatternOperator operator, AddressingMode mode> - : InstRXa; class LoadAddressRXY opcode, SDPatternOperator operator, AddressingMode mode> - : InstRXYa; @@ -2936,7 +3098,7 @@ SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayLoad = 1; let AccessBytes = bytes; @@ -2969,7 +3132,7 @@ class FixedCondUnaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; @@ -2992,7 +3155,7 @@ class UnaryRX opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr12only> - : InstRXa { let OpKey = mnemonic#"r"#cls; @@ -3003,7 +3166,7 @@ class UnaryRXE opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes> - : InstRXE { let OpKey = mnemonic#"r"#cls; @@ -3016,7 +3179,7 @@ class UnaryRXY opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr20only> - : InstRXYa { let OpKey = mnemonic#"r"#cls; @@ -3110,7 +3273,7 @@ class UnaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, bits<4> type = 0> - : InstVRX { let M3 = type; @@ -3119,7 +3282,8 @@ } class UnaryVRXGeneric opcode> - : InstVRX { let mayLoad = 1; } @@ -3127,22 +3291,23 @@ multiclass UnaryVRXAlign opcode> { let mayLoad = 1, AccessBytes = 16 in { def Align : InstVRX; let M3 = 0 in - def "" : InstVRX; } } class SideEffectBinaryRX opcode, RegisterOperand cls> - : InstRXa; class SideEffectBinaryRXY opcode, RegisterOperand cls> - : InstRXYa; class SideEffectBinaryRILPC opcode, @@ -3181,29 +3346,33 @@ mnemonic#"\t$I1, $I2", []>; class SideEffectBinarySI opcode, Operand imm> - : InstSI; class SideEffectBinarySIL opcode, SDPatternOperator operator, ImmOpWithPattern imm> - : InstSIL; class SideEffectBinarySSa opcode> - : InstSSa; class SideEffectBinarySSb opcode> : InstSSb; class SideEffectBinarySSf opcode> - : InstSSf; class SideEffectBinarySSE opcode> - : InstSSE; class SideEffectBinaryMemMemRR opcode, @@ -3511,7 +3680,8 @@ class BinaryRS opcode, SDPatternOperator operator, RegisterOperand cls> - : InstRSa { let R3 = 0; @@ -3521,7 +3691,7 @@ class BinaryRSY opcode, SDPatternOperator operator, RegisterOperand cls> - : InstRSYa; @@ -3538,7 +3708,7 @@ class BinaryRSL opcode, RegisterOperand cls> : InstRSLb { let mayLoad = 1; } @@ -3546,7 +3716,7 @@ class BinaryRX opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr12only> - : InstRXa { let OpKey = mnemonic#"r"#cls; @@ -3559,7 +3729,8 @@ class BinaryRXE opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> - : InstRXE { @@ -3575,7 +3746,8 @@ class BinaryRXF opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2, SDPatternOperator load, bits<5> bytes> - : InstRXF { let OpKey = mnemonic#"r"#cls; @@ -3587,7 +3759,8 @@ class BinaryRXY opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr20only> - : InstRXYa { let OpKey = mnemonic#"r"#cls; @@ -3613,7 +3786,7 @@ class BinarySI opcode, SDPatternOperator operator, Operand imm, AddressingMode mode = bdaddr12only> - : InstSI { let mayLoad = 1; @@ -3622,7 +3795,7 @@ class BinarySIY opcode, SDPatternOperator operator, Operand imm, AddressingMode mode = bdaddr20only> - : InstSIY { let mayLoad = 1; @@ -3641,7 +3814,8 @@ } class BinarySSF opcode, RegisterOperand cls> - : InstSSF { let mayLoad = 1; } @@ -3849,7 +4023,8 @@ class BinaryVRSa opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type> - : InstVRSa { @@ -3858,12 +4033,13 @@ class BinaryVRSaGeneric opcode> : InstVRSa; class BinaryVRSb opcode, SDPatternOperator operator, bits<5> bytes> - : InstVRSb { let M4 = 0; @@ -3873,20 +4049,22 @@ class BinaryVRSc opcode, SDPatternOperator operator, TypedReg tr, bits<4> type> - : InstVRSc { + : InstVRSc { let M4 = type; } class BinaryVRScGeneric opcode> : InstVRSc; class BinaryVRSd opcode, SDPatternOperator operator, bits<5> bytes> - : InstVRSd { let mayLoad = 1; @@ -3895,7 +4073,8 @@ class BinaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes> - : InstVRX { @@ -3905,7 +4084,7 @@ class StoreBinaryRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> - : InstRSb { let mayStore = 1; let AccessBytes = bytes; @@ -3913,7 +4092,7 @@ class StoreBinaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayStore = 1; let AccessBytes = bytes; @@ -3933,14 +4112,16 @@ class StoreBinaryRSL opcode, RegisterOperand cls> : InstRSLb { let mayStore = 1; } class BinaryVSI opcode, SDPatternOperator operator, bits<5> bytes> - : InstVSI { let mayLoad = 1; @@ -3949,7 +4130,8 @@ class StoreBinaryVRV opcode, bits<5> bytes, ImmOpWithPattern index> - : InstVRV { let mayStore = 1; let AccessBytes = bytes; @@ -3958,7 +4140,8 @@ class StoreBinaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, ImmOpWithPattern index> - : InstVRX { let mayStore = 1; @@ -3968,7 +4151,8 @@ class MemoryBinarySSd opcode, RegisterOperand cls> : InstSSd; class CompareRR opcode, SDPatternOperator operator, @@ -4023,7 +4207,7 @@ class CompareRX opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr12only> - : InstRXa { let OpKey = mnemonic#"r"#cls; @@ -4035,7 +4219,7 @@ class CompareRXE opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> - : InstRXE { let OpKey = mnemonic#"r"#cls; @@ -4049,7 +4233,7 @@ class CompareRXY opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr20only> - : InstRXYa { let OpKey = mnemonic#"r"#cls; @@ -4074,7 +4258,7 @@ class CompareRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> - : InstRSb { let mayLoad = 1; let AccessBytes = bytes; @@ -4082,7 +4266,7 @@ class CompareRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayLoad = 1; let AccessBytes = bytes; @@ -4100,7 +4284,8 @@ class CompareSSb opcode> : InstSSb { let isCompare = 1; let mayLoad = 1; @@ -4109,7 +4294,7 @@ class CompareSI opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm, AddressingMode mode = bdaddr12only> - : InstSI { let isCompare = 1; @@ -4118,7 +4303,7 @@ class CompareSIL opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm> - : InstSIL { let isCompare = 1; @@ -4128,7 +4313,7 @@ class CompareSIY opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm, AddressingMode mode = bdaddr20only> - : InstSIY { let isCompare = 1; @@ -4185,12 +4370,13 @@ class TestInherentS opcode, SDPatternOperator operator> : InstS { - let BD2 = 0; + let B2 = 0; + let D2 = 0; } class TestRXE opcode, SDPatternOperator operator, RegisterOperand cls> - : InstRXE { let M3 = 0; @@ -4198,12 +4384,12 @@ class TestBinarySIL opcode, SDPatternOperator operator, ImmOpWithPattern imm> - : InstSIL; class TestRSL opcode> - : InstRSLa { let mayLoad = 1; } @@ -4213,8 +4399,8 @@ mnemonic#"\t$V1", []>; class SideEffectTernarySSc opcode> - : InstSSc; class SideEffectTernaryRRFa opcode, @@ -4289,7 +4475,8 @@ class SideEffectTernarySSF opcode, RegisterOperand cls> : InstSSF; class TernaryRRFa opcode, @@ -4328,7 +4515,7 @@ class TernaryRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> : InstRSb { let Constraints = "$R1 = $R1src"; @@ -4340,7 +4527,7 @@ class TernaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let Constraints = "$R1 = $R1src"; @@ -4362,19 +4549,19 @@ class SideEffectTernaryRS opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSa; class SideEffectTernaryRSY opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSYa; class SideEffectTernaryMemMemRS opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSa { let Constraints = "$R1 = $R1src, $R3 = $R3src"; let DisableEncoding = "$R1src, $R3src"; @@ -4383,7 +4570,7 @@ class SideEffectTernaryMemMemRSY opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSYa { let Constraints = "$R1 = $R1src, $R3 = $R3src"; let DisableEncoding = "$R1src, $R3src"; @@ -4393,7 +4580,7 @@ RegisterOperand cls1, RegisterOperand cls2, SDPatternOperator load, bits<5> bytes> : InstRXF { @@ -4593,7 +4780,7 @@ class TernaryVRSb opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, RegisterOperand cls, bits<4> type> : InstVRSb opcode> : InstVRSb { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; @@ -4624,7 +4812,7 @@ class TernaryVRV opcode, bits<5> bytes, ImmOpWithPattern index> : InstVRV { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; @@ -4635,7 +4823,7 @@ class TernaryVRX opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<5> bytes, ImmOpWithPattern index> : InstVRX opcode, RegisterOperand cls> : InstSSe; class LoadAndOpRSY opcode, SDPatternOperator operator, RegisterOperand cls, AddressingMode mode = bdaddr20only> - : InstRSYa { let mayLoad = 1; @@ -4788,7 +4977,8 @@ class CmpSwapRS opcode, SDPatternOperator operator, RegisterOperand cls, AddressingMode mode = bdaddr12only> - : InstRSa { let Constraints = "$R1 = $R1src"; @@ -4799,7 +4989,8 @@ class CmpSwapRSY opcode, SDPatternOperator operator, RegisterOperand cls, AddressingMode mode = bdaddr20only> - : InstRSYa { let Constraints = "$R1 = $R1src"; @@ -4829,7 +5020,8 @@ } class PrefetchRXY opcode, SDPatternOperator operator> - : InstRXYb; @@ -4846,7 +5038,8 @@ class BranchPreloadSMI opcode> : InstSMI; class BranchPreloadMII opcode> @@ -4892,7 +5085,7 @@ class UnaryRXYPseudo bytes, AddressingMode mode = bdxaddr20only> - : Pseudo<(outs cls:$R1), (ins mode:$XBD2), + : Pseudo<(outs cls:$R1), (ins (mode $B2, $D2, $X2):$XBD2), [(set cls:$R1, (operator mode:$XBD2))]> { let OpKey = key#"r"#cls; let OpType = "mem"; @@ -4944,7 +5137,7 @@ // Mapping: R -> MemFoldPseudo -> class MemFoldPseudo bytes, AddressingMode mode> - : Pseudo<(outs cls:$R1), (ins cls:$R2, mode:$XBD2), []> { + : Pseudo<(outs cls:$R1), (ins cls:$R2, (mode $B2, $D2, $X2):$XBD2), []> { let OpKey = !subst("mscrk", "msrkc", !subst("msgcrk", "msgrkc", mnemonic#"rk"#cls)); @@ -4966,7 +5159,8 @@ class MemFoldPseudo_FPTern bytes, AddressingMode mode> - : Pseudo<(outs cls:$R1), (ins cls:$R2, cls:$R3, mode:$XBD2), []> { + : Pseudo<(outs cls:$R1), + (ins cls:$R2, cls:$R3, (mode $B2, $D2, $X2):$XBD2), []> { let OpKey = mnemonic#"r"#"MemFold"#cls; let OpType = "mem"; let MemKey = mnemonic#cls; @@ -4981,7 +5175,7 @@ class MemFoldPseudo_CondMove bytes, AddressingMode mode> : Pseudo<(outs cls:$R1), - (ins cls:$R2, mode:$XBD2, cond4:$valid, cond4:$M3), []> { + (ins cls:$R2, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$M3), []> { let OpKey = !subst("loc", "sel", mnemonic)#"r"#cls; let OpType = "mem"; let MemKey = mnemonic#cls; @@ -5003,7 +5197,7 @@ class CompareRXYPseudo bytes, AddressingMode mode = bdxaddr20only> - : Pseudo<(outs), (ins cls:$R1, mode:$XBD2), + : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2), [(set CC, (operator cls:$R1, (load mode:$XBD2)))]> { let mayLoad = 1; let Has20BitOffset = 1; @@ -5013,7 +5207,7 @@ // Like TestBinarySIL, but expanded later. class TestBinarySILPseudo - : Pseudo<(outs), (ins bdaddr12only:$BD1, imm:$I2), + : Pseudo<(outs), (ins (bdaddr12only $B1, $D1):$BD1, imm:$I2), [(set CC, (operator bdaddr12only:$BD1, imm:$I2))]>; // Like CondBinaryRRF, but expanded after RA depending on the choice of @@ -5066,7 +5260,7 @@ RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : Pseudo<(outs cls:$R1), - (ins cls:$R1src, mode:$BD2, cond4:$valid, cond4:$R3), + (ins cls:$R1src, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$R3), [(set cls:$R1, (z_select_ccmask (operator mode:$BD2), cls:$R1src, cond4:$valid, cond4:$R3))]> { @@ -5085,7 +5279,8 @@ // register. class CondStoreRSYPseudo bytes, AddressingMode mode = bdaddr20only> - : Pseudo<(outs), (ins cls:$R1, mode:$BD2, cond4:$valid, cond4:$R3), []> { + : Pseudo<(outs), + (ins cls:$R1, (mode $B2, $D2):$BD2, cond4:$valid, cond4:$R3), []> { let mayStore = 1; let AccessBytes = bytes; let CCMaskLast = 1; @@ -5094,7 +5289,7 @@ // Like StoreRXY, but expanded after RA depending on the choice of register. class StoreRXYPseudo bytes, AddressingMode mode = bdxaddr20only> - : Pseudo<(outs), (ins cls:$R1, mode:$XBD2), + : Pseudo<(outs), (ins cls:$R1, (mode $B2, $D2, $X2):$XBD2), [(operator cls:$R1, mode:$XBD2)]> { let mayStore = 1; let Has20BitOffset = 1; @@ -5211,13 +5406,13 @@ // An alias of a UnaryVRX, but with different register sizes. class UnaryAliasVRX - : Alias<6, (outs tr.op:$V1), (ins mode:$XBD2), + : Alias<6, (outs tr.op:$V1), (ins (mode $B2, $D2, $X2):$XBD2), [(set (tr.vt tr.op:$V1), (operator mode:$XBD2))]>; // An alias of a StoreVRX, but with different register sizes. class StoreAliasVRX - : Alias<6, (outs), (ins tr.op:$V1, mode:$XBD2), + : Alias<6, (outs), (ins tr.op:$V1, (mode $B2, $D2, $X2):$XBD2), [(operator (tr.vt tr.op:$V1), mode:$XBD2)]>; // An alias of a BinaryRI, but with different register sizes. diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.td b/llvm/lib/Target/SystemZ/SystemZInstrInfo.td --- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.td @@ -88,7 +88,7 @@ def JGAsm#V : FixedCondBranchRIL, "j{g|l}#", 0xC04>; let isIndirectBranch = 1 in { def BAsm#V : FixedCondBranchRX , "b#", 0x47>; - def BRAsm#V : FixedCondBranchRR , "b#r", 0x07>; + def BRAsm#V : AsmFixedCondBranchRR, "b#r", 0x07>; def BIAsm#V : FixedCondBranchRXY, "bi#", 0xe347>, Requires<[FeatureMiscellaneousExtensions2]>; } @@ -102,9 +102,12 @@ def JG : FixedCondBranchRIL; let isIndirectBranch = 1 in { def B : FixedCondBranchRX; - def BR : FixedCondBranchRR; def BI : FixedCondBranchRXY, Requires<[FeatureMiscellaneousExtensions2]>; + def BRAsm : AsmUncondBranchRR<"br", 0x07>; + let isCodeGenOnly = 1 in { + def BR : UncondBranchRR<"br", 0x07, brind>; + } } } @@ -112,7 +115,7 @@ // condition mask set to "never". NOP_bare can't be an InstAlias since it // would need R0D hard coded which is not part of ADDR64BitRegClass. def NOP : InstAlias<"nop\t$XBD", (BCAsm 0, bdxaddr12only:$XBD), 0>; -let isAsmParserOnly = 1, hasNoSchedulingInfo = 1, M1 = 0, XBD2 = 0 in +let isAsmParserOnly = 1, hasNoSchedulingInfo = 1, M1 = 0, X2 = 0, B2 = 0, D2 = 0 in def NOP_bare : InstRXb<0x47,(outs), (ins), "nop", []>; def NOPR : InstAlias<"nopr\t$R", (BCRAsm 0, GR64:$R), 0>; def NOPR_bare : InstAlias<"nopr", (BCRAsm 0, R0D), 0>; @@ -2208,8 +2211,8 @@ // Execute. let hasSideEffects = 1 in { - def EX : SideEffectBinaryRX<"ex", 0x44, ADDR64>; - def EXRL : SideEffectBinaryRILPC<"exrl", 0xC60, ADDR64>; + def EX : SideEffectBinaryRX<"ex", 0x44, GR64>; + def EXRL : SideEffectBinaryRILPC<"exrl", 0xC60, GR64>; let hasNoSchedulingInfo = 1 in def EXRL_Pseudo : Alias<6, (outs), (ins i64imm:$TargetOpc, ADDR64:$lenMinus1, bdaddr12only:$bdl1, bdaddr12only:$bd2), @@ -2237,7 +2240,7 @@ def InsnRIS : DirectiveInsnRIS<(outs), (ins imm64zx48:$enc, AnyReg:$R1, imm32sx8:$I2, imm32zx4:$M3, - bdaddr12only:$BD4), + (bdaddr12only $B4, $D4):$BD4), ".insn ris,$enc,$R1,$I2,$M3,$BD4", []>; def InsnRR : DirectiveInsnRR<(outs), (ins imm64zx16:$enc, AnyReg:$R1, AnyReg:$R2), @@ -2252,15 +2255,15 @@ def InsnRRS : DirectiveInsnRRS<(outs), (ins imm64zx48:$enc, AnyReg:$R1, AnyReg:$R2, imm32zx4:$M3, - bdaddr12only:$BD4), + (bdaddr12only $B4, $D4):$BD4), ".insn rrs,$enc,$R1,$R2,$M3,$BD4", []>; def InsnRS : DirectiveInsnRS<(outs), (ins imm64zx32:$enc, AnyReg:$R1, - AnyReg:$R3, bdaddr12only:$BD2), + AnyReg:$R3, (bdaddr12only $B2, $D2):$BD2), ".insn rs,$enc,$R1,$R3,$BD2", []>; def InsnRSE : DirectiveInsnRSE<(outs), (ins imm64zx48:$enc, AnyReg:$R1, - AnyReg:$R3, bdaddr12only:$BD2), + AnyReg:$R3, (bdaddr12only $B2, $D2):$BD2), ".insn rse,$enc,$R1,$R3,$BD2", []>; def InsnRSI : DirectiveInsnRSI<(outs), (ins imm64zx48:$enc, AnyReg:$R1, @@ -2268,47 +2271,47 @@ ".insn rsi,$enc,$R1,$R3,$RI2", []>; def InsnRSY : DirectiveInsnRSY<(outs), (ins imm64zx48:$enc, AnyReg:$R1, - AnyReg:$R3, bdaddr20only:$BD2), + AnyReg:$R3, (bdaddr20only $B2, $D2):$BD2), ".insn rsy,$enc,$R1,$R3,$BD2", []>; def InsnRX : DirectiveInsnRX<(outs), (ins imm64zx32:$enc, AnyReg:$R1, - bdxaddr12only:$XBD2), + (bdxaddr12only $B2, $D2, $X2):$XBD2), ".insn rx,$enc,$R1,$XBD2", []>; def InsnRXE : DirectiveInsnRXE<(outs), (ins imm64zx48:$enc, AnyReg:$R1, - bdxaddr12only:$XBD2), + (bdxaddr12only $B2, $D2, $X2):$XBD2), ".insn rxe,$enc,$R1,$XBD2", []>; def InsnRXF : DirectiveInsnRXF<(outs), (ins imm64zx48:$enc, AnyReg:$R1, - AnyReg:$R3, bdxaddr12only:$XBD2), + AnyReg:$R3, (bdxaddr12only $B2, $D2, $X2):$XBD2), ".insn rxf,$enc,$R1,$R3,$XBD2", []>; def InsnRXY : DirectiveInsnRXY<(outs), (ins imm64zx48:$enc, AnyReg:$R1, - bdxaddr20only:$XBD2), + (bdxaddr20only $B2, $D2, $X2):$XBD2), ".insn rxy,$enc,$R1,$XBD2", []>; def InsnS : DirectiveInsnS<(outs), - (ins imm64zx32:$enc, bdaddr12only:$BD2), + (ins imm64zx32:$enc, (bdaddr12only $B2, $D2):$BD2), ".insn s,$enc,$BD2", []>; def InsnSI : DirectiveInsnSI<(outs), - (ins imm64zx32:$enc, bdaddr12only:$BD1, + (ins imm64zx32:$enc, (bdaddr12only $B1, $D1):$BD1, imm32sx8:$I2), ".insn si,$enc,$BD1,$I2", []>; def InsnSIY : DirectiveInsnSIY<(outs), (ins imm64zx48:$enc, - bdaddr20only:$BD1, imm32zx8:$I2), + (bdaddr20only $B1, $D1):$BD1, imm32zx8:$I2), ".insn siy,$enc,$BD1,$I2", []>; def InsnSIL : DirectiveInsnSIL<(outs), - (ins imm64zx48:$enc, bdaddr12only:$BD1, + (ins imm64zx48:$enc, (bdaddr12only $B1, $D1):$BD1, imm32zx16:$I2), ".insn sil,$enc,$BD1,$I2", []>; def InsnSS : DirectiveInsnSS<(outs), - (ins imm64zx48:$enc, bdraddr12only:$RBD1, - bdaddr12only:$BD2, AnyReg:$R3), + (ins imm64zx48:$enc, (bdraddr12only $B1, $D1, $R1):$RBD1, + (bdaddr12only $B2, $D2):$BD2, AnyReg:$R3), ".insn ss,$enc,$RBD1,$BD2,$R3", []>; def InsnSSE : DirectiveInsnSSE<(outs), (ins imm64zx48:$enc, - bdaddr12only:$BD1,bdaddr12only:$BD2), + (bdaddr12only $B1, $D1):$BD1,(bdaddr12only $B2, $D2):$BD2), ".insn sse,$enc,$BD1,$BD2", []>; def InsnSSF : DirectiveInsnSSF<(outs), - (ins imm64zx48:$enc, bdaddr12only:$BD1, - bdaddr12only:$BD2, AnyReg:$R3), + (ins imm64zx48:$enc, (bdaddr12only $B1, $D1):$BD1, + (bdaddr12only $B2, $D2):$BD2, AnyReg:$R3), ".insn ssf,$enc,$BD1,$BD2,$R3", []>; def InsnVRI : DirectiveInsnVRI<(outs), (ins imm64zx48:$enc, VR128:$V1, VR128:$V2, @@ -2321,19 +2324,19 @@ ".insn vrr,$enc,$V1,$V2,$V3,$M4,$M5,$M6", []>; def InsnVRS : DirectiveInsnVRS<(outs), (ins imm64zx48:$enc, AnyReg:$R1, VR128:$V3, - bdaddr12only:$BD2, imm32zx4:$M4), + (bdaddr12only $B2, $D2):$BD2, imm32zx4:$M4), ".insn vrs,$enc,$BD2,$M4", []>; def InsnVRV : DirectiveInsnVRV<(outs), (ins imm64zx48:$enc, VR128:$V1, - bdvaddr12only:$VBD2, imm32zx4:$M3), + (bdvaddr12only $B2, $D2, $V2):$VBD2, imm32zx4:$M3), ".insn vrv,$enc,$V1,$VBD2,$M3", []>; def InsnVRX : DirectiveInsnVRX<(outs), (ins imm64zx48:$enc, VR128:$V1, - bdxaddr12only:$XBD2, imm32zx4:$M3), + (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3), ".insn vrx,$enc,$V1,$XBD2,$M3", []>; def InsnVSI : DirectiveInsnVSI<(outs), (ins imm64zx48:$enc, VR128:$V1, - bdaddr12only:$BD2, imm32zx8:$I3), + (bdaddr12only $B2, $D2):$BD2, imm32zx8:$I3), ".insn vsi,$enc,$V1,$BD2,$I3", []>; } diff --git a/llvm/lib/Target/SystemZ/SystemZInstrVector.td b/llvm/lib/Target/SystemZ/SystemZInstrVector.td --- a/llvm/lib/Target/SystemZ/SystemZInstrVector.td +++ b/llvm/lib/Target/SystemZ/SystemZInstrVector.td @@ -113,7 +113,7 @@ // Load count to block boundary. let Defs = [CC] in def LCBB : InstRXE<0xE727, (outs GR32:$R1), - (ins bdxaddr12only:$XBD2, imm32zx4:$M3), + (ins (bdxaddr12only $B2, $D2, $X2):$XBD2, imm32zx4:$M3), "lcbb\t$R1, $XBD2, $M3", [(set GR32:$R1, (int_s390_lcbb bdxaddr12only:$XBD2, imm32zx4_timm:$M3))]>; diff --git a/llvm/lib/Target/SystemZ/SystemZOperands.td b/llvm/lib/Target/SystemZ/SystemZOperands.td --- a/llvm/lib/Target/SystemZ/SystemZOperands.td +++ b/llvm/lib/Target/SystemZ/SystemZOperands.td @@ -105,9 +105,6 @@ string format, dag operands> : Operand("i"#bitsize)> { let PrintMethod = "print"#format#"Operand"; - let EncoderMethod = "get"#format#dispsize#length#"Encoding"; - let DecoderMethod = - "decode"#format#bitsize#"Disp"#dispsize#length#"Operand"; let OperandType = "OPERAND_MEMORY"; let MIOperandInfo = operands; let ParserMatchClass = @@ -151,7 +148,7 @@ "BDLAddr", (ops !cast("ADDR"#bitsize), !cast("disp"#dispsize#"imm"#bitsize), - !cast("imm"#bitsize))>; + !cast("len"#lensize#"imm"#bitsize))>; // A BDMode paired with a register length operand. class BDRMode @@ -507,8 +504,18 @@ return isUInt<64>(N->getZExtValue()); }], UIMM48, "U48Imm">; -let OperandType = "OPERAND_IMMEDIATE" in - def imm64 : ImmLeaf, Operand; +class Imm64 : ImmLeaf, Operand { + let OperandType = "OPERAND_IMMEDIATE"; +} +def imm64 : Imm64; +def len4imm64 : Imm64 { + let EncoderMethod = "getLenEncoding<4>"; + let DecoderMethod = "decodeLenOperand<4>"; +} +def len8imm64 : Imm64 { + let EncoderMethod = "getLenEncoding<8>"; + let DecoderMethod = "decodeLenOperand<8>"; +} //===----------------------------------------------------------------------===// // Floating-point immediates @@ -583,12 +590,18 @@ //===----------------------------------------------------------------------===// // 12-bit displacement operands. -def disp12imm32 : Operand; -def disp12imm64 : Operand; +let EncoderMethod = "getDisp12Encoding", + DecoderMethod = "decodeU12ImmOperand" in { + def disp12imm32 : Operand; + def disp12imm64 : Operand; +} // 20-bit displacement operands. -def disp20imm32 : Operand; -def disp20imm64 : Operand; +let EncoderMethod = "getDisp20Encoding", + DecoderMethod = "decodeS20ImmOperand" in { + def disp20imm32 : Operand; + def disp20imm64 : Operand; +} def BDAddr32Disp12 : AddressAsmOperand<"BDAddr", "32", "12">; def BDAddr32Disp20 : AddressAsmOperand<"BDAddr", "32", "20">; diff --git a/llvm/test/MC/Disassembler/SystemZ/insns.txt b/llvm/test/MC/Disassembler/SystemZ/insns.txt --- a/llvm/test/MC/Disassembler/SystemZ/insns.txt +++ b/llvm/test/MC/Disassembler/SystemZ/insns.txt @@ -1258,6 +1258,9 @@ # CHECK: balr %r0, %r15 0x05 0x0f +# CHECK: balr %r1, %r0 +0x05 0x10 + # CHECK: balr %r14, %r9 0x05 0xe9 @@ -1288,6 +1291,9 @@ # CHECK: basr %r0, %r15 0x0d 0x0f +# CHECK: basr %r1, %r0 +0x0d 0x10 + # CHECK: basr %r14, %r9 0x0d 0xe9 @@ -1300,6 +1306,9 @@ # CHECK: bassm %r0, %r15 0x0c 0x0f +# CHECK: bassm %r1, %r0 +0x0c 0x10 + # CHECK: bassm %r14, %r9 0x0c 0xe9 @@ -1525,6 +1534,9 @@ # CHECK: bsm %r0, %r15 0x0b 0x0f +# CHECK: bsm %r1, %r0 +0x0b 0x10 + # CHECK: bsm %r14, %r9 0x0b 0xe9