forked from OSchip/llvm-project
ARM: simplify EmitAtomicBinary64
ATOMIC_STORE operations always get here as a lowered ATOMIC_SWAP, so there's no need for any code to handle them specially. There should be no functionality change so no tests. llvm-svn: 203567
This commit is contained in:
parent
c6607cd2a1
commit
445dd58aae
|
@ -3323,12 +3323,6 @@ SDNode *ARMDAGToDAGISel::Select(SDNode *N) {
|
|||
else
|
||||
break;
|
||||
|
||||
case ISD::ATOMIC_STORE:
|
||||
if (cast<AtomicSDNode>(N)->getMemoryVT() == MVT::i64)
|
||||
return SelectAtomic(N, 0, 0, 0, ARM::ATOMIC_STORE_I64);
|
||||
else
|
||||
break;
|
||||
|
||||
case ISD::ATOMIC_LOAD_ADD:
|
||||
return SelectAtomic(N,
|
||||
ARM::ATOMIC_LOAD_ADD_I8,
|
||||
|
|
|
@ -6517,15 +6517,13 @@ ARMTargetLowering::EmitAtomicBinary64(MachineInstr *MI, MachineBasicBlock *BB,
|
|||
MachineFunction::iterator It = BB;
|
||||
++It;
|
||||
|
||||
bool isStore = (MI->getOpcode() == ARM::ATOMIC_STORE_I64);
|
||||
unsigned offset = (isStore ? -2 : 0);
|
||||
unsigned destlo = MI->getOperand(0).getReg();
|
||||
unsigned desthi = MI->getOperand(1).getReg();
|
||||
unsigned ptr = MI->getOperand(offset+2).getReg();
|
||||
unsigned vallo = MI->getOperand(offset+3).getReg();
|
||||
unsigned valhi = MI->getOperand(offset+4).getReg();
|
||||
unsigned OrdIdx = offset + (IsCmpxchg ? 7 : 5);
|
||||
AtomicOrdering Ord = static_cast<AtomicOrdering>(MI->getOperand(OrdIdx).getImm());
|
||||
unsigned ptr = MI->getOperand(2).getReg();
|
||||
unsigned vallo = MI->getOperand(3).getReg();
|
||||
unsigned valhi = MI->getOperand(4).getReg();
|
||||
AtomicOrdering Ord =
|
||||
static_cast<AtomicOrdering>(MI->getOperand(IsCmpxchg ? 7 : 5).getImm());
|
||||
DebugLoc dl = MI->getDebugLoc();
|
||||
bool isThumb2 = Subtarget->isThumb2();
|
||||
|
||||
|
@ -6579,23 +6577,22 @@ ARMTargetLowering::EmitAtomicBinary64(MachineInstr *MI, MachineBasicBlock *BB,
|
|||
// fallthrough --> exitMBB
|
||||
BB = loopMBB;
|
||||
|
||||
if (!isStore) {
|
||||
// Load
|
||||
if (isThumb2) {
|
||||
AddDefaultPred(BuildMI(BB, dl, TII->get(ldrOpc))
|
||||
.addReg(destlo, RegState::Define)
|
||||
.addReg(desthi, RegState::Define)
|
||||
.addReg(ptr));
|
||||
} else {
|
||||
unsigned GPRPair0 = MRI.createVirtualRegister(&ARM::GPRPairRegClass);
|
||||
AddDefaultPred(BuildMI(BB, dl, TII->get(ldrOpc))
|
||||
.addReg(GPRPair0, RegState::Define).addReg(ptr));
|
||||
// Copy r2/r3 into dest. (This copy will normally be coalesced.)
|
||||
BuildMI(BB, dl, TII->get(TargetOpcode::COPY), destlo)
|
||||
// Load
|
||||
if (isThumb2) {
|
||||
AddDefaultPred(BuildMI(BB, dl, TII->get(ldrOpc))
|
||||
.addReg(destlo, RegState::Define)
|
||||
.addReg(desthi, RegState::Define)
|
||||
.addReg(ptr));
|
||||
} else {
|
||||
unsigned GPRPair0 = MRI.createVirtualRegister(&ARM::GPRPairRegClass);
|
||||
AddDefaultPred(BuildMI(BB, dl, TII->get(ldrOpc))
|
||||
.addReg(GPRPair0, RegState::Define)
|
||||
.addReg(ptr));
|
||||
// Copy r2/r3 into dest. (This copy will normally be coalesced.)
|
||||
BuildMI(BB, dl, TII->get(TargetOpcode::COPY), destlo)
|
||||
.addReg(GPRPair0, 0, ARM::gsub_0);
|
||||
BuildMI(BB, dl, TII->get(TargetOpcode::COPY), desthi)
|
||||
BuildMI(BB, dl, TII->get(TargetOpcode::COPY), desthi)
|
||||
.addReg(GPRPair0, 0, ARM::gsub_1);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned StoreLo, StoreHi;
|
||||
|
@ -7761,7 +7758,6 @@ ARMTargetLowering::EmitInstrWithCustomInserter(MachineInstr *MI,
|
|||
case ARM::ATOMIC_LOAD_AND_I64:
|
||||
return EmitAtomicBinary64(MI, BB, isThumb2 ? ARM::t2ANDrr : ARM::ANDrr,
|
||||
isThumb2 ? ARM::t2ANDrr : ARM::ANDrr);
|
||||
case ARM::ATOMIC_STORE_I64:
|
||||
case ARM::ATOMIC_SWAP_I64:
|
||||
return EmitAtomicBinary64(MI, BB, 0, 0, false);
|
||||
case ARM::ATOMIC_CMP_SWAP_I64:
|
||||
|
|
|
@ -4538,11 +4538,6 @@ let usesCustomInserter = 1, Defs = [CPSR] in {
|
|||
(outs GPR:$dst1, GPR:$dst2),
|
||||
(ins GPR:$addr, i32imm:$ordering),
|
||||
NoItinerary, []>;
|
||||
let mayStore = 1 in
|
||||
def ATOMIC_STORE_I64 : PseudoInst<
|
||||
(outs GPR:$dst1, GPR:$dst2),
|
||||
(ins GPR:$addr, GPR:$src1, GPR:$src2, i32imm:$ordering),
|
||||
NoItinerary, []>;
|
||||
}
|
||||
|
||||
let usesCustomInserter = 1 in {
|
||||
|
|
Loading…
Reference in New Issue