diff --git a/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h b/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h index 84184af6766..f2e5a5ad80f 100644 --- a/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h +++ b/lib/Target/SystemZ/MCTargetDesc/SystemZMCTargetDesc.h @@ -56,6 +56,11 @@ namespace SystemZMC { inline unsigned getRegAsGR64(unsigned Reg) { return GR64Regs[getFirstReg(Reg)]; } + + // Return the given register as a low GR32. + inline unsigned getRegAsGR32(unsigned Reg) { + return GR32Regs[getFirstReg(Reg)]; + } } MCCodeEmitter *createSystemZMCCodeEmitter(const MCInstrInfo &MCII, diff --git a/lib/Target/SystemZ/SystemZAsmPrinter.cpp b/lib/Target/SystemZ/SystemZAsmPrinter.cpp index 3f3ce6bed6a..380fa87eda5 100644 --- a/lib/Target/SystemZ/SystemZAsmPrinter.cpp +++ b/lib/Target/SystemZ/SystemZAsmPrinter.cpp @@ -26,6 +26,15 @@ using namespace llvm; +// Return an RI instruction like MI with opcode Opcode, but with the +// GR64 register operands turned into GR32s. +static MCInst lowerRILow(const MachineInstr *MI, unsigned Opcode) { + return MCInstBuilder(Opcode) + .addReg(SystemZMC::getRegAsGR32(MI->getOperand(0).getReg())) + .addReg(SystemZMC::getRegAsGR32(MI->getOperand(1).getReg())) + .addImm(MI->getOperand(2).getImm()); +} + void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) { SystemZMCInstLower Lower(Mang, MF->getContext(), *this); MCInst LoweredMI; @@ -55,6 +64,27 @@ void SystemZAsmPrinter::EmitInstruction(const MachineInstr *MI) { LoweredMI = MCInstBuilder(SystemZ::BR).addReg(SystemZ::R1D); break; + case SystemZ::IILF64: + LoweredMI = MCInstBuilder(SystemZ::IILF) + .addReg(SystemZMC::getRegAsGR32(MI->getOperand(0).getReg())) + .addImm(MI->getOperand(2).getImm()); + break; + +#define LOWER_LOW(NAME) \ + case SystemZ::NAME##64: LoweredMI = lowerRILow(MI, SystemZ::NAME); break + + LOWER_LOW(IILL); + LOWER_LOW(IILH); + LOWER_LOW(NILL); + LOWER_LOW(NILH); + LOWER_LOW(NILF); + LOWER_LOW(OILL); + LOWER_LOW(OILH); + LOWER_LOW(OILF); + LOWER_LOW(XILF); + +#undef LOWER_LOW + default: Lower.lower(MI, LoweredMI); break; diff --git a/lib/Target/SystemZ/SystemZISelLowering.cpp b/lib/Target/SystemZ/SystemZISelLowering.cpp index eb3dc498746..704c4e57f6d 100644 --- a/lib/Target/SystemZ/SystemZISelLowering.cpp +++ b/lib/Target/SystemZ/SystemZISelLowering.cpp @@ -2330,11 +2330,11 @@ SystemZTargetLowering::emitAtomicLoadBinary(MachineInstr *MI, .addReg(RotatedOldVal).addOperand(Src2); if (BitSize < 32) // XILF with the upper BitSize bits set. - BuildMI(MBB, DL, TII->get(SystemZ::XILF32), RotatedNewVal) + BuildMI(MBB, DL, TII->get(SystemZ::XILF), RotatedNewVal) .addReg(Tmp).addImm(uint32_t(~0 << (32 - BitSize))); else if (BitSize == 32) // XILF with every bit set. - BuildMI(MBB, DL, TII->get(SystemZ::XILF32), RotatedNewVal) + BuildMI(MBB, DL, TII->get(SystemZ::XILF), RotatedNewVal) .addReg(Tmp).addImm(~uint32_t(0)); else { // Use LCGR and add -1 to the result, which is more compact than @@ -2938,96 +2938,96 @@ EmitInstrWithCustomInserter(MachineInstr *MI, MachineBasicBlock *MBB) const { case SystemZ::ATOMIC_LOADW_NR: return emitAtomicLoadBinary(MI, MBB, SystemZ::NR, 0); case SystemZ::ATOMIC_LOADW_NILH: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH32, 0); + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 0); case SystemZ::ATOMIC_LOAD_NR: return emitAtomicLoadBinary(MI, MBB, SystemZ::NR, 32); - case SystemZ::ATOMIC_LOAD_NILL32: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL32, 32); - case SystemZ::ATOMIC_LOAD_NILH32: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH32, 32); - case SystemZ::ATOMIC_LOAD_NILF32: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF32, 32); + case SystemZ::ATOMIC_LOAD_NILL: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL, 32); + case SystemZ::ATOMIC_LOAD_NILH: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 32); + case SystemZ::ATOMIC_LOAD_NILF: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF, 32); case SystemZ::ATOMIC_LOAD_NGR: return emitAtomicLoadBinary(MI, MBB, SystemZ::NGR, 64); - case SystemZ::ATOMIC_LOAD_NILL: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL, 64); - case SystemZ::ATOMIC_LOAD_NILH: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 64); + case SystemZ::ATOMIC_LOAD_NILL64: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL64, 64); + case SystemZ::ATOMIC_LOAD_NILH64: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH64, 64); case SystemZ::ATOMIC_LOAD_NIHL: return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHL, 64); case SystemZ::ATOMIC_LOAD_NIHH: return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHH, 64); - case SystemZ::ATOMIC_LOAD_NILF: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF, 64); + case SystemZ::ATOMIC_LOAD_NILF64: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF64, 64); case SystemZ::ATOMIC_LOAD_NIHF: return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHF, 64); case SystemZ::ATOMIC_LOADW_OR: return emitAtomicLoadBinary(MI, MBB, SystemZ::OR, 0); case SystemZ::ATOMIC_LOADW_OILH: - return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH32, 0); + return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH, 0); case SystemZ::ATOMIC_LOAD_OR: return emitAtomicLoadBinary(MI, MBB, SystemZ::OR, 32); - case SystemZ::ATOMIC_LOAD_OILL32: - return emitAtomicLoadBinary(MI, MBB, SystemZ::OILL32, 32); - case SystemZ::ATOMIC_LOAD_OILH32: - return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH32, 32); - case SystemZ::ATOMIC_LOAD_OILF32: - return emitAtomicLoadBinary(MI, MBB, SystemZ::OILF32, 32); + case SystemZ::ATOMIC_LOAD_OILL: + return emitAtomicLoadBinary(MI, MBB, SystemZ::OILL, 32); + case SystemZ::ATOMIC_LOAD_OILH: + return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH, 32); + case SystemZ::ATOMIC_LOAD_OILF: + return emitAtomicLoadBinary(MI, MBB, SystemZ::OILF, 32); case SystemZ::ATOMIC_LOAD_OGR: return emitAtomicLoadBinary(MI, MBB, SystemZ::OGR, 64); - case SystemZ::ATOMIC_LOAD_OILL: - return emitAtomicLoadBinary(MI, MBB, SystemZ::OILL, 64); - case SystemZ::ATOMIC_LOAD_OILH: - return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH, 64); + case SystemZ::ATOMIC_LOAD_OILL64: + return emitAtomicLoadBinary(MI, MBB, SystemZ::OILL64, 64); + case SystemZ::ATOMIC_LOAD_OILH64: + return emitAtomicLoadBinary(MI, MBB, SystemZ::OILH64, 64); case SystemZ::ATOMIC_LOAD_OIHL: return emitAtomicLoadBinary(MI, MBB, SystemZ::OIHL, 64); case SystemZ::ATOMIC_LOAD_OIHH: return emitAtomicLoadBinary(MI, MBB, SystemZ::OIHH, 64); - case SystemZ::ATOMIC_LOAD_OILF: - return emitAtomicLoadBinary(MI, MBB, SystemZ::OILF, 64); + case SystemZ::ATOMIC_LOAD_OILF64: + return emitAtomicLoadBinary(MI, MBB, SystemZ::OILF64, 64); case SystemZ::ATOMIC_LOAD_OIHF: return emitAtomicLoadBinary(MI, MBB, SystemZ::OIHF, 64); case SystemZ::ATOMIC_LOADW_XR: return emitAtomicLoadBinary(MI, MBB, SystemZ::XR, 0); case SystemZ::ATOMIC_LOADW_XILF: - return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF32, 0); + return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF, 0); case SystemZ::ATOMIC_LOAD_XR: return emitAtomicLoadBinary(MI, MBB, SystemZ::XR, 32); - case SystemZ::ATOMIC_LOAD_XILF32: - return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF32, 32); + case SystemZ::ATOMIC_LOAD_XILF: + return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF, 32); case SystemZ::ATOMIC_LOAD_XGR: return emitAtomicLoadBinary(MI, MBB, SystemZ::XGR, 64); - case SystemZ::ATOMIC_LOAD_XILF: - return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF, 64); + case SystemZ::ATOMIC_LOAD_XILF64: + return emitAtomicLoadBinary(MI, MBB, SystemZ::XILF64, 64); case SystemZ::ATOMIC_LOAD_XIHF: return emitAtomicLoadBinary(MI, MBB, SystemZ::XIHF, 64); case SystemZ::ATOMIC_LOADW_NRi: return emitAtomicLoadBinary(MI, MBB, SystemZ::NR, 0, true); case SystemZ::ATOMIC_LOADW_NILHi: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH32, 0, true); + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 0, true); case SystemZ::ATOMIC_LOAD_NRi: return emitAtomicLoadBinary(MI, MBB, SystemZ::NR, 32, true); - case SystemZ::ATOMIC_LOAD_NILL32i: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL32, 32, true); - case SystemZ::ATOMIC_LOAD_NILH32i: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH32, 32, true); - case SystemZ::ATOMIC_LOAD_NILF32i: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF32, 32, true); + case SystemZ::ATOMIC_LOAD_NILLi: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL, 32, true); + case SystemZ::ATOMIC_LOAD_NILHi: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 32, true); + case SystemZ::ATOMIC_LOAD_NILFi: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF, 32, true); case SystemZ::ATOMIC_LOAD_NGRi: return emitAtomicLoadBinary(MI, MBB, SystemZ::NGR, 64, true); - case SystemZ::ATOMIC_LOAD_NILLi: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL, 64, true); - case SystemZ::ATOMIC_LOAD_NILHi: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH, 64, true); + case SystemZ::ATOMIC_LOAD_NILL64i: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILL64, 64, true); + case SystemZ::ATOMIC_LOAD_NILH64i: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILH64, 64, true); case SystemZ::ATOMIC_LOAD_NIHLi: return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHL, 64, true); case SystemZ::ATOMIC_LOAD_NIHHi: return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHH, 64, true); - case SystemZ::ATOMIC_LOAD_NILFi: - return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF, 64, true); + case SystemZ::ATOMIC_LOAD_NILF64i: + return emitAtomicLoadBinary(MI, MBB, SystemZ::NILF64, 64, true); case SystemZ::ATOMIC_LOAD_NIHFi: return emitAtomicLoadBinary(MI, MBB, SystemZ::NIHF, 64, true); diff --git a/lib/Target/SystemZ/SystemZInstrFormats.td b/lib/Target/SystemZ/SystemZInstrFormats.td index b594f0e771f..a104329a317 100644 --- a/lib/Target/SystemZ/SystemZInstrFormats.td +++ b/lib/Target/SystemZ/SystemZInstrFormats.td @@ -1477,3 +1477,19 @@ class Alias pattern> let isPseudo = 1; let isCodeGenOnly = 1; } + +// An alias of a BinaryRI, but with different register sizes. +class BinaryAliasRI + : Alias<4, (outs cls:$R1), (ins cls:$R1src, imm:$I2), + [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { + let Constraints = "$R1 = $R1src"; +} + +// An alias of a BinaryRIL, but with different register sizes. +class BinaryAliasRIL + : Alias<6, (outs cls:$R1), (ins cls:$R1src, imm:$I2), + [(set cls:$R1, (operator cls:$R1src, imm:$I2))]> { + let Constraints = "$R1 = $R1src"; +} diff --git a/lib/Target/SystemZ/SystemZInstrInfo.cpp b/lib/Target/SystemZ/SystemZInstrInfo.cpp index d20487ad367..6d19bddb38f 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.cpp +++ b/lib/Target/SystemZ/SystemZInstrInfo.cpp @@ -535,14 +535,14 @@ namespace { static LogicOp interpretAndImmediate(unsigned Opcode) { switch (Opcode) { - case SystemZ::NILL32: return LogicOp(32, 0, 16); - case SystemZ::NILH32: return LogicOp(32, 16, 16); - case SystemZ::NILL: return LogicOp(64, 0, 16); - case SystemZ::NILH: return LogicOp(64, 16, 16); + case SystemZ::NILL: return LogicOp(32, 0, 16); + case SystemZ::NILH: return LogicOp(32, 16, 16); + case SystemZ::NILL64: return LogicOp(64, 0, 16); + case SystemZ::NILH64: return LogicOp(64, 16, 16); case SystemZ::NIHL: return LogicOp(64, 32, 16); case SystemZ::NIHH: return LogicOp(64, 48, 16); - case SystemZ::NILF32: return LogicOp(32, 0, 32); - case SystemZ::NILF: return LogicOp(64, 0, 32); + case SystemZ::NILF: return LogicOp(32, 0, 32); + case SystemZ::NILF64: return LogicOp(64, 0, 32); case SystemZ::NIHF: return LogicOp(64, 32, 32); default: return LogicOp(); } diff --git a/lib/Target/SystemZ/SystemZInstrInfo.td b/lib/Target/SystemZ/SystemZInstrInfo.td index ec59e2de701..d2aa2760b54 100644 --- a/lib/Target/SystemZ/SystemZInstrInfo.td +++ b/lib/Target/SystemZ/SystemZInstrInfo.td @@ -570,12 +570,10 @@ defm : InsertMem<"inserti8", ICY, GR64, azextloadi8, bdxaddr20pair>; // Insertions of a 16-bit immediate, leaving other bits unaffected. // We don't have or_as_insert equivalents of these operations because // OI is available instead. -let isCodeGenOnly = 1 in { - def IILL32 : BinaryRI<"iill", 0xA53, insertll, GR32, imm32ll16>; - def IILH32 : BinaryRI<"iilh", 0xA52, insertlh, GR32, imm32lh16>; -} -def IILL : BinaryRI<"iill", 0xA53, insertll, GR64, imm64ll16>; -def IILH : BinaryRI<"iilh", 0xA52, insertlh, GR64, imm64lh16>; +def IILL : BinaryRI<"iill", 0xA53, insertll, GR32, imm32ll16>; +def IILH : BinaryRI<"iilh", 0xA52, insertlh, GR32, imm32lh16>; +def IILL64 : BinaryAliasRI; +def IILH64 : BinaryAliasRI; def IIHL : BinaryRI<"iihl", 0xA51, inserthl, GR64, imm64hl16>; def IIHH : BinaryRI<"iihh", 0xA50, inserthh, GR64, imm64hh16>; @@ -583,11 +581,9 @@ def IIHH : BinaryRI<"iihh", 0xA50, inserthh, GR64, imm64hh16>; // full-width move. (We use IILF rather than something like LLILF // for 32-bit moves because IILF leaves the upper 32 bits of the // GR64 unchanged.) -let isCodeGenOnly = 1, isAsCheapAsAMove = 1, isMoveImm = 1, - isReMaterializable = 1 in { - def IILF32 : UnaryRIL<"iilf", 0xC09, bitconvert, GR32, uimm32>; -} -def IILF : BinaryRIL<"iilf", 0xC09, insertlf, GR64, imm64lf32>; +let isAsCheapAsAMove = 1, isMoveImm = 1, isReMaterializable = 1 in + def IILF : UnaryRIL<"iilf", 0xC09, bitconvert, GR32, uimm32>; +def IILF64 : BinaryAliasRIL; def IIHF : BinaryRIL<"iihf", 0xC08, inserthf, GR64, imm64hf32>; // An alternative model of inserthf, with the first operand being @@ -730,21 +726,19 @@ let Defs = [CC] in { let isConvertibleToThreeAddress = 1 in { // ANDs of a 16-bit immediate, leaving other bits unaffected. // The CC result only reflects the 16-bit field, not the full register. - let isCodeGenOnly = 1 in { - def NILL32 : BinaryRI<"nill", 0xA57, and, GR32, imm32ll16c>; - def NILH32 : BinaryRI<"nilh", 0xA56, and, GR32, imm32lh16c>; - } - def NILL : BinaryRI<"nill", 0xA57, and, GR64, imm64ll16c>; - def NILH : BinaryRI<"nilh", 0xA56, and, GR64, imm64lh16c>; + def NILL : BinaryRI<"nill", 0xA57, and, GR32, imm32ll16c>; + def NILH : BinaryRI<"nilh", 0xA56, and, GR32, imm32lh16c>; + def NILL64 : BinaryAliasRI; + def NILH64 : BinaryAliasRI; def NIHL : BinaryRI<"nihl", 0xA55, and, GR64, imm64hl16c>; def NIHH : BinaryRI<"nihh", 0xA54, and, GR64, imm64hh16c>; // ANDs of a 32-bit immediate, leaving other bits unaffected. // The CC result only reflects the 32-bit field, which means we can // use it as a zero indicator for i32 operations but not otherwise. - let isCodeGenOnly = 1, CCValues = 0xC, CompareZeroCCMask = 0x8 in - def NILF32 : BinaryRIL<"nilf", 0xC0B, and, GR32, uimm32>; - def NILF : BinaryRIL<"nilf", 0xC0B, and, GR64, imm64lf32c>; + let CCValues = 0xC, CompareZeroCCMask = 0x8 in + def NILF : BinaryRIL<"nilf", 0xC0B, and, GR32, uimm32>; + def NILF64 : BinaryAliasRIL; def NIHF : BinaryRIL<"nihf", 0xC0A, and, GR64, imm64hf32c>; } @@ -777,21 +771,19 @@ let Defs = [CC] in { // ORs of a 16-bit immediate, leaving other bits unaffected. // The CC result only reflects the 16-bit field, not the full register. - let isCodeGenOnly = 1 in { - def OILL32 : BinaryRI<"oill", 0xA5B, or, GR32, imm32ll16>; - def OILH32 : BinaryRI<"oilh", 0xA5A, or, GR32, imm32lh16>; - } - def OILL : BinaryRI<"oill", 0xA5B, or, GR64, imm64ll16>; - def OILH : BinaryRI<"oilh", 0xA5A, or, GR64, imm64lh16>; + def OILL : BinaryRI<"oill", 0xA5B, or, GR32, imm32ll16>; + def OILH : BinaryRI<"oilh", 0xA5A, or, GR32, imm32lh16>; + def OILL64 : BinaryAliasRI; + def OILH64 : BinaryAliasRI; def OIHL : BinaryRI<"oihl", 0xA59, or, GR64, imm64hl16>; def OIHH : BinaryRI<"oihh", 0xA58, or, GR64, imm64hh16>; // ORs of a 32-bit immediate, leaving other bits unaffected. // The CC result only reflects the 32-bit field, which means we can // use it as a zero indicator for i32 operations but not otherwise. - let isCodeGenOnly = 1, CCValues = 0xC, CompareZeroCCMask = 0x8 in - def OILF32 : BinaryRIL<"oilf", 0xC0D, or, GR32, uimm32>; - def OILF : BinaryRIL<"oilf", 0xC0D, or, GR64, imm64lf32>; + let CCValues = 0xC, CompareZeroCCMask = 0x8 in + def OILF : BinaryRIL<"oilf", 0xC0D, or, GR32, uimm32>; + def OILF64 : BinaryAliasRIL; def OIHF : BinaryRIL<"oihf", 0xC0C, or, GR64, imm64hf32>; // ORs of memory. @@ -824,9 +816,9 @@ let Defs = [CC] in { // XORs of a 32-bit immediate, leaving other bits unaffected. // The CC result only reflects the 32-bit field, which means we can // use it as a zero indicator for i32 operations but not otherwise. - let isCodeGenOnly = 1, CCValues = 0xC, CompareZeroCCMask = 0x8 in - def XILF32 : BinaryRIL<"xilf", 0xC07, xor, GR32, uimm32>; - def XILF : BinaryRIL<"xilf", 0xC07, xor, GR64, imm64lf32>; + let CCValues = 0xC, CompareZeroCCMask = 0x8 in + def XILF : BinaryRIL<"xilf", 0xC07, xor, GR32, uimm32>; + def XILF64 : BinaryAliasRIL; def XIHF : BinaryRIL<"xihf", 0xC06, xor, GR64, imm64hf32>; // XORs of memory. @@ -1036,18 +1028,16 @@ let mayLoad = 1, Defs = [CC], Uses = [R0W] in // Test under mask. let Defs = [CC] in { - let isCodeGenOnly = 1 in { - def TMLL32 : CompareRI<"tmll", 0xA71, z_tm_reg, GR32, imm32ll16>; - def TMLH32 : CompareRI<"tmlh", 0xA70, z_tm_reg, GR32, imm32lh16>; - } + def TMLL : CompareRI<"tmll", 0xA71, z_tm_reg, GR32, imm32ll16>; + def TMLH : CompareRI<"tmlh", 0xA70, z_tm_reg, GR32, imm32lh16>; - def TMLL : CompareRI<"tmll", 0xA71, z_tm_reg, GR64, imm64ll16>; - def TMLH : CompareRI<"tmlh", 0xA70, z_tm_reg, GR64, imm64lh16>; def TMHL : CompareRI<"tmhl", 0xA73, z_tm_reg, GR64, imm64hl16>; def TMHH : CompareRI<"tmhh", 0xA72, z_tm_reg, GR64, imm64hh16>; defm TM : CompareSIPair<"tm", 0x91, 0xEB51, z_tm_mem, anyextloadi8, imm32zx8>; } +def : CompareGR64RI; +def : CompareGR64RI; //===----------------------------------------------------------------------===// // Prefetch @@ -1080,58 +1070,58 @@ def ATOMIC_LOAD_SGR : AtomicLoadBinaryReg64; def ATOMIC_LOADW_NR : AtomicLoadWBinaryReg; def ATOMIC_LOADW_NILH : AtomicLoadWBinaryImm; def ATOMIC_LOAD_NR : AtomicLoadBinaryReg32; -def ATOMIC_LOAD_NILL32 : AtomicLoadBinaryImm32; -def ATOMIC_LOAD_NILH32 : AtomicLoadBinaryImm32; -def ATOMIC_LOAD_NILF32 : AtomicLoadBinaryImm32; +def ATOMIC_LOAD_NILL : AtomicLoadBinaryImm32; +def ATOMIC_LOAD_NILH : AtomicLoadBinaryImm32; +def ATOMIC_LOAD_NILF : AtomicLoadBinaryImm32; def ATOMIC_LOAD_NGR : AtomicLoadBinaryReg64; -def ATOMIC_LOAD_NILL : AtomicLoadBinaryImm64; -def ATOMIC_LOAD_NILH : AtomicLoadBinaryImm64; +def ATOMIC_LOAD_NILL64 : AtomicLoadBinaryImm64; +def ATOMIC_LOAD_NILH64 : AtomicLoadBinaryImm64; def ATOMIC_LOAD_NIHL : AtomicLoadBinaryImm64; def ATOMIC_LOAD_NIHH : AtomicLoadBinaryImm64; -def ATOMIC_LOAD_NILF : AtomicLoadBinaryImm64; +def ATOMIC_LOAD_NILF64 : AtomicLoadBinaryImm64; def ATOMIC_LOAD_NIHF : AtomicLoadBinaryImm64; def ATOMIC_LOADW_OR : AtomicLoadWBinaryReg; def ATOMIC_LOADW_OILH : AtomicLoadWBinaryImm; def ATOMIC_LOAD_OR : AtomicLoadBinaryReg32; -def ATOMIC_LOAD_OILL32 : AtomicLoadBinaryImm32; -def ATOMIC_LOAD_OILH32 : AtomicLoadBinaryImm32; -def ATOMIC_LOAD_OILF32 : AtomicLoadBinaryImm32; +def ATOMIC_LOAD_OILL : AtomicLoadBinaryImm32; +def ATOMIC_LOAD_OILH : AtomicLoadBinaryImm32; +def ATOMIC_LOAD_OILF : AtomicLoadBinaryImm32; def ATOMIC_LOAD_OGR : AtomicLoadBinaryReg64; -def ATOMIC_LOAD_OILL : AtomicLoadBinaryImm64; -def ATOMIC_LOAD_OILH : AtomicLoadBinaryImm64; +def ATOMIC_LOAD_OILL64 : AtomicLoadBinaryImm64; +def ATOMIC_LOAD_OILH64 : AtomicLoadBinaryImm64; def ATOMIC_LOAD_OIHL : AtomicLoadBinaryImm64; def ATOMIC_LOAD_OIHH : AtomicLoadBinaryImm64; -def ATOMIC_LOAD_OILF : AtomicLoadBinaryImm64; +def ATOMIC_LOAD_OILF64 : AtomicLoadBinaryImm64; def ATOMIC_LOAD_OIHF : AtomicLoadBinaryImm64; def ATOMIC_LOADW_XR : AtomicLoadWBinaryReg; def ATOMIC_LOADW_XILF : AtomicLoadWBinaryImm; def ATOMIC_LOAD_XR : AtomicLoadBinaryReg32; -def ATOMIC_LOAD_XILF32 : AtomicLoadBinaryImm32; +def ATOMIC_LOAD_XILF : AtomicLoadBinaryImm32; def ATOMIC_LOAD_XGR : AtomicLoadBinaryReg64; -def ATOMIC_LOAD_XILF : AtomicLoadBinaryImm64; +def ATOMIC_LOAD_XILF64 : AtomicLoadBinaryImm64; def ATOMIC_LOAD_XIHF : AtomicLoadBinaryImm64; def ATOMIC_LOADW_NRi : AtomicLoadWBinaryReg; def ATOMIC_LOADW_NILHi : AtomicLoadWBinaryImm; def ATOMIC_LOAD_NRi : AtomicLoadBinaryReg32; -def ATOMIC_LOAD_NILL32i : AtomicLoadBinaryImm32; -def ATOMIC_LOAD_NILH32i : AtomicLoadBinaryImm32; -def ATOMIC_LOAD_NILF32i : AtomicLoadBinaryImm32; +def ATOMIC_LOAD_NILFi : AtomicLoadBinaryImm32; def ATOMIC_LOAD_NGRi : AtomicLoadBinaryReg64; -def ATOMIC_LOAD_NILLi : AtomicLoadBinaryImm64; -def ATOMIC_LOAD_NILHi : AtomicLoadBinaryImm64; def ATOMIC_LOAD_NIHLi : AtomicLoadBinaryImm64; def ATOMIC_LOAD_NIHHi : AtomicLoadBinaryImm64; -def ATOMIC_LOAD_NILFi : AtomicLoadBinaryImm64; def ATOMIC_LOAD_NIHFi : AtomicLoadBinaryImm64; diff --git a/lib/Target/SystemZ/SystemZPatterns.td b/lib/Target/SystemZ/SystemZPatterns.td index a1344a3a8e9..203247c5026 100644 --- a/lib/Target/SystemZ/SystemZPatterns.td +++ b/lib/Target/SystemZ/SystemZPatterns.td @@ -112,6 +112,14 @@ multiclass CondStores64; } +// INSN performs a comparison between a 32-bit register and a constant. +// Record that it is equivalent to comparing the low word of a GR64 with IMM. +class CompareGR64RI + : Pat<(compare GR64:$R1, imm:$I2), + (insn (EXTRACT_SUBREG GR64:$R1, subreg_32bit), + (imm.OperandTransform imm:$I2))>; + // Try to use MVC instruction INSN for a load of type LOAD followed by a store // of the same size. VT is the type of the intermediate (legalized) value and // LENGTH is the number of bytes loaded by LOAD. diff --git a/lib/Target/SystemZ/SystemZShortenInst.cpp b/lib/Target/SystemZ/SystemZShortenInst.cpp index 526ae5c1e8c..b4808646717 100644 --- a/lib/Target/SystemZ/SystemZShortenInst.cpp +++ b/lib/Target/SystemZ/SystemZShortenInst.cpp @@ -119,7 +119,7 @@ bool SystemZShortenInst::processBlock(MachineBasicBlock *MBB) { MBBE = MBB->rend(); MBBI != MBBE; ++MBBI) { MachineInstr &MI = *MBBI; unsigned Opcode = MI.getOpcode(); - if (Opcode == SystemZ::IILF32) + if (Opcode == SystemZ::IILF) Changed |= shortenIIF(MI, LowGPRs, LiveHigh, SystemZ::LLILL, SystemZ::LLILH); unsigned UsedLow = 0;