mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-19 04:32:19 +00:00
Use X0 instead of R0 for the zero register on ppc64.
The 32-bit R0 cannot be used where a 64-bit register is expected. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@128828 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
92d098642d
commit
2684c5db84
@ -899,7 +899,8 @@ bool PPCTargetLowering::SelectAddressRegImm(SDValue N, SDValue &Disp,
|
||||
short Imm;
|
||||
if (isIntS16Immediate(CN, Imm)) {
|
||||
Disp = DAG.getTargetConstant(Imm, CN->getValueType(0));
|
||||
Base = DAG.getRegister(PPC::R0, CN->getValueType(0));
|
||||
Base = DAG.getRegister(PPCSubTarget.isPPC64() ? PPC::X0 : PPC::R0,
|
||||
CN->getValueType(0));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -947,7 +948,8 @@ bool PPCTargetLowering::SelectAddressRegRegOnly(SDValue N, SDValue &Base,
|
||||
}
|
||||
|
||||
// Otherwise, do it the hard way, using R0 as the base register.
|
||||
Base = DAG.getRegister(PPC::R0, N.getValueType());
|
||||
Base = DAG.getRegister(PPCSubTarget.isPPC64() ? PPC::X0 : PPC::R0,
|
||||
N.getValueType());
|
||||
Index = N;
|
||||
return true;
|
||||
}
|
||||
@ -4571,6 +4573,7 @@ PPCTargetLowering::EmitPartwordAtomicBinary(MachineInstr *MI,
|
||||
// registers without caring whether they're 32 or 64, but here we're
|
||||
// doing actual arithmetic on the addresses.
|
||||
bool is64bit = PPCSubTarget.isPPC64();
|
||||
unsigned ZeroReg = is64bit ? PPC::X0 : PPC::R0;
|
||||
|
||||
const BasicBlock *LLVM_BB = BB->getBasicBlock();
|
||||
MachineFunction *F = BB->getParent();
|
||||
@ -4634,8 +4637,7 @@ PPCTargetLowering::EmitPartwordAtomicBinary(MachineInstr *MI,
|
||||
// bne- loopMBB
|
||||
// fallthrough --> exitMBB
|
||||
// srw dest, tmpDest, shift
|
||||
|
||||
if (ptrA!=PPC::R0) {
|
||||
if (ptrA != ZeroReg) {
|
||||
Ptr1Reg = RegInfo.createVirtualRegister(RC);
|
||||
BuildMI(BB, dl, TII->get(is64bit ? PPC::ADD8 : PPC::ADD4), Ptr1Reg)
|
||||
.addReg(ptrA).addReg(ptrB);
|
||||
@ -4665,7 +4667,7 @@ PPCTargetLowering::EmitPartwordAtomicBinary(MachineInstr *MI,
|
||||
|
||||
BB = loopMBB;
|
||||
BuildMI(BB, dl, TII->get(PPC::LWARX), TmpDestReg)
|
||||
.addReg(PPC::R0).addReg(PtrReg);
|
||||
.addReg(ZeroReg).addReg(PtrReg);
|
||||
if (BinOpcode)
|
||||
BuildMI(BB, dl, TII->get(BinOpcode), TmpReg)
|
||||
.addReg(Incr2Reg).addReg(TmpDestReg);
|
||||
@ -4676,7 +4678,7 @@ PPCTargetLowering::EmitPartwordAtomicBinary(MachineInstr *MI,
|
||||
BuildMI(BB, dl, TII->get(is64bit ? PPC::OR8 : PPC::OR), Tmp4Reg)
|
||||
.addReg(Tmp3Reg).addReg(Tmp2Reg);
|
||||
BuildMI(BB, dl, TII->get(PPC::STWCX))
|
||||
.addReg(Tmp4Reg).addReg(PPC::R0).addReg(PtrReg);
|
||||
.addReg(Tmp4Reg).addReg(ZeroReg).addReg(PtrReg);
|
||||
BuildMI(BB, dl, TII->get(PPC::BCC))
|
||||
.addImm(PPC::PRED_NE).addReg(PPC::CR0).addMBB(loopMBB);
|
||||
BB->addSuccessor(loopMBB);
|
||||
@ -4933,6 +4935,7 @@ PPCTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
||||
unsigned TmpDestReg = RegInfo.createVirtualRegister(RC);
|
||||
unsigned Ptr1Reg;
|
||||
unsigned TmpReg = RegInfo.createVirtualRegister(RC);
|
||||
unsigned ZeroReg = is64bit ? PPC::X0 : PPC::R0;
|
||||
// thisMBB:
|
||||
// ...
|
||||
// fallthrough --> loopMBB
|
||||
@ -4965,7 +4968,7 @@ PPCTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
||||
// stwcx. tmpDest, ptr
|
||||
// exitBB:
|
||||
// srw dest, tmpDest, shift
|
||||
if (ptrA!=PPC::R0) {
|
||||
if (ptrA != ZeroReg) {
|
||||
Ptr1Reg = RegInfo.createVirtualRegister(RC);
|
||||
BuildMI(BB, dl, TII->get(is64bit ? PPC::ADD8 : PPC::ADD4), Ptr1Reg)
|
||||
.addReg(ptrA).addReg(ptrB);
|
||||
@ -5002,7 +5005,7 @@ PPCTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
||||
|
||||
BB = loop1MBB;
|
||||
BuildMI(BB, dl, TII->get(PPC::LWARX), TmpDestReg)
|
||||
.addReg(PPC::R0).addReg(PtrReg);
|
||||
.addReg(ZeroReg).addReg(PtrReg);
|
||||
BuildMI(BB, dl, TII->get(PPC::AND),TmpReg)
|
||||
.addReg(TmpDestReg).addReg(MaskReg);
|
||||
BuildMI(BB, dl, TII->get(PPC::CMPW), PPC::CR0)
|
||||
@ -5018,7 +5021,7 @@ PPCTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
||||
BuildMI(BB, dl, TII->get(PPC::OR),Tmp4Reg)
|
||||
.addReg(Tmp2Reg).addReg(NewVal3Reg);
|
||||
BuildMI(BB, dl, TII->get(PPC::STWCX)).addReg(Tmp4Reg)
|
||||
.addReg(PPC::R0).addReg(PtrReg);
|
||||
.addReg(ZeroReg).addReg(PtrReg);
|
||||
BuildMI(BB, dl, TII->get(PPC::BCC))
|
||||
.addImm(PPC::PRED_NE).addReg(PPC::CR0).addMBB(loop1MBB);
|
||||
BuildMI(BB, dl, TII->get(PPC::B)).addMBB(exitMBB);
|
||||
@ -5027,7 +5030,7 @@ PPCTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
||||
|
||||
BB = midMBB;
|
||||
BuildMI(BB, dl, TII->get(PPC::STWCX)).addReg(TmpDestReg)
|
||||
.addReg(PPC::R0).addReg(PtrReg);
|
||||
.addReg(ZeroReg).addReg(PtrReg);
|
||||
BB->addSuccessor(exitMBB);
|
||||
|
||||
// exitMBB:
|
||||
|
Loading…
x
Reference in New Issue
Block a user