Skip to content

Commit cc761a7

Browse files
authored
[PowerPC][NFC] Rename ADDItocL to match the 64-bit naming convention (llvm#85099)
In preparation of adding a similar instruction for large code model on AIX for 32-bit, rename the exisitng ADDItocL 64-instruction to ADDItocL8 to match the naming convention of other instructions with 32-bit and 64-bit variants.
1 parent c3eccf0 commit cc761a7

11 files changed

+32
-31
lines changed

llvm/lib/Target/PowerPC/GISel/PPCInstructionSelector.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,8 @@ bool PPCInstructionSelector::selectConstantPool(
695695
.addReg(HaAddrReg)
696696
.addMemOperand(MMO);
697697
else
698-
// For medium code model, generate ADDItocL(CPI, ADDIStocHA8(X2, CPI))
699-
MI = BuildMI(MBB, I, DbgLoc, TII.get(PPC::ADDItocL), DstReg)
698+
// For medium code model, generate ADDItocL8(CPI, ADDIStocHA8(X2, CPI))
699+
MI = BuildMI(MBB, I, DbgLoc, TII.get(PPC::ADDItocL8), DstReg)
700700
.addReg(HaAddrReg)
701701
.addConstantPoolIndex(CPI);
702702
}

llvm/lib/Target/PowerPC/P10InstrResources.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ def : InstRW<[P10W_FX_3C, P10W_DISP_ANY],
881881
// 3 Cycles ALU operations, 1 input operands
882882
def : InstRW<[P10W_FX_3C, P10W_DISP_ANY, P10FX_Read],
883883
(instrs
884-
ADDI, ADDI8, ADDIdtprelL32, ADDItlsldLADDR32, ADDItocL, LI, LI8,
884+
ADDI, ADDI8, ADDIdtprelL32, ADDItlsldLADDR32, ADDItocL8, LI, LI8,
885885
ADDIC, ADDIC8,
886886
ADDIS, ADDIS8, ADDISdtprelHA32, ADDIStocHA, ADDIStocHA8, LIS, LIS8,
887887
ADDME, ADDME8,

llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,8 +1236,8 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
12361236
EmitToStreamer(*OutStreamer, TmpInst);
12371237
return;
12381238
}
1239-
case PPC::ADDItocL: {
1240-
// Transform %xd = ADDItocL %xs, @sym
1239+
case PPC::ADDItocL8: {
1240+
// Transform %xd = ADDItocL8 %xs, @sym
12411241
LowerPPCMachineInstrToMCInst(MI, TmpInst, *this);
12421242

12431243
// Change the opcode to ADDI8. If the global address is external, then
@@ -1246,7 +1246,7 @@ void PPCAsmPrinter::emitInstruction(const MachineInstr *MI) {
12461246
TmpInst.setOpcode(PPC::ADDI8);
12471247

12481248
const MachineOperand &MO = MI->getOperand(2);
1249-
assert((MO.isGlobal() || MO.isCPI()) && "Invalid operand for ADDItocL.");
1249+
assert((MO.isGlobal() || MO.isCPI()) && "Invalid operand for ADDItocL8.");
12501250

12511251
LLVM_DEBUG(assert(
12521252
!(MO.isGlobal() && Subtarget->isGVIndirectSymbol(MO.getGlobal())) &&

llvm/lib/Target/PowerPC/PPCBack2BackFusion.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ FUSION_FEATURE(GeneralBack2Back, hasBack2BackFusion, -1,
2929
ADDIStocHA8,
3030
ADDIdtprelL32,
3131
ADDItlsldLADDR32,
32-
ADDItocL,
32+
ADDItocL8,
3333
ADDME,
3434
ADDME8,
3535
ADDME8O,
@@ -518,7 +518,7 @@ FUSION_FEATURE(GeneralBack2Back, hasBack2BackFusion, -1,
518518
ADDIStocHA8,
519519
ADDIdtprelL32,
520520
ADDItlsldLADDR32,
521-
ADDItocL,
521+
ADDItocL8,
522522
ADDME,
523523
ADDME8,
524524
ADDME8O,

llvm/lib/Target/PowerPC/PPCFastISel.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,7 +2094,7 @@ unsigned PPCFastISel::PPCMaterializeGV(const GlobalValue *GV, MVT VT) {
20942094
// for large code model, we generate:
20952095
// LDtocL(GV, ADDIStocHA8(%x2, GV))
20962096
// Otherwise we generate:
2097-
// ADDItocL(ADDIStocHA8(%x2, GV), GV)
2097+
// ADDItocL8(ADDIStocHA8(%x2, GV), GV)
20982098
// Either way, start with the ADDIStocHA8:
20992099
Register HighPartReg = createResultReg(RC);
21002100
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, TII.get(PPC::ADDIStocHA8),
@@ -2104,9 +2104,11 @@ unsigned PPCFastISel::PPCMaterializeGV(const GlobalValue *GV, MVT VT) {
21042104
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, TII.get(PPC::LDtocL),
21052105
DestReg).addGlobalAddress(GV).addReg(HighPartReg);
21062106
} else {
2107-
// Otherwise generate the ADDItocL.
2108-
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, TII.get(PPC::ADDItocL),
2109-
DestReg).addReg(HighPartReg).addGlobalAddress(GV);
2107+
// Otherwise generate the ADDItocL8.
2108+
BuildMI(*FuncInfo.MBB, FuncInfo.InsertPt, MIMD, TII.get(PPC::ADDItocL8),
2109+
DestReg)
2110+
.addReg(HighPartReg)
2111+
.addGlobalAddress(GV);
21102112
}
21112113
}
21122114

llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6134,7 +6134,7 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
61346134
// [64-bit ELF/AIX]
61356135
// LDtocL(@sym, ADDIStocHA8(%x2, @sym))
61366136
// Otherwise we generate:
6137-
// ADDItocL(ADDIStocHA8(%x2, @sym), @sym)
6137+
// ADDItocL8(ADDIStocHA8(%x2, @sym), @sym)
61386138
SDValue GA = N->getOperand(0);
61396139
SDValue TOCbase = N->getOperand(1);
61406140

@@ -6154,7 +6154,7 @@ void PPCDAGToDAGISel::Select(SDNode *N) {
61546154
}
61556155

61566156
// Build the address relative to the TOC-pointer.
6157-
ReplaceNode(N, CurDAG->getMachineNode(PPC::ADDItocL, dl, MVT::i64,
6157+
ReplaceNode(N, CurDAG->getMachineNode(PPC::ADDItocL8, dl, MVT::i64,
61586158
SDValue(Tmp, 0), GA));
61596159
return;
61606160
}
@@ -7707,7 +7707,7 @@ void PPCDAGToDAGISel::PeepholePPC64() {
77077707
// target flags on the immediate operand when we fold it into the
77087708
// load instruction.
77097709
//
7710-
// For something like ADDItocL, the relocation information is
7710+
// For something like ADDItocL8, the relocation information is
77117711
// inferred from the opcode; when we process it in the AsmPrinter,
77127712
// we add the necessary relocation there. A load, though, can receive
77137713
// relocation from various flavors of ADDIxxx, so we need to carry
@@ -7728,7 +7728,7 @@ void PPCDAGToDAGISel::PeepholePPC64() {
77287728
case PPC::ADDItlsldL:
77297729
Flags = PPCII::MO_TLSLD_LO;
77307730
break;
7731-
case PPC::ADDItocL:
7731+
case PPC::ADDItocL8:
77327732
Flags = PPCII::MO_TOC_LO;
77337733
break;
77347734
}
@@ -7755,7 +7755,7 @@ void PPCDAGToDAGISel::PeepholePPC64() {
77557755
// If we have a addi(toc@l)/addis(toc@ha) pair, and the addis has only
77567756
// one use, then we can do this for any offset, we just need to also
77577757
// update the offset (i.e. the symbol addend) on the addis also.
7758-
if (Base.getMachineOpcode() != PPC::ADDItocL)
7758+
if (Base.getMachineOpcode() != PPC::ADDItocL8)
77597759
continue;
77607760

77617761
if (!HBase.isMachineOpcode() ||

llvm/lib/Target/PowerPC/PPCInstr64Bit.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1480,8 +1480,8 @@ let hasSideEffects = 0 in {
14801480
let isReMaterializable = 1 in {
14811481
def ADDIStocHA8: PPCEmitTimePseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, tocentry:$disp),
14821482
"#ADDIStocHA8", []>, isPPC64;
1483-
def ADDItocL: PPCEmitTimePseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, tocentry:$disp),
1484-
"#ADDItocL", []>, isPPC64;
1483+
def ADDItocL8: PPCEmitTimePseudo<(outs g8rc:$rD), (ins g8rc_nox0:$reg, tocentry:$disp),
1484+
"#ADDItocL8", []>, isPPC64;
14851485
}
14861486

14871487
// Local Data Transform

llvm/lib/Target/PowerPC/PPCInstrInfo.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,7 +1077,7 @@ bool PPCInstrInfo::isReallyTriviallyReMaterializable(
10771077
case PPC::LIS8:
10781078
case PPC::ADDIStocHA:
10791079
case PPC::ADDIStocHA8:
1080-
case PPC::ADDItocL:
1080+
case PPC::ADDItocL8:
10811081
case PPC::LOAD_STACK_GUARD:
10821082
case PPC::PPCLdFixedAddr:
10831083
case PPC::XXLXORz:
@@ -3453,7 +3453,7 @@ MachineInstr *PPCInstrInfo::getForwardingDefMI(
34533453
break;
34543454
case PPC::LI:
34553455
case PPC::LI8:
3456-
case PPC::ADDItocL:
3456+
case PPC::ADDItocL8:
34573457
case PPC::ADDI:
34583458
case PPC::ADDI8:
34593459
OpNoForForwarding = i;
@@ -4420,7 +4420,7 @@ bool PPCInstrInfo::isDefMIElgibleForForwarding(MachineInstr &DefMI,
44204420
MachineOperand *&ImmMO,
44214421
MachineOperand *&RegMO) const {
44224422
unsigned Opc = DefMI.getOpcode();
4423-
if (Opc != PPC::ADDItocL && Opc != PPC::ADDI && Opc != PPC::ADDI8)
4423+
if (Opc != PPC::ADDItocL8 && Opc != PPC::ADDI && Opc != PPC::ADDI8)
44244424
return false;
44254425

44264426
assert(DefMI.getNumOperands() >= 3 &&
@@ -4485,8 +4485,8 @@ bool PPCInstrInfo::isImmElgibleForForwarding(const MachineOperand &ImmMO,
44854485
int64_t &Imm,
44864486
int64_t BaseImm) const {
44874487
assert(isAnImmediateOperand(ImmMO) && "ImmMO is NOT an immediate");
4488-
if (DefMI.getOpcode() == PPC::ADDItocL) {
4489-
// The operand for ADDItocL is CPI, which isn't imm at compiling time,
4488+
if (DefMI.getOpcode() == PPC::ADDItocL8) {
4489+
// The operand for ADDItocL8 is CPI, which isn't imm at compiling time,
44904490
// However, we know that, it is 16-bit width, and has the alignment of 4.
44914491
// Check if the instruction met the requirement.
44924492
if (III.ImmMustBeMultipleOf > 4 ||
@@ -4899,7 +4899,7 @@ bool PPCInstrInfo::transformToImmFormFedByAdd(
48994899
// register with ImmMO.
49004900
// Before that, we need to fixup the target flags for imm.
49014901
// For some reason, we miss to set the flag for the ImmMO if it is CPI.
4902-
if (DefMI.getOpcode() == PPC::ADDItocL)
4902+
if (DefMI.getOpcode() == PPC::ADDItocL8)
49034903
ImmMO->setTargetFlags(PPCII::MO_TOC_LO);
49044904

49054905
// MI didn't have the interface such as MI.setOperand(i) though

llvm/lib/Target/PowerPC/PPCMacroFusion.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
// {addi} followed by one of these {lxvd2x, lxvw4x, lxvdsx, lvebx, lvehx,
3333
// lvewx, lvx, lxsdx}
3434
FUSION_FEATURE(AddiLoad, hasAddiLoadFusion, 2, \
35-
FUSION_OP_SET(ADDI, ADDI8, ADDItocL), \
35+
FUSION_OP_SET(ADDI, ADDI8, ADDItocL8), \
3636
FUSION_OP_SET(LXVD2X, LXVW4X, LXVDSX, LVEBX, LVEHX, LVEWX, \
3737
LVX, LXSDX))
3838

@@ -135,11 +135,11 @@ FUSION_FEATURE(XorisXori, hasWideImmFusion, 1, FUSION_OP_SET(XORIS, XORIS8),
135135
// addis rx,ra,si - addi rt,rx,SI, SI >= 0
136136
FUSION_FEATURE(AddisAddi, hasWideImmFusion, 1,
137137
FUSION_OP_SET(ADDIS, ADDIS8, ADDIStocHA8),
138-
FUSION_OP_SET(ADDI, ADDI8, ADDItocL))
138+
FUSION_OP_SET(ADDI, ADDI8, ADDItocL8))
139139

140140
// addi rx,ra,si - addis rt,rx,SI, ra > 0, SI >= 2
141141
FUSION_FEATURE(AddiAddis, hasWideImmFusion, 1,
142-
FUSION_OP_SET(ADDI, ADDI8, ADDItocL),
142+
FUSION_OP_SET(ADDI, ADDI8, ADDItocL8),
143143
FUSION_OP_SET(ADDIS, ADDIS8, ADDIStocHA8))
144144

145145
// mtctr - { bcctr,bcctrl }

llvm/lib/Target/PowerPC/PPCTOCRegDeps.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,7 @@ namespace {
9494

9595
protected:
9696
bool hasTOCLoReloc(const MachineInstr &MI) {
97-
if (MI.getOpcode() == PPC::LDtocL ||
98-
MI.getOpcode() == PPC::ADDItocL ||
97+
if (MI.getOpcode() == PPC::LDtocL || MI.getOpcode() == PPC::ADDItocL8 ||
9998
MI.getOpcode() == PPC::LWZtocL)
10099
return true;
101100

llvm/test/CodeGen/PowerPC/remove-copy-crunsetcrbit.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ body: |
130130
%22:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @c
131131
%10:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @e
132132
%13:g8rc_and_g8rc_nox0 = ADDIStocHA8 $x2, @a
133-
%14:g8rc_and_g8rc_nox0 = ADDItocL killed %13, @a, implicit $x2
133+
%14:g8rc_and_g8rc_nox0 = ADDItocL8 killed %13, @a, implicit $x2
134134
135135
bb.2.while.body:
136136
successors: %bb.4(0x30000000), %bb.3(0x50000000)

0 commit comments

Comments
 (0)