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,28 +596,53 @@ 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}; } +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 InstRXa op, dag outs, dag ins, string asmstr, list pattern> : InstSystemZ<4, outs, ins, asmstr, pattern> { field bits<32> Inst; 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 +653,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 +672,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 +696,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 +718,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 +740,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 +763,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 +780,14 @@ 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 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> @@ -2167,7 +2297,7 @@ mnemonic#"\t$R1, $R2", []>; class CallRX opcode> - : InstRXa; class CondBranchRI opcode, @@ -2229,17 +2359,17 @@ } 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 +2377,21 @@ } 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 +2511,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 +2540,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 +2568,14 @@ class CmpBranchRSYb opcode, RegisterOperand cls> - : InstRSYb; class AsmCmpBranchRSYb opcode, RegisterOperand cls> - : InstRSYb; multiclass CmpBranchRSYbPair opcode, @@ -2453,7 +2587,7 @@ class FixedCmpBranchRSYb opcode, RegisterOperand cls> - : InstRSYb { let isAsmParserOnly = V.alternate; let AsmVariantName = V.asmvariant; @@ -2489,14 +2623,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 +2655,7 @@ class BranchBinaryRS opcode, RegisterOperand cls> : InstRSa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; @@ -2527,7 +2663,8 @@ class BranchBinaryRSY opcode, RegisterOperand cls> : InstRSYa { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; @@ -2535,14 +2672,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 +2696,7 @@ class LoadMultipleSSe opcode, RegisterOperand cls> : InstSSe { let mayLoad = 1; } @@ -2567,11 +2704,11 @@ multiclass LoadMultipleVRSaAlign opcode> { let mayLoad = 1 in { def Align : InstVRSa; let M4 = 0 in def "" : InstVRSa; } } @@ -2591,7 +2728,7 @@ class StoreRX opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr12only> - : InstRXa { let OpKey = mnemonic#"r"#cls; @@ -2603,7 +2740,7 @@ class StoreRXY opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr20only> - : InstRXYa { let OpKey = mnemonic#"r"#cls; @@ -2626,7 +2763,8 @@ class StoreVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, bits<4> type = 0> - : InstVRX { let M3 = type; @@ -2635,7 +2773,8 @@ } class StoreVRXGeneric opcode> - : InstVRX { let mayStore = 1; } @@ -2643,17 +2782,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 +2805,8 @@ class StoreLengthVRSd opcode, SDPatternOperator operator, bits<5> bytes> - : InstVRSd { let mayStore = 1; @@ -2672,7 +2815,8 @@ class StoreLengthVSI opcode, SDPatternOperator operator, bits<5> bytes> - : InstVSI { let mayStore = 1; @@ -2681,14 +2825,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; } @@ -2705,12 +2849,13 @@ multiclass StoreMultipleVRSaAlign opcode> { let mayStore = 1 in { - def Align : InstVRSa; let M4 = 0 in def "" : InstVRSa; } } @@ -2723,7 +2868,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 +2876,7 @@ class StoreSIY opcode, SDPatternOperator operator, ImmOpWithPattern imm> - : InstSIY { let mayStore = 1; @@ -2739,7 +2884,7 @@ class StoreSIL opcode, SDPatternOperator operator, ImmOpWithPattern imm> - : InstSIL { let mayStore = 1; @@ -2756,7 +2901,8 @@ } class StoreSSE opcode> - : InstSSE { let mayStore = 1; } @@ -2764,8 +2910,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 +2923,7 @@ class AsmCondStoreRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayStore = 1; let AccessBytes = bytes; @@ -2786,7 +2933,7 @@ class FixedCondStoreRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayStore = 1; let AccessBytes = bytes; @@ -2823,7 +2970,7 @@ class SideEffectUnaryS opcode, SDPatternOperator operator, bits<5> bytes, AddressingMode mode = bdaddr12only> - : InstS { let mayLoad = 1; let AccessBytes = bytes; @@ -2832,7 +2979,7 @@ class SideEffectUnarySIY opcode, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstSIY { let mayLoad = 1; let AccessBytes = bytes; @@ -2842,18 +2989,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 +3083,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 +3117,7 @@ class FixedCondUnaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let Constraints = "$R1 = $R1src"; let DisableEncoding = "$R1src"; @@ -2992,7 +3140,7 @@ class UnaryRX opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr12only> - : InstRXa { let OpKey = mnemonic#"r"#cls; @@ -3003,7 +3151,7 @@ class UnaryRXE opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes> - : InstRXE { let OpKey = mnemonic#"r"#cls; @@ -3016,7 +3164,7 @@ class UnaryRXY opcode, SDPatternOperator operator, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdxaddr20only> - : InstRXYa { let OpKey = mnemonic#"r"#cls; @@ -3110,7 +3258,7 @@ class UnaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, bits<4> type = 0> - : InstVRX { let M3 = type; @@ -3119,7 +3267,8 @@ } class UnaryVRXGeneric opcode> - : InstVRX { let mayLoad = 1; } @@ -3127,22 +3276,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 +3331,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 +3665,8 @@ class BinaryRS opcode, SDPatternOperator operator, RegisterOperand cls> - : InstRSa { let R3 = 0; @@ -3521,7 +3676,7 @@ class BinaryRSY opcode, SDPatternOperator operator, RegisterOperand cls> - : InstRSYa; @@ -3538,7 +3693,7 @@ class BinaryRSL opcode, RegisterOperand cls> : InstRSLb { let mayLoad = 1; } @@ -3546,7 +3701,7 @@ class BinaryRX opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr12only> - : InstRXa { let OpKey = mnemonic#"r"#cls; @@ -3559,7 +3714,8 @@ class BinaryRXE opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> - : InstRXE { @@ -3575,7 +3731,8 @@ class BinaryRXF opcode, SDPatternOperator operator, RegisterOperand cls1, RegisterOperand cls2, SDPatternOperator load, bits<5> bytes> - : InstRXF { let OpKey = mnemonic#"r"#cls; @@ -3587,7 +3744,8 @@ class BinaryRXY opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr20only> - : InstRXYa { let OpKey = mnemonic#"r"#cls; @@ -3613,7 +3771,7 @@ class BinarySI opcode, SDPatternOperator operator, Operand imm, AddressingMode mode = bdaddr12only> - : InstSI { let mayLoad = 1; @@ -3622,7 +3780,7 @@ class BinarySIY opcode, SDPatternOperator operator, Operand imm, AddressingMode mode = bdaddr20only> - : InstSIY { let mayLoad = 1; @@ -3641,7 +3799,8 @@ } class BinarySSF opcode, RegisterOperand cls> - : InstSSF { let mayLoad = 1; } @@ -3849,7 +4008,8 @@ class BinaryVRSa opcode, SDPatternOperator operator, TypedReg tr1, TypedReg tr2, bits<4> type> - : InstVRSa { @@ -3858,12 +4018,13 @@ class BinaryVRSaGeneric opcode> : InstVRSa; class BinaryVRSb opcode, SDPatternOperator operator, bits<5> bytes> - : InstVRSb { let M4 = 0; @@ -3873,20 +4034,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 +4058,8 @@ class BinaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes> - : InstVRX { @@ -3905,7 +4069,7 @@ class StoreBinaryRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> - : InstRSb { let mayStore = 1; let AccessBytes = bytes; @@ -3913,7 +4077,7 @@ class StoreBinaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayStore = 1; let AccessBytes = bytes; @@ -3933,14 +4097,16 @@ class StoreBinaryRSL opcode, RegisterOperand cls> : InstRSLb { let mayStore = 1; } class BinaryVSI opcode, SDPatternOperator operator, bits<5> bytes> - : InstVSI { let mayLoad = 1; @@ -3949,7 +4115,8 @@ class StoreBinaryVRV opcode, bits<5> bytes, ImmOpWithPattern index> - : InstVRV { let mayStore = 1; let AccessBytes = bytes; @@ -3958,7 +4125,8 @@ class StoreBinaryVRX opcode, SDPatternOperator operator, TypedReg tr, bits<5> bytes, ImmOpWithPattern index> - : InstVRX { let mayStore = 1; @@ -3968,7 +4136,8 @@ class MemoryBinarySSd opcode, RegisterOperand cls> : InstSSd; class CompareRR opcode, SDPatternOperator operator, @@ -4023,7 +4192,7 @@ class CompareRX opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr12only> - : InstRXa { let OpKey = mnemonic#"r"#cls; @@ -4035,7 +4204,7 @@ class CompareRXE opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes> - : InstRXE { let OpKey = mnemonic#"r"#cls; @@ -4049,7 +4218,7 @@ class CompareRXY opcode, SDPatternOperator operator, RegisterOperand cls, SDPatternOperator load, bits<5> bytes, AddressingMode mode = bdxaddr20only> - : InstRXYa { let OpKey = mnemonic#"r"#cls; @@ -4074,7 +4243,7 @@ class CompareRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> - : InstRSb { let mayLoad = 1; let AccessBytes = bytes; @@ -4082,7 +4251,7 @@ class CompareRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> - : InstRSYb { let mayLoad = 1; let AccessBytes = bytes; @@ -4100,7 +4269,8 @@ class CompareSSb opcode> : InstSSb { let isCompare = 1; let mayLoad = 1; @@ -4109,7 +4279,7 @@ class CompareSI opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm, AddressingMode mode = bdaddr12only> - : InstSI { let isCompare = 1; @@ -4118,7 +4288,7 @@ class CompareSIL opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm> - : InstSIL { let isCompare = 1; @@ -4128,7 +4298,7 @@ class CompareSIY opcode, SDPatternOperator operator, SDPatternOperator load, ImmOpWithPattern imm, AddressingMode mode = bdaddr20only> - : InstSIY { let isCompare = 1; @@ -4185,12 +4355,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 +4369,12 @@ class TestBinarySIL opcode, SDPatternOperator operator, ImmOpWithPattern imm> - : InstSIL; class TestRSL opcode> - : InstRSLa { let mayLoad = 1; } @@ -4213,8 +4384,8 @@ mnemonic#"\t$V1", []>; class SideEffectTernarySSc opcode> - : InstSSc; class SideEffectTernaryRRFa opcode, @@ -4289,7 +4460,8 @@ class SideEffectTernarySSF opcode, RegisterOperand cls> : InstSSF; class TernaryRRFa opcode, @@ -4328,7 +4500,7 @@ class TernaryRS opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr12only> : InstRSb { let Constraints = "$R1 = $R1src"; @@ -4340,7 +4512,7 @@ class TernaryRSY opcode, RegisterOperand cls, bits<5> bytes, AddressingMode mode = bdaddr20only> : InstRSYb { let Constraints = "$R1 = $R1src"; @@ -4362,19 +4534,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 +4555,7 @@ class SideEffectTernaryMemMemRSY opcode, RegisterOperand cls1, RegisterOperand cls2> : InstRSYa { let Constraints = "$R1 = $R1src, $R3 = $R3src"; let DisableEncoding = "$R1src, $R3src"; @@ -4393,7 +4565,7 @@ RegisterOperand cls1, RegisterOperand cls2, SDPatternOperator load, bits<5> bytes> : InstRXF { @@ -4593,7 +4765,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 +4797,7 @@ class TernaryVRV opcode, bits<5> bytes, ImmOpWithPattern index> : InstVRV { let Constraints = "$V1 = $V1src"; let DisableEncoding = "$V1src"; @@ -4635,7 +4808,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 +4962,8 @@ class CmpSwapRS opcode, SDPatternOperator operator, RegisterOperand cls, AddressingMode mode = bdaddr12only> - : InstRSa { let Constraints = "$R1 = $R1src"; @@ -4799,7 +4974,8 @@ class CmpSwapRSY opcode, SDPatternOperator operator, RegisterOperand cls, AddressingMode mode = bdaddr20only> - : InstRSYa { let Constraints = "$R1 = $R1src"; @@ -4829,7 +5005,8 @@ } class PrefetchRXY opcode, SDPatternOperator operator> - : InstRXYb; @@ -4846,7 +5023,8 @@ class BranchPreloadSMI opcode> : InstSMI; class BranchPreloadMII opcode> @@ -4892,7 +5070,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 +5122,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 +5144,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 +5160,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 +5182,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 +5192,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 +5245,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 +5264,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 +5274,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 +5391,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 @@ -112,7 +112,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>; @@ -2237,7 +2237,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 +2252,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 +2268,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 +2321,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">;