diff --git a/llvm/include/llvm/IR/IntrinsicsPowerPC.td b/llvm/include/llvm/IR/IntrinsicsPowerPC.td --- a/llvm/include/llvm/IR/IntrinsicsPowerPC.td +++ b/llvm/include/llvm/IR/IntrinsicsPowerPC.td @@ -1630,15 +1630,15 @@ Intrinsic<[],[],[]>; def int_ppc_stdcx : ClangBuiltin<"__builtin_ppc_stdcx">, Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i64_ty], - [IntrWriteMem]>; + [IntrWriteMem, IntrArgMemOnly]>; def int_ppc_stwcx : ClangBuiltin<"__builtin_ppc_stwcx">, Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], - [IntrWriteMem]>; - def int_ppc_sthcx - : Intrinsic<[llvm_i32_ty], [ llvm_ptr_ty, llvm_i32_ty ], [IntrWriteMem]>; + [IntrWriteMem, IntrArgMemOnly]>; + def int_ppc_sthcx : Intrinsic<[llvm_i32_ty], [ llvm_ptr_ty, llvm_i32_ty ], + [IntrWriteMem, IntrArgMemOnly]>; def int_ppc_stbcx : ClangBuiltin<"__builtin_ppc_stbcx">, Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_i32_ty], - [IntrWriteMem]>; + [IntrWriteMem, IntrArgMemOnly]>; def int_ppc_dcbtstt : ClangBuiltin<"__builtin_ppc_dcbtstt">, Intrinsic<[], [llvm_ptr_ty], [IntrArgMemOnly, NoCapture>]>; diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.h b/llvm/lib/Target/PowerPC/PPCISelLowering.h --- a/llvm/lib/Target/PowerPC/PPCISelLowering.h +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.h @@ -594,6 +594,11 @@ ATOMIC_CMP_SWAP_8, ATOMIC_CMP_SWAP_16, + /// CHAIN,Glue = STORE_COND CHAIN, GPR, Ptr + /// The store conditional instruction ST[BHWD]ARX that produces a glue + /// result to attach it to a conditional branch. + STORE_COND, + /// GPRC = TOC_ENTRY GA, TOC /// Loads the entry for GA from the TOC, where the TOC base is given by /// the last operand. diff --git a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp --- a/llvm/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/llvm/lib/Target/PowerPC/PPCISelLowering.cpp @@ -1771,6 +1771,8 @@ case PPCISD::STRICT_FCFIDUS: return "PPCISD::STRICT_FCFIDUS"; case PPCISD::LXVRZX: return "PPCISD::LXVRZX"; + case PPCISD::STORE_COND: + return "PPCISD::STORE_COND"; } return nullptr; } @@ -11441,7 +11443,7 @@ // For max/min... // loopMBB: // l[wd]arx dest, ptr - // cmpl?[wd] incr, dest + // cmpl?[wd] dest, incr // bgt exitMBB // loop2MBB: // st[wd]cx. dest, ptr @@ -11454,19 +11456,20 @@ if (BinOpcode) BuildMI(BB, dl, TII->get(BinOpcode), TmpReg).addReg(incr).addReg(dest); if (CmpOpcode) { + Register CrReg = RegInfo.createVirtualRegister(&PPC::CRRCRegClass); // Signed comparisons of byte or halfword values must be sign-extended. if (CmpOpcode == PPC::CMPW && AtomicSize < 4) { Register ExtReg = RegInfo.createVirtualRegister(&PPC::GPRCRegClass); BuildMI(BB, dl, TII->get(AtomicSize == 1 ? PPC::EXTSB : PPC::EXTSH), ExtReg).addReg(dest); - BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0) - .addReg(incr).addReg(ExtReg); + BuildMI(BB, dl, TII->get(CmpOpcode), CrReg).addReg(ExtReg).addReg(incr); } else - BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0) - .addReg(incr).addReg(dest); + BuildMI(BB, dl, TII->get(CmpOpcode), CrReg).addReg(dest).addReg(incr); BuildMI(BB, dl, TII->get(PPC::BCC)) - .addImm(CmpPred).addReg(PPC::CR0).addMBB(exitMBB); + .addImm(CmpPred) + .addReg(CrReg) + .addMBB(exitMBB); BB->addSuccessor(loop2MBB); BB->addSuccessor(exitMBB); BB = loop2MBB; @@ -11699,6 +11702,7 @@ // For unsigned comparisons, we can directly compare the shifted values. // For signed comparisons we shift and sign extend. Register SReg = RegInfo.createVirtualRegister(GPRC); + Register CrReg = RegInfo.createVirtualRegister(&PPC::CRRCRegClass); BuildMI(BB, dl, TII->get(PPC::AND), SReg) .addReg(TmpDestReg) .addReg(MaskReg); @@ -11715,12 +11719,10 @@ ValueReg = ValueSReg; CmpReg = incr; } - BuildMI(BB, dl, TII->get(CmpOpcode), PPC::CR0) - .addReg(CmpReg) - .addReg(ValueReg); + BuildMI(BB, dl, TII->get(CmpOpcode), CrReg).addReg(ValueReg).addReg(CmpReg); BuildMI(BB, dl, TII->get(PPC::BCC)) .addImm(CmpPred) - .addReg(PPC::CR0) + .addReg(CrReg) .addMBB(exitMBB); BB->addSuccessor(loop2MBB); BB->addSuccessor(exitMBB); @@ -12427,40 +12429,40 @@ BB = EmitAtomicBinary(MI, BB, 8, PPC::SUBF8); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MIN_I8) - BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPW, PPC::PRED_GE); + BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPW, PPC::PRED_LT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MIN_I16) - BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPW, PPC::PRED_GE); + BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPW, PPC::PRED_LT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MIN_I32) - BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPW, PPC::PRED_GE); + BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPW, PPC::PRED_LT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MIN_I64) - BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPD, PPC::PRED_GE); + BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPD, PPC::PRED_LT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MAX_I8) - BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPW, PPC::PRED_LE); + BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPW, PPC::PRED_GT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MAX_I16) - BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPW, PPC::PRED_LE); + BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPW, PPC::PRED_GT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MAX_I32) - BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPW, PPC::PRED_LE); + BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPW, PPC::PRED_GT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_MAX_I64) - BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPD, PPC::PRED_LE); + BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPD, PPC::PRED_GT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMIN_I8) - BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPLW, PPC::PRED_GE); + BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPLW, PPC::PRED_LT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMIN_I16) - BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPLW, PPC::PRED_GE); + BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPLW, PPC::PRED_LT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMIN_I32) - BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPLW, PPC::PRED_GE); + BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPLW, PPC::PRED_LT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMIN_I64) - BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPLD, PPC::PRED_GE); + BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPLD, PPC::PRED_LT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMAX_I8) - BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPLW, PPC::PRED_LE); + BB = EmitPartwordAtomicBinary(MI, BB, true, 0, PPC::CMPLW, PPC::PRED_GT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMAX_I16) - BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPLW, PPC::PRED_LE); + BB = EmitPartwordAtomicBinary(MI, BB, false, 0, PPC::CMPLW, PPC::PRED_GT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMAX_I32) - BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPLW, PPC::PRED_LE); + BB = EmitAtomicBinary(MI, BB, 4, 0, PPC::CMPLW, PPC::PRED_GT); else if (MI.getOpcode() == PPC::ATOMIC_LOAD_UMAX_I64) - BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPLD, PPC::PRED_LE); + BB = EmitAtomicBinary(MI, BB, 8, 0, PPC::CMPLD, PPC::PRED_GT); else if (MI.getOpcode() == PPC::ATOMIC_SWAP_I8) BB = EmitPartwordAtomicBinary(MI, BB, true, 0); @@ -12502,20 +12504,20 @@ StoreMnemonic = PPC::STDCX; break; } + MachineRegisterInfo &RegInfo = F->getRegInfo(); Register dest = MI.getOperand(0).getReg(); Register ptrA = MI.getOperand(1).getReg(); Register ptrB = MI.getOperand(2).getReg(); + Register CrReg = RegInfo.createVirtualRegister(&PPC::CRRCRegClass); Register oldval = MI.getOperand(3).getReg(); Register newval = MI.getOperand(4).getReg(); DebugLoc dl = MI.getDebugLoc(); MachineBasicBlock *loop1MBB = F->CreateMachineBasicBlock(LLVM_BB); MachineBasicBlock *loop2MBB = F->CreateMachineBasicBlock(LLVM_BB); - MachineBasicBlock *midMBB = F->CreateMachineBasicBlock(LLVM_BB); MachineBasicBlock *exitMBB = F->CreateMachineBasicBlock(LLVM_BB); F->insert(It, loop1MBB); F->insert(It, loop2MBB); - F->insert(It, midMBB); F->insert(It, exitMBB); exitMBB->splice(exitMBB->begin(), BB, std::next(MachineBasicBlock::iterator(MI)), BB->end()); @@ -12529,25 +12531,23 @@ // loop1MBB: // l[bhwd]arx dest, ptr // cmp[wd] dest, oldval - // bne- midMBB + // bne- exitBB // loop2MBB: // st[bhwd]cx. newval, ptr // bne- loopMBB // b exitBB - // midMBB: - // st[bhwd]cx. dest, ptr // exitBB: BB = loop1MBB; BuildMI(BB, dl, TII->get(LoadMnemonic), dest).addReg(ptrA).addReg(ptrB); - BuildMI(BB, dl, TII->get(is64bit ? PPC::CMPD : PPC::CMPW), PPC::CR0) - .addReg(oldval) - .addReg(dest); + BuildMI(BB, dl, TII->get(is64bit ? PPC::CMPD : PPC::CMPW), CrReg) + .addReg(dest) + .addReg(oldval); BuildMI(BB, dl, TII->get(PPC::BCC)) .addImm(PPC::PRED_NE) - .addReg(PPC::CR0) - .addMBB(midMBB); + .addReg(CrReg) + .addMBB(exitMBB); BB->addSuccessor(loop2MBB); - BB->addSuccessor(midMBB); + BB->addSuccessor(exitMBB); BB = loop2MBB; BuildMI(BB, dl, TII->get(StoreMnemonic)) @@ -12562,13 +12562,6 @@ BB->addSuccessor(loop1MBB); BB->addSuccessor(exitMBB); - BB = midMBB; - BuildMI(BB, dl, TII->get(StoreMnemonic)) - .addReg(dest) - .addReg(ptrA) - .addReg(ptrB); - BB->addSuccessor(exitMBB); - // exitMBB: // ... BB = exitMBB; @@ -12590,11 +12583,9 @@ MachineBasicBlock *loop1MBB = F->CreateMachineBasicBlock(LLVM_BB); MachineBasicBlock *loop2MBB = F->CreateMachineBasicBlock(LLVM_BB); - MachineBasicBlock *midMBB = F->CreateMachineBasicBlock(LLVM_BB); MachineBasicBlock *exitMBB = F->CreateMachineBasicBlock(LLVM_BB); F->insert(It, loop1MBB); F->insert(It, loop2MBB); - F->insert(It, midMBB); F->insert(It, exitMBB); exitMBB->splice(exitMBB->begin(), BB, std::next(MachineBasicBlock::iterator(MI)), BB->end()); @@ -12622,6 +12613,7 @@ Register Ptr1Reg; Register TmpReg = RegInfo.createVirtualRegister(GPRC); Register ZeroReg = is64bit ? PPC::ZERO8 : PPC::ZERO; + Register CrReg = RegInfo.createVirtualRegister(&PPC::CRRCRegClass); // thisMBB: // ... // fallthrough --> loopMBB @@ -12643,15 +12635,13 @@ // lwarx tmpDest, ptr // and tmp, tmpDest, mask // cmpw tmp, oldval3 - // bne- midMBB + // bne- exitBB // loop2MBB: // andc tmp2, tmpDest, mask // or tmp4, tmp2, newval3 // stwcx. tmp4, ptr // bne- loop1MBB // b exitBB - // midMBB: - // stwcx. tmpDest, ptr // exitBB: // srw dest, tmpDest, shift if (ptrA != ZeroReg) { @@ -12716,15 +12706,15 @@ BuildMI(BB, dl, TII->get(PPC::AND), TmpReg) .addReg(TmpDestReg) .addReg(MaskReg); - BuildMI(BB, dl, TII->get(PPC::CMPW), PPC::CR0) + BuildMI(BB, dl, TII->get(PPC::CMPW), CrReg) .addReg(TmpReg) .addReg(OldVal3Reg); BuildMI(BB, dl, TII->get(PPC::BCC)) .addImm(PPC::PRED_NE) - .addReg(PPC::CR0) - .addMBB(midMBB); + .addReg(CrReg) + .addMBB(exitMBB); BB->addSuccessor(loop2MBB); - BB->addSuccessor(midMBB); + BB->addSuccessor(exitMBB); BB = loop2MBB; BuildMI(BB, dl, TII->get(PPC::ANDC), Tmp2Reg) @@ -12745,13 +12735,6 @@ BB->addSuccessor(loop1MBB); BB->addSuccessor(exitMBB); - BB = midMBB; - BuildMI(BB, dl, TII->get(PPC::STWCX)) - .addReg(TmpDestReg) - .addReg(ZeroReg) - .addReg(PtrReg); - BB->addSuccessor(exitMBB); - // exitMBB: // ... BB = exitMBB; @@ -15094,6 +15077,22 @@ llvm_unreachable("Expected a load or store node here"); } +static bool isStoreConditional(SDValue Intrin, unsigned &StoreWidth) { + unsigned IntrinsicID = + cast(Intrin.getOperand(1))->getZExtValue(); + if (IntrinsicID == Intrinsic::ppc_stdcx) + StoreWidth = 8; + else if (IntrinsicID == Intrinsic::ppc_stwcx) + StoreWidth = 4; + else if (IntrinsicID == Intrinsic::ppc_sthcx) + StoreWidth = 2; + else if (IntrinsicID == Intrinsic::ppc_stbcx) + StoreWidth = 1; + else + return false; + return true; +} + SDValue PPCTargetLowering::PerformDAGCombine(SDNode *N, DAGCombinerInfo &DCI) const { SelectionDAG &DAG = DCI.DAG; @@ -15721,20 +15720,28 @@ // that we don't have to do a MFOCRF: instead, branch directly on CR6. This // lowering is done pre-legalize, because the legalizer lowers the predicate // compare down to code that is difficult to reassemble. + // This code also handles branches that depend on the result of a store + // conditional. ISD::CondCode CC = cast(N->getOperand(1))->get(); SDValue LHS = N->getOperand(2), RHS = N->getOperand(3); int CompareOpc; bool isDot; - if (LHS.getOpcode() == ISD::INTRINSIC_WO_CHAIN && - isa(RHS) && (CC == ISD::SETEQ || CC == ISD::SETNE) && - getVectorCompareInfo(LHS, CompareOpc, isDot, Subtarget)) { - assert(isDot && "Can't compare against a vector result!"); + if (!isa(RHS) || (CC != ISD::SETEQ && CC != ISD::SETNE)) + break; + + // Since we are doing this pre-legalize, the RHS can be a constant of + // arbitrary bitwidth which may cause issues when trying to get the value + // from the underlying APInt. + auto RHSAPInt = cast(RHS)->getAPIntValue(); + if (!RHSAPInt.isIntN(64)) + break; + unsigned Val = RHSAPInt.getZExtValue(); + auto isImpossibleCompare = [&]() { // If this is a comparison against something other than 0/1, then we know // that the condition is never/always true. - unsigned Val = cast(RHS)->getZExtValue(); if (Val != 0 && Val != 1) { if (CC == ISD::SETEQ) // Cond never true, remove branch. return N->getOperand(0); @@ -15742,9 +15749,59 @@ return DAG.getNode(ISD::BR, dl, MVT::Other, N->getOperand(0), N->getOperand(4)); } + return SDValue(); + }; + // Combine branches fed by store conditional instructions (st[bhwd]cx). + unsigned StoreWidth = 0; + if (LHS.getOpcode() == ISD::INTRINSIC_W_CHAIN && + isStoreConditional(LHS, StoreWidth)) { + if (SDValue Impossible = isImpossibleCompare()) + return Impossible; + PPC::Predicate CompOpc; + // eq 0 => ne + // ne 0 => eq + // eq 1 => eq + // ne 1 => ne + if (Val == 0) + CompOpc = CC == ISD::SETEQ ? PPC::PRED_NE : PPC::PRED_EQ; + else + CompOpc = CC == ISD::SETEQ ? PPC::PRED_EQ : PPC::PRED_NE; + + SDValue Ops[] = {LHS.getOperand(0), LHS.getOperand(2), LHS.getOperand(3), + DAG.getConstant(StoreWidth, dl, MVT::i32)}; + auto *MemNode = cast(LHS); + SDValue ConstSt = DAG.getMemIntrinsicNode( + PPCISD::STORE_COND, dl, + DAG.getVTList(MVT::i32, MVT::Other, MVT::Glue), Ops, + MemNode->getMemoryVT(), MemNode->getMemOperand()); + + SDValue InChain; + // Unchain the branch from the original store conditional. + if (N->getOperand(0) == LHS.getValue(1)) + InChain = LHS.getOperand(0); + else if (N->getOperand(0).getOpcode() == ISD::TokenFactor) { + SmallVector InChains; + SDValue InTF = N->getOperand(0); + for (int i = 0, e = InTF.getNumOperands(); i < e; i++) + if (InTF.getOperand(i) != LHS.getValue(1)) + InChains.push_back(InTF.getOperand(i)); + InChain = DAG.getNode(ISD::TokenFactor, dl, MVT::Other, InChains); + } - bool BranchOnWhenPredTrue = (CC == ISD::SETEQ) ^ (Val == 0); + return DAG.getNode(PPCISD::COND_BRANCH, dl, MVT::Other, InChain, + DAG.getConstant(CompOpc, dl, MVT::i32), + DAG.getRegister(PPC::CR0, MVT::i32), N->getOperand(4), + ConstSt.getValue(2)); + } + + if (LHS.getOpcode() == ISD::INTRINSIC_WO_CHAIN && + getVectorCompareInfo(LHS, CompareOpc, isDot, Subtarget)) { + assert(isDot && "Can't compare against a vector result!"); + if (SDValue Impossible = isImpossibleCompare()) + return Impossible; + + bool BranchOnWhenPredTrue = (CC == ISD::SETEQ) ^ (Val == 0); // Create the PPCISD altivec 'dot' comparison node. SDValue Ops[] = { LHS.getOperand(2), // LHS of compare @@ -16528,6 +16585,37 @@ Info.flags = MachineMemOperand::MOStore; return true; } + case Intrinsic::ppc_stdcx: + case Intrinsic::ppc_stwcx: + case Intrinsic::ppc_sthcx: + case Intrinsic::ppc_stbcx: { + EVT VT; + auto Alignment = Align(8); + switch (Intrinsic) { + case Intrinsic::ppc_stdcx: + VT = MVT::i64; + break; + case Intrinsic::ppc_stwcx: + VT = MVT::i32; + Alignment = Align(4); + break; + case Intrinsic::ppc_sthcx: + VT = MVT::i16; + Alignment = Align(2); + break; + case Intrinsic::ppc_stbcx: + VT = MVT::i8; + Alignment = Align(1); + break; + } + Info.opc = ISD::INTRINSIC_W_CHAIN; + Info.memVT = VT; + Info.ptrVal = I.getArgOperand(0); + Info.offset = 0; + Info.align = Alignment; + Info.flags = MachineMemOperand::MOStore | MachineMemOperand::MOVolatile; + return true; + } default: break; } diff --git a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td --- a/llvm/lib/Target/PowerPC/PPCInstr64Bit.td +++ b/llvm/lib/Target/PowerPC/PPCInstr64Bit.td @@ -1972,6 +1972,8 @@ def : Pat<(int_ppc_stdcx ForceXForm:$dst, g8rc:$A), (STDCX g8rc:$A, ForceXForm:$dst)>; +def : Pat<(PPCStoreCond ForceXForm:$dst, g8rc:$A, 8), + (STDCX g8rc:$A, ForceXForm:$dst)>; def : Pat<(i64 (int_ppc_mfspr timm:$SPR)), (MFSPR8 $SPR)>; diff --git a/llvm/lib/Target/PowerPC/PPCInstrInfo.td b/llvm/lib/Target/PowerPC/PPCInstrInfo.td --- a/llvm/lib/Target/PowerPC/PPCInstrInfo.td +++ b/llvm/lib/Target/PowerPC/PPCInstrInfo.td @@ -83,6 +83,9 @@ def SDT_PPCstbrx : SDTypeProfile<0, 3, [ SDTCisInt<0>, SDTCisPtrTy<1>, SDTCisVT<2, OtherVT> ]>; +def SDT_StoreCond : SDTypeProfile<0, 3, [ + SDTCisPtrTy<0>, SDTCisInt<1>, SDTCisPtrTy<2> +]>; def SDT_PPCTC_ret : SDTypeProfile<0, 2, [ SDTCisPtrTy<0>, SDTCisVT<1, i32> @@ -375,6 +378,9 @@ [SDNPHasChain, SDNPMayLoad, SDNPMemOperand]>; def PPCstbrx : SDNode<"PPCISD::STBRX", SDT_PPCstbrx, [SDNPHasChain, SDNPMayStore]>; +def PPCStoreCond : SDNode<"PPCISD::STORE_COND", SDT_StoreCond, + [SDNPHasChain, SDNPMayStore, + SDNPMemOperand, SDNPOutGlue]>; // Instructions to set/unset CR bit 6 for SVR4 vararg calls def PPCcr6set : SDNode<"PPCISD::CR6SET", SDTNone, @@ -5083,8 +5089,12 @@ def : Pat<(int_ppc_stwcx ForceXForm:$dst, gprc:$A), (STWCX gprc:$A, ForceXForm:$dst)>; +def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 4), + (STWCX gprc:$A, ForceXForm:$dst)>; def : Pat<(int_ppc_stbcx ForceXForm:$dst, gprc:$A), (STBCX gprc:$A, ForceXForm:$dst)>; +def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 1), + (STBCX gprc:$A, ForceXForm:$dst)>; def : Pat<(int_ppc_fcfid f64:$A), (XSCVSXDDP $A)>; @@ -5114,7 +5124,9 @@ let Predicates = [IsISA2_07] in { def : Pat<(int_ppc_sthcx ForceXForm:$dst, gprc:$A), - (STHCX gprc:$A, ForceXForm:$dst)>; + (STHCX gprc:$A, ForceXForm:$dst)>; + def : Pat<(PPCStoreCond ForceXForm:$dst, gprc:$A, 2), + (STHCX gprc:$A, ForceXForm:$dst)>; } def : Pat<(int_ppc_dcbtstt ForceXForm:$dst), (DCBTST 16, ForceXForm:$dst)>; diff --git a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp --- a/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp +++ b/llvm/lib/Target/PowerPC/PPCTargetTransformInfo.cpp @@ -1371,6 +1371,13 @@ Info.WriteMem = true; return true; } + case Intrinsic::ppc_stdcx: + case Intrinsic::ppc_stwcx: { + Info.PtrVal = Inst->getArgOperand(0); + Info.ReadMem = false; + Info.WriteMem = true; + return true; + } default: break; } diff --git a/llvm/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll b/llvm/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll --- a/llvm/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll +++ b/llvm/test/CodeGen/PowerPC/PR35812-neg-cmpxchg.ll @@ -15,51 +15,48 @@ ; CHECK-NEXT: std 0, 16(1) ; CHECK-NEXT: stdu 1, -48(1) ; CHECK-NEXT: li 3, -32477 -; CHECK-NEXT: li 6, 234 -; CHECK-NEXT: addi 5, 1, 46 +; CHECK-NEXT: li 4, 234 +; CHECK-NEXT: addi 6, 1, 46 ; CHECK-NEXT: sth 3, 46(1) ; CHECK-NEXT: lis 3, 0 -; CHECK-NEXT: ori 4, 3, 33059 +; CHECK-NEXT: ori 3, 3, 33059 ; CHECK-NEXT: sync ; CHECK-NEXT: .LBB0_1: # %L.entry ; CHECK-NEXT: # -; CHECK-NEXT: lharx 3, 0, 5 -; CHECK-NEXT: cmpw 4, 3 +; CHECK-NEXT: lharx 5, 0, 6 +; CHECK-NEXT: cmpw 5, 3 ; CHECK-NEXT: bne 0, .LBB0_3 ; CHECK-NEXT: # %bb.2: # %L.entry ; CHECK-NEXT: # -; CHECK-NEXT: sthcx. 6, 0, 5 +; CHECK-NEXT: sthcx. 4, 0, 6 ; CHECK-NEXT: bne 0, .LBB0_1 -; CHECK-NEXT: b .LBB0_4 ; CHECK-NEXT: .LBB0_3: # %L.entry -; CHECK-NEXT: sthcx. 3, 0, 5 -; CHECK-NEXT: .LBB0_4: # %L.entry -; CHECK-NEXT: cmplwi 3, 33059 +; CHECK-NEXT: cmplwi 5, 33059 ; CHECK-NEXT: lwsync -; CHECK-NEXT: bne 0, .LBB0_7 -; CHECK-NEXT: # %bb.5: # %L.B0000 +; CHECK-NEXT: bne 0, .LBB0_6 +; CHECK-NEXT: # %bb.4: # %L.B0000 ; CHECK-NEXT: lhz 3, 46(1) ; CHECK-NEXT: cmplwi 3, 234 -; CHECK-NEXT: bne 0, .LBB0_8 -; CHECK-NEXT: # %bb.6: # %L.B0001 +; CHECK-NEXT: bne 0, .LBB0_7 +; CHECK-NEXT: # %bb.5: # %L.B0001 ; CHECK-NEXT: addis 3, 2, .Lstr.2@toc@ha ; CHECK-NEXT: addi 3, 3, .Lstr.2@toc@l ; CHECK-NEXT: bl puts ; CHECK-NEXT: nop ; CHECK-NEXT: li 3, 0 -; CHECK-NEXT: b .LBB0_10 -; CHECK-NEXT: .LBB0_7: # %L.B0003 +; CHECK-NEXT: b .LBB0_9 +; CHECK-NEXT: .LBB0_6: # %L.B0003 ; CHECK-NEXT: addis 3, 2, .Lstr@toc@ha ; CHECK-NEXT: addi 3, 3, .Lstr@toc@l -; CHECK-NEXT: b .LBB0_9 -; CHECK-NEXT: .LBB0_8: # %L.B0005 +; CHECK-NEXT: b .LBB0_8 +; CHECK-NEXT: .LBB0_7: # %L.B0005 ; CHECK-NEXT: addis 3, 2, .Lstr.1@toc@ha ; CHECK-NEXT: addi 3, 3, .Lstr.1@toc@l -; CHECK-NEXT: .LBB0_9: # %L.B0003 +; CHECK-NEXT: .LBB0_8: # %L.B0003 ; CHECK-NEXT: bl puts ; CHECK-NEXT: nop ; CHECK-NEXT: li 3, 1 -; CHECK-NEXT: .LBB0_10: # %L.B0003 +; CHECK-NEXT: .LBB0_9: # %L.B0003 ; CHECK-NEXT: addi 1, 1, 48 ; CHECK-NEXT: ld 0, 16(1) ; CHECK-NEXT: mtlr 0 @@ -84,51 +81,48 @@ ; CHECK-P7-NEXT: slw 8, 5, 3 ; CHECK-P7-NEXT: slw 5, 7, 3 ; CHECK-P7-NEXT: rldicr 4, 4, 0, 61 -; CHECK-P7-NEXT: and 7, 6, 5 -; CHECK-P7-NEXT: and 8, 8, 5 +; CHECK-P7-NEXT: and 6, 6, 5 +; CHECK-P7-NEXT: and 7, 8, 5 ; CHECK-P7-NEXT: .LBB0_1: # %L.entry ; CHECK-P7-NEXT: # ; CHECK-P7-NEXT: lwarx 9, 0, 4 -; CHECK-P7-NEXT: and 6, 9, 5 -; CHECK-P7-NEXT: cmpw 6, 8 +; CHECK-P7-NEXT: and 8, 9, 5 +; CHECK-P7-NEXT: cmpw 8, 7 ; CHECK-P7-NEXT: bne 0, .LBB0_3 ; CHECK-P7-NEXT: # %bb.2: # %L.entry ; CHECK-P7-NEXT: # ; CHECK-P7-NEXT: andc 9, 9, 5 -; CHECK-P7-NEXT: or 9, 9, 7 +; CHECK-P7-NEXT: or 9, 9, 6 ; CHECK-P7-NEXT: stwcx. 9, 0, 4 ; CHECK-P7-NEXT: bne 0, .LBB0_1 -; CHECK-P7-NEXT: b .LBB0_4 ; CHECK-P7-NEXT: .LBB0_3: # %L.entry -; CHECK-P7-NEXT: stwcx. 9, 0, 4 -; CHECK-P7-NEXT: .LBB0_4: # %L.entry -; CHECK-P7-NEXT: srw 3, 6, 3 +; CHECK-P7-NEXT: srw 3, 8, 3 ; CHECK-P7-NEXT: lwsync ; CHECK-P7-NEXT: cmplwi 3, 33059 -; CHECK-P7-NEXT: bne 0, .LBB0_7 -; CHECK-P7-NEXT: # %bb.5: # %L.B0000 +; CHECK-P7-NEXT: bne 0, .LBB0_6 +; CHECK-P7-NEXT: # %bb.4: # %L.B0000 ; CHECK-P7-NEXT: lhz 3, 46(1) ; CHECK-P7-NEXT: cmplwi 3, 234 -; CHECK-P7-NEXT: bne 0, .LBB0_8 -; CHECK-P7-NEXT: # %bb.6: # %L.B0001 +; CHECK-P7-NEXT: bne 0, .LBB0_7 +; CHECK-P7-NEXT: # %bb.5: # %L.B0001 ; CHECK-P7-NEXT: addis 3, 2, .Lstr.2@toc@ha ; CHECK-P7-NEXT: addi 3, 3, .Lstr.2@toc@l ; CHECK-P7-NEXT: bl puts ; CHECK-P7-NEXT: nop ; CHECK-P7-NEXT: li 3, 0 -; CHECK-P7-NEXT: b .LBB0_10 -; CHECK-P7-NEXT: .LBB0_7: # %L.B0003 +; CHECK-P7-NEXT: b .LBB0_9 +; CHECK-P7-NEXT: .LBB0_6: # %L.B0003 ; CHECK-P7-NEXT: addis 3, 2, .Lstr@toc@ha ; CHECK-P7-NEXT: addi 3, 3, .Lstr@toc@l -; CHECK-P7-NEXT: b .LBB0_9 -; CHECK-P7-NEXT: .LBB0_8: # %L.B0005 +; CHECK-P7-NEXT: b .LBB0_8 +; CHECK-P7-NEXT: .LBB0_7: # %L.B0005 ; CHECK-P7-NEXT: addis 3, 2, .Lstr.1@toc@ha ; CHECK-P7-NEXT: addi 3, 3, .Lstr.1@toc@l -; CHECK-P7-NEXT: .LBB0_9: # %L.B0003 +; CHECK-P7-NEXT: .LBB0_8: # %L.B0003 ; CHECK-P7-NEXT: bl puts ; CHECK-P7-NEXT: nop ; CHECK-P7-NEXT: li 3, 1 -; CHECK-P7-NEXT: .LBB0_10: # %L.B0003 +; CHECK-P7-NEXT: .LBB0_9: # %L.B0003 ; CHECK-P7-NEXT: addi 1, 1, 48 ; CHECK-P7-NEXT: ld 0, 16(1) ; CHECK-P7-NEXT: mtlr 0 diff --git a/llvm/test/CodeGen/PowerPC/all-atomics.ll b/llvm/test/CodeGen/PowerPC/all-atomics.ll --- a/llvm/test/CodeGen/PowerPC/all-atomics.ll +++ b/llvm/test/CodeGen/PowerPC/all-atomics.ll @@ -4366,330 +4366,282 @@ ; CHECK-NEXT: .LBB3_1: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: lbarx 7, 0, 0 -; CHECK-NEXT: cmpw 5, 7 +; CHECK-NEXT: cmpw 7, 5 ; CHECK-NEXT: bne 0, .LBB3_3 ; CHECK-NEXT: # %bb.2: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stbcx. 8, 0, 0 ; CHECK-NEXT: bne 0, .LBB3_1 -; CHECK-NEXT: b .LBB3_4 ; CHECK-NEXT: .LBB3_3: # %entry -; CHECK-NEXT: stbcx. 7, 0, 0 -; CHECK-NEXT: .LBB3_4: # %entry ; CHECK-NEXT: lwsync ; CHECK-NEXT: stb 7, sc@toc@l(4) ; CHECK-NEXT: lbz 8, uc@toc@l(3) ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_5: # %entry +; CHECK-NEXT: .LBB3_4: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: lbarx 5, 0, 6 -; CHECK-NEXT: cmpw 8, 5 -; CHECK-NEXT: bne 0, .LBB3_7 -; CHECK-NEXT: # %bb.6: # %entry +; CHECK-NEXT: cmpw 5, 8 +; CHECK-NEXT: bne 0, .LBB3_6 +; CHECK-NEXT: # %bb.5: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stbcx. 7, 0, 6 -; CHECK-NEXT: bne 0, .LBB3_5 -; CHECK-NEXT: b .LBB3_8 -; CHECK-NEXT: .LBB3_7: # %entry -; CHECK-NEXT: stbcx. 5, 0, 6 -; CHECK-NEXT: .LBB3_8: # %entry +; CHECK-NEXT: bne 0, .LBB3_4 +; CHECK-NEXT: .LBB3_6: # %entry ; CHECK-NEXT: lwsync ; CHECK-NEXT: addis 7, 2, ss@toc@ha ; CHECK-NEXT: stb 5, uc@toc@l(3) ; CHECK-NEXT: lbz 8, sc@toc@l(4) ; CHECK-NEXT: addi 12, 7, ss@toc@l ; CHECK-NEXT: sync -; CHECK-NEXT: extsb 9, 8 -; CHECK-NEXT: .LBB3_9: # %entry -; CHECK-NEXT: # -; CHECK-NEXT: lharx 8, 0, 12 -; CHECK-NEXT: cmpw 5, 8 -; CHECK-NEXT: bne 0, .LBB3_11 -; CHECK-NEXT: # %bb.10: # %entry +; CHECK-NEXT: extsb 8, 8 +; CHECK-NEXT: .LBB3_7: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: sthcx. 9, 0, 12 +; CHECK-NEXT: lharx 9, 0, 12 +; CHECK-NEXT: cmpw 9, 5 ; CHECK-NEXT: bne 0, .LBB3_9 -; CHECK-NEXT: b .LBB3_12 -; CHECK-NEXT: .LBB3_11: # %entry +; CHECK-NEXT: # %bb.8: # %entry +; CHECK-NEXT: # ; CHECK-NEXT: sthcx. 8, 0, 12 -; CHECK-NEXT: .LBB3_12: # %entry +; CHECK-NEXT: bne 0, .LBB3_7 +; CHECK-NEXT: .LBB3_9: # %entry ; CHECK-NEXT: lwsync -; CHECK-NEXT: sth 8, ss@toc@l(7) -; CHECK-NEXT: addis 5, 2, us@toc@ha +; CHECK-NEXT: sth 9, ss@toc@l(7) +; CHECK-NEXT: addis 7, 2, us@toc@ha ; CHECK-NEXT: lbz 8, sc@toc@l(4) -; CHECK-NEXT: lbz 7, uc@toc@l(3) -; CHECK-NEXT: addi 11, 5, us@toc@l +; CHECK-NEXT: lbz 5, uc@toc@l(3) +; CHECK-NEXT: addi 11, 7, us@toc@l ; CHECK-NEXT: sync -; CHECK-NEXT: extsb 9, 8 -; CHECK-NEXT: .LBB3_13: # %entry +; CHECK-NEXT: extsb 8, 8 +; CHECK-NEXT: .LBB3_10: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lharx 8, 0, 11 -; CHECK-NEXT: cmpw 7, 8 -; CHECK-NEXT: bne 0, .LBB3_15 -; CHECK-NEXT: # %bb.14: # %entry +; CHECK-NEXT: lharx 9, 0, 11 +; CHECK-NEXT: cmpw 9, 5 +; CHECK-NEXT: bne 0, .LBB3_12 +; CHECK-NEXT: # %bb.11: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: sthcx. 9, 0, 11 -; CHECK-NEXT: bne 0, .LBB3_13 -; CHECK-NEXT: b .LBB3_16 -; CHECK-NEXT: .LBB3_15: # %entry ; CHECK-NEXT: sthcx. 8, 0, 11 -; CHECK-NEXT: .LBB3_16: # %entry +; CHECK-NEXT: bne 0, .LBB3_10 +; CHECK-NEXT: .LBB3_12: # %entry ; CHECK-NEXT: lwsync -; CHECK-NEXT: sth 8, us@toc@l(5) -; CHECK-NEXT: addis 5, 2, si@toc@ha +; CHECK-NEXT: sth 9, us@toc@l(7) +; CHECK-NEXT: addis 7, 2, si@toc@ha ; CHECK-NEXT: lbz 8, sc@toc@l(4) -; CHECK-NEXT: lbz 7, uc@toc@l(3) -; CHECK-NEXT: addi 10, 5, si@toc@l +; CHECK-NEXT: lbz 5, uc@toc@l(3) +; CHECK-NEXT: addi 10, 7, si@toc@l ; CHECK-NEXT: sync -; CHECK-NEXT: extsb 9, 8 -; CHECK-NEXT: .LBB3_17: # %entry +; CHECK-NEXT: extsb 8, 8 +; CHECK-NEXT: .LBB3_13: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lwarx 8, 0, 10 -; CHECK-NEXT: cmpw 7, 8 -; CHECK-NEXT: bne 0, .LBB3_19 -; CHECK-NEXT: # %bb.18: # %entry +; CHECK-NEXT: lwarx 9, 0, 10 +; CHECK-NEXT: cmpw 9, 5 +; CHECK-NEXT: bne 0, .LBB3_15 +; CHECK-NEXT: # %bb.14: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stwcx. 9, 0, 10 -; CHECK-NEXT: bne 0, .LBB3_17 -; CHECK-NEXT: b .LBB3_20 -; CHECK-NEXT: .LBB3_19: # %entry ; CHECK-NEXT: stwcx. 8, 0, 10 -; CHECK-NEXT: .LBB3_20: # %entry +; CHECK-NEXT: bne 0, .LBB3_13 +; CHECK-NEXT: .LBB3_15: # %entry ; CHECK-NEXT: lwsync -; CHECK-NEXT: stw 8, si@toc@l(5) +; CHECK-NEXT: stw 9, si@toc@l(7) ; CHECK-NEXT: addis 5, 2, ui@toc@ha ; CHECK-NEXT: lbz 8, sc@toc@l(4) ; CHECK-NEXT: lbz 7, uc@toc@l(3) ; CHECK-NEXT: addi 9, 5, ui@toc@l ; CHECK-NEXT: sync -; CHECK-NEXT: extsb 30, 8 -; CHECK-NEXT: .LBB3_21: # %entry +; CHECK-NEXT: extsb 8, 8 +; CHECK-NEXT: .LBB3_16: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lwarx 8, 0, 9 -; CHECK-NEXT: cmpw 7, 8 -; CHECK-NEXT: bne 0, .LBB3_23 -; CHECK-NEXT: # %bb.22: # %entry +; CHECK-NEXT: lwarx 30, 0, 9 +; CHECK-NEXT: cmpw 30, 7 +; CHECK-NEXT: bne 0, .LBB3_18 +; CHECK-NEXT: # %bb.17: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stwcx. 30, 0, 9 -; CHECK-NEXT: bne 0, .LBB3_21 -; CHECK-NEXT: b .LBB3_24 -; CHECK-NEXT: .LBB3_23: # %entry ; CHECK-NEXT: stwcx. 8, 0, 9 -; CHECK-NEXT: .LBB3_24: # %entry +; CHECK-NEXT: bne 0, .LBB3_16 +; CHECK-NEXT: .LBB3_18: # %entry ; CHECK-NEXT: lwsync -; CHECK-NEXT: stw 8, ui@toc@l(5) -; CHECK-NEXT: addis 7, 2, sll@toc@ha +; CHECK-NEXT: stw 30, ui@toc@l(5) +; CHECK-NEXT: addis 30, 2, sll@toc@ha ; CHECK-NEXT: lbz 8, sc@toc@l(4) -; CHECK-NEXT: lbz 30, uc@toc@l(3) +; CHECK-NEXT: lbz 7, uc@toc@l(3) ; CHECK-NEXT: sync -; CHECK-NEXT: extsb 28, 8 -; CHECK-NEXT: addi 8, 7, sll@toc@l -; CHECK-NEXT: .LBB3_25: # %entry +; CHECK-NEXT: extsb 29, 8 +; CHECK-NEXT: addi 8, 30, sll@toc@l +; CHECK-NEXT: .LBB3_19: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: ldarx 29, 0, 8 -; CHECK-NEXT: cmpd 30, 29 -; CHECK-NEXT: bne 0, .LBB3_27 -; CHECK-NEXT: # %bb.26: # %entry +; CHECK-NEXT: ldarx 28, 0, 8 +; CHECK-NEXT: cmpd 28, 7 +; CHECK-NEXT: bne 0, .LBB3_21 +; CHECK-NEXT: # %bb.20: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stdcx. 28, 0, 8 -; CHECK-NEXT: bne 0, .LBB3_25 -; CHECK-NEXT: b .LBB3_28 -; CHECK-NEXT: .LBB3_27: # %entry ; CHECK-NEXT: stdcx. 29, 0, 8 -; CHECK-NEXT: .LBB3_28: # %entry +; CHECK-NEXT: bne 0, .LBB3_19 +; CHECK-NEXT: .LBB3_21: # %entry ; CHECK-NEXT: lwsync -; CHECK-NEXT: std 29, sll@toc@l(7) -; CHECK-NEXT: addis 30, 2, ull@toc@ha +; CHECK-NEXT: std 28, sll@toc@l(30) +; CHECK-NEXT: addis 29, 2, ull@toc@ha ; CHECK-NEXT: lbz 7, sc@toc@l(4) -; CHECK-NEXT: lbz 29, uc@toc@l(3) +; CHECK-NEXT: lbz 30, uc@toc@l(3) ; CHECK-NEXT: sync -; CHECK-NEXT: extsb 27, 7 -; CHECK-NEXT: addi 7, 30, ull@toc@l -; CHECK-NEXT: .LBB3_29: # %entry +; CHECK-NEXT: extsb 28, 7 +; CHECK-NEXT: addi 7, 29, ull@toc@l +; CHECK-NEXT: .LBB3_22: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: ldarx 28, 0, 7 -; CHECK-NEXT: cmpd 29, 28 -; CHECK-NEXT: bne 0, .LBB3_31 -; CHECK-NEXT: # %bb.30: # %entry +; CHECK-NEXT: ldarx 27, 0, 7 +; CHECK-NEXT: cmpd 27, 30 +; CHECK-NEXT: bne 0, .LBB3_24 +; CHECK-NEXT: # %bb.23: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stdcx. 27, 0, 7 -; CHECK-NEXT: bne 0, .LBB3_29 -; CHECK-NEXT: b .LBB3_32 -; CHECK-NEXT: .LBB3_31: # %entry ; CHECK-NEXT: stdcx. 28, 0, 7 -; CHECK-NEXT: .LBB3_32: # %entry +; CHECK-NEXT: bne 0, .LBB3_22 +; CHECK-NEXT: .LBB3_24: # %entry ; CHECK-NEXT: lwsync -; CHECK-NEXT: std 28, ull@toc@l(30) +; CHECK-NEXT: std 27, ull@toc@l(29) ; CHECK-NEXT: lbz 30, uc@toc@l(3) -; CHECK-NEXT: lbz 28, sc@toc@l(4) +; CHECK-NEXT: lbz 29, sc@toc@l(4) ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_33: # %entry +; CHECK-NEXT: .LBB3_25: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lbarx 29, 0, 0 -; CHECK-NEXT: cmpw 30, 29 -; CHECK-NEXT: bne 0, .LBB3_35 -; CHECK-NEXT: # %bb.34: # %entry +; CHECK-NEXT: lbarx 28, 0, 0 +; CHECK-NEXT: cmpw 28, 30 +; CHECK-NEXT: bne 0, .LBB3_27 +; CHECK-NEXT: # %bb.26: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stbcx. 28, 0, 0 -; CHECK-NEXT: bne 0, .LBB3_33 -; CHECK-NEXT: b .LBB3_36 -; CHECK-NEXT: .LBB3_35: # %entry ; CHECK-NEXT: stbcx. 29, 0, 0 -; CHECK-NEXT: .LBB3_36: # %entry -; CHECK-NEXT: xor 0, 29, 30 +; CHECK-NEXT: bne 0, .LBB3_25 +; CHECK-NEXT: .LBB3_27: # %entry +; CHECK-NEXT: xor 0, 28, 30 ; CHECK-NEXT: lwsync ; CHECK-NEXT: cntlzw 0, 0 -; CHECK-NEXT: lbz 29, sc@toc@l(4) +; CHECK-NEXT: lbz 30, sc@toc@l(4) ; CHECK-NEXT: srwi 0, 0, 5 ; CHECK-NEXT: stw 0, ui@toc@l(5) ; CHECK-NEXT: lbz 0, uc@toc@l(3) ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_37: # %entry +; CHECK-NEXT: .LBB3_28: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lbarx 30, 0, 6 -; CHECK-NEXT: cmpw 0, 30 -; CHECK-NEXT: bne 0, .LBB3_39 -; CHECK-NEXT: # %bb.38: # %entry +; CHECK-NEXT: lbarx 29, 0, 6 +; CHECK-NEXT: cmpw 29, 0 +; CHECK-NEXT: bne 0, .LBB3_30 +; CHECK-NEXT: # %bb.29: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stbcx. 29, 0, 6 -; CHECK-NEXT: bne 0, .LBB3_37 -; CHECK-NEXT: b .LBB3_40 -; CHECK-NEXT: .LBB3_39: # %entry ; CHECK-NEXT: stbcx. 30, 0, 6 -; CHECK-NEXT: .LBB3_40: # %entry -; CHECK-NEXT: xor 6, 30, 0 +; CHECK-NEXT: bne 0, .LBB3_28 +; CHECK-NEXT: .LBB3_30: # %entry +; CHECK-NEXT: xor 6, 29, 0 ; CHECK-NEXT: lwsync ; CHECK-NEXT: cntlzw 6, 6 ; CHECK-NEXT: lbz 0, sc@toc@l(4) ; CHECK-NEXT: srwi 6, 6, 5 ; CHECK-NEXT: stw 6, ui@toc@l(5) ; CHECK-NEXT: lbz 6, uc@toc@l(3) -; CHECK-NEXT: extsb 30, 0 +; CHECK-NEXT: extsb 0, 0 ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_41: # %entry +; CHECK-NEXT: .LBB3_31: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lharx 0, 0, 12 -; CHECK-NEXT: cmpw 6, 0 -; CHECK-NEXT: bne 0, .LBB3_43 -; CHECK-NEXT: # %bb.42: # %entry +; CHECK-NEXT: lharx 30, 0, 12 +; CHECK-NEXT: cmpw 30, 6 +; CHECK-NEXT: bne 0, .LBB3_33 +; CHECK-NEXT: # %bb.32: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: sthcx. 30, 0, 12 -; CHECK-NEXT: bne 0, .LBB3_41 -; CHECK-NEXT: b .LBB3_44 -; CHECK-NEXT: .LBB3_43: # %entry ; CHECK-NEXT: sthcx. 0, 0, 12 -; CHECK-NEXT: .LBB3_44: # %entry -; CHECK-NEXT: xor 6, 0, 6 +; CHECK-NEXT: bne 0, .LBB3_31 +; CHECK-NEXT: .LBB3_33: # %entry +; CHECK-NEXT: xor 6, 30, 6 ; CHECK-NEXT: lwsync ; CHECK-NEXT: cntlzw 6, 6 ; CHECK-NEXT: lbz 12, sc@toc@l(4) ; CHECK-NEXT: srwi 6, 6, 5 ; CHECK-NEXT: stw 6, ui@toc@l(5) ; CHECK-NEXT: lbz 6, uc@toc@l(3) -; CHECK-NEXT: extsb 0, 12 +; CHECK-NEXT: extsb 12, 12 ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_45: # %entry +; CHECK-NEXT: .LBB3_34: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lharx 12, 0, 11 -; CHECK-NEXT: cmpw 6, 12 -; CHECK-NEXT: bne 0, .LBB3_47 -; CHECK-NEXT: # %bb.46: # %entry +; CHECK-NEXT: lharx 0, 0, 11 +; CHECK-NEXT: cmpw 0, 6 +; CHECK-NEXT: bne 0, .LBB3_36 +; CHECK-NEXT: # %bb.35: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: sthcx. 0, 0, 11 -; CHECK-NEXT: bne 0, .LBB3_45 -; CHECK-NEXT: b .LBB3_48 -; CHECK-NEXT: .LBB3_47: # %entry ; CHECK-NEXT: sthcx. 12, 0, 11 -; CHECK-NEXT: .LBB3_48: # %entry -; CHECK-NEXT: xor 6, 12, 6 +; CHECK-NEXT: bne 0, .LBB3_34 +; CHECK-NEXT: .LBB3_36: # %entry +; CHECK-NEXT: xor 6, 0, 6 ; CHECK-NEXT: lwsync ; CHECK-NEXT: cntlzw 6, 6 ; CHECK-NEXT: lbz 11, sc@toc@l(4) ; CHECK-NEXT: srwi 6, 6, 5 ; CHECK-NEXT: stw 6, ui@toc@l(5) ; CHECK-NEXT: lbz 6, uc@toc@l(3) -; CHECK-NEXT: extsb 12, 11 +; CHECK-NEXT: extsb 11, 11 ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_49: # %entry +; CHECK-NEXT: .LBB3_37: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lwarx 11, 0, 10 -; CHECK-NEXT: cmpw 6, 11 -; CHECK-NEXT: bne 0, .LBB3_51 -; CHECK-NEXT: # %bb.50: # %entry +; CHECK-NEXT: lwarx 12, 0, 10 +; CHECK-NEXT: cmpw 12, 6 +; CHECK-NEXT: bne 0, .LBB3_39 +; CHECK-NEXT: # %bb.38: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stwcx. 12, 0, 10 -; CHECK-NEXT: bne 0, .LBB3_49 -; CHECK-NEXT: b .LBB3_52 -; CHECK-NEXT: .LBB3_51: # %entry ; CHECK-NEXT: stwcx. 11, 0, 10 -; CHECK-NEXT: .LBB3_52: # %entry -; CHECK-NEXT: xor 6, 11, 6 +; CHECK-NEXT: bne 0, .LBB3_37 +; CHECK-NEXT: .LBB3_39: # %entry +; CHECK-NEXT: xor 6, 12, 6 ; CHECK-NEXT: lwsync ; CHECK-NEXT: cntlzw 6, 6 ; CHECK-NEXT: lbz 10, sc@toc@l(4) ; CHECK-NEXT: srwi 6, 6, 5 ; CHECK-NEXT: stw 6, ui@toc@l(5) ; CHECK-NEXT: lbz 6, uc@toc@l(3) -; CHECK-NEXT: extsb 11, 10 +; CHECK-NEXT: extsb 10, 10 ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_53: # %entry +; CHECK-NEXT: .LBB3_40: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: lwarx 10, 0, 9 -; CHECK-NEXT: cmpw 6, 10 -; CHECK-NEXT: bne 0, .LBB3_55 -; CHECK-NEXT: # %bb.54: # %entry +; CHECK-NEXT: lwarx 11, 0, 9 +; CHECK-NEXT: cmpw 11, 6 +; CHECK-NEXT: bne 0, .LBB3_42 +; CHECK-NEXT: # %bb.41: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stwcx. 11, 0, 9 -; CHECK-NEXT: bne 0, .LBB3_53 -; CHECK-NEXT: b .LBB3_56 -; CHECK-NEXT: .LBB3_55: # %entry ; CHECK-NEXT: stwcx. 10, 0, 9 -; CHECK-NEXT: .LBB3_56: # %entry -; CHECK-NEXT: xor 6, 10, 6 +; CHECK-NEXT: bne 0, .LBB3_40 +; CHECK-NEXT: .LBB3_42: # %entry +; CHECK-NEXT: xor 6, 11, 6 ; CHECK-NEXT: lwsync ; CHECK-NEXT: cntlzw 6, 6 ; CHECK-NEXT: lbz 9, sc@toc@l(4) ; CHECK-NEXT: srwi 6, 6, 5 ; CHECK-NEXT: stw 6, ui@toc@l(5) ; CHECK-NEXT: lbz 6, uc@toc@l(3) -; CHECK-NEXT: extsb 10, 9 +; CHECK-NEXT: extsb 9, 9 ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_57: # %entry +; CHECK-NEXT: .LBB3_43: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: ldarx 9, 0, 8 -; CHECK-NEXT: cmpd 6, 9 -; CHECK-NEXT: bne 0, .LBB3_59 -; CHECK-NEXT: # %bb.58: # %entry +; CHECK-NEXT: ldarx 10, 0, 8 +; CHECK-NEXT: cmpd 10, 6 +; CHECK-NEXT: bne 0, .LBB3_45 +; CHECK-NEXT: # %bb.44: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stdcx. 10, 0, 8 -; CHECK-NEXT: bne 0, .LBB3_57 -; CHECK-NEXT: b .LBB3_60 -; CHECK-NEXT: .LBB3_59: # %entry ; CHECK-NEXT: stdcx. 9, 0, 8 -; CHECK-NEXT: .LBB3_60: # %entry -; CHECK-NEXT: xor 6, 9, 6 +; CHECK-NEXT: bne 0, .LBB3_43 +; CHECK-NEXT: .LBB3_45: # %entry +; CHECK-NEXT: xor 6, 10, 6 ; CHECK-NEXT: lwsync ; CHECK-NEXT: cntlzd 6, 6 ; CHECK-NEXT: lbz 4, sc@toc@l(4) ; CHECK-NEXT: lbz 3, uc@toc@l(3) ; CHECK-NEXT: rldicl 6, 6, 58, 63 ; CHECK-NEXT: stw 6, ui@toc@l(5) -; CHECK-NEXT: extsb 6, 4 +; CHECK-NEXT: extsb 4, 4 ; CHECK-NEXT: sync -; CHECK-NEXT: .LBB3_61: # %entry +; CHECK-NEXT: .LBB3_46: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: ldarx 4, 0, 7 -; CHECK-NEXT: cmpd 3, 4 -; CHECK-NEXT: bne 0, .LBB3_63 -; CHECK-NEXT: # %bb.62: # %entry +; CHECK-NEXT: ldarx 6, 0, 7 +; CHECK-NEXT: cmpd 6, 3 +; CHECK-NEXT: bne 0, .LBB3_48 +; CHECK-NEXT: # %bb.47: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stdcx. 6, 0, 7 -; CHECK-NEXT: bne 0, .LBB3_61 -; CHECK-NEXT: b .LBB3_64 -; CHECK-NEXT: .LBB3_63: # %entry ; CHECK-NEXT: stdcx. 4, 0, 7 -; CHECK-NEXT: .LBB3_64: # %entry -; CHECK-NEXT: xor 3, 4, 3 +; CHECK-NEXT: bne 0, .LBB3_46 +; CHECK-NEXT: .LBB3_48: # %entry +; CHECK-NEXT: xor 3, 6, 3 ; CHECK-NEXT: lwsync ; CHECK-NEXT: cntlzd 3, 3 ; CHECK-NEXT: ld 30, -16(1) # 8-byte Folded Reload @@ -4720,7 +4672,7 @@ ; AIX32-NEXT: xori 23, 4, 24 ; AIX32-NEXT: li 4, 255 ; AIX32-NEXT: slw 6, 3, 23 -; AIX32-NEXT: slw 7, 5, 23 +; AIX32-NEXT: slw 5, 5, 23 ; AIX32-NEXT: slw 3, 4, 23 ; AIX32-NEXT: stw 20, 80(1) # 4-byte Folded Spill ; AIX32-NEXT: stw 21, 84(1) # 4-byte Folded Spill @@ -4731,28 +4683,25 @@ ; AIX32-NEXT: stw 27, 108(1) # 4-byte Folded Spill ; AIX32-NEXT: stw 30, 120(1) # 4-byte Folded Spill ; AIX32-NEXT: stw 31, 124(1) # 4-byte Folded Spill -; AIX32-NEXT: and 5, 6, 3 -; AIX32-NEXT: and 6, 7, 3 +; AIX32-NEXT: and 4, 6, 3 +; AIX32-NEXT: and 5, 5, 3 ; AIX32-NEXT: sync ; AIX32-NEXT: L..BB3_1: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 7, 0, 19 -; AIX32-NEXT: and 4, 7, 3 -; AIX32-NEXT: cmpw 4, 6 +; AIX32-NEXT: and 6, 7, 3 +; AIX32-NEXT: cmpw 6, 5 ; AIX32-NEXT: bne 0, L..BB3_3 ; AIX32-NEXT: # %bb.2: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: andc 7, 7, 3 -; AIX32-NEXT: or 7, 7, 5 +; AIX32-NEXT: or 7, 7, 4 ; AIX32-NEXT: stwcx. 7, 0, 19 ; AIX32-NEXT: bne 0, L..BB3_1 -; AIX32-NEXT: b L..BB3_4 ; AIX32-NEXT: L..BB3_3: # %entry -; AIX32-NEXT: stwcx. 7, 0, 19 -; AIX32-NEXT: L..BB3_4: # %entry -; AIX32-NEXT: srw 3, 4, 23 ; AIX32-NEXT: lwsync ; AIX32-NEXT: rlwinm 4, 29, 3, 27, 28 +; AIX32-NEXT: srw 3, 6, 23 ; AIX32-NEXT: lbz 5, 0(29) ; AIX32-NEXT: xori 25, 4, 24 ; AIX32-NEXT: stb 3, 0(28) @@ -4764,22 +4713,19 @@ ; AIX32-NEXT: rlwinm 22, 29, 0, 0, 29 ; AIX32-NEXT: and 5, 4, 3 ; AIX32-NEXT: and 6, 6, 3 -; AIX32-NEXT: L..BB3_5: # %entry +; AIX32-NEXT: L..BB3_4: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 7, 0, 22 ; AIX32-NEXT: and 4, 7, 3 ; AIX32-NEXT: cmpw 4, 6 -; AIX32-NEXT: bne 0, L..BB3_7 -; AIX32-NEXT: # %bb.6: # %entry +; AIX32-NEXT: bne 0, L..BB3_6 +; AIX32-NEXT: # %bb.5: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: andc 7, 7, 3 ; AIX32-NEXT: or 7, 7, 5 ; AIX32-NEXT: stwcx. 7, 0, 22 -; AIX32-NEXT: bne 0, L..BB3_5 -; AIX32-NEXT: b L..BB3_8 -; AIX32-NEXT: L..BB3_7: # %entry -; AIX32-NEXT: stwcx. 7, 0, 22 -; AIX32-NEXT: L..BB3_8: # %entry +; AIX32-NEXT: bne 0, L..BB3_4 +; AIX32-NEXT: L..BB3_6: # %entry ; AIX32-NEXT: lwz 3, L..C2(2) # @ss ; AIX32-NEXT: lwsync ; AIX32-NEXT: li 7, 0 @@ -4797,22 +4743,19 @@ ; AIX32-NEXT: rlwinm 20, 3, 0, 0, 29 ; AIX32-NEXT: and 6, 5, 4 ; AIX32-NEXT: and 7, 7, 4 -; AIX32-NEXT: L..BB3_9: # %entry +; AIX32-NEXT: L..BB3_7: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 8, 0, 20 ; AIX32-NEXT: and 5, 8, 4 ; AIX32-NEXT: cmpw 5, 7 -; AIX32-NEXT: bne 0, L..BB3_11 -; AIX32-NEXT: # %bb.10: # %entry +; AIX32-NEXT: bne 0, L..BB3_9 +; AIX32-NEXT: # %bb.8: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: andc 8, 8, 4 ; AIX32-NEXT: or 8, 8, 6 ; AIX32-NEXT: stwcx. 8, 0, 20 -; AIX32-NEXT: bne 0, L..BB3_9 -; AIX32-NEXT: b L..BB3_12 -; AIX32-NEXT: L..BB3_11: # %entry -; AIX32-NEXT: stwcx. 8, 0, 20 -; AIX32-NEXT: L..BB3_12: # %entry +; AIX32-NEXT: bne 0, L..BB3_7 +; AIX32-NEXT: L..BB3_9: # %entry ; AIX32-NEXT: lwz 4, L..C3(2) # @us ; AIX32-NEXT: lwsync ; AIX32-NEXT: srw 5, 5, 24 @@ -4825,72 +4768,63 @@ ; AIX32-NEXT: extsb 6, 6 ; AIX32-NEXT: xori 21, 3, 16 ; AIX32-NEXT: ori 3, 5, 65535 -; AIX32-NEXT: slw 6, 6, 21 +; AIX32-NEXT: slw 5, 6, 21 ; AIX32-NEXT: slw 7, 7, 21 -; AIX32-NEXT: slw 5, 3, 21 +; AIX32-NEXT: slw 3, 3, 21 ; AIX32-NEXT: rlwinm 18, 4, 0, 0, 29 -; AIX32-NEXT: and 6, 6, 5 -; AIX32-NEXT: and 7, 7, 5 -; AIX32-NEXT: L..BB3_13: # %entry +; AIX32-NEXT: and 6, 5, 3 +; AIX32-NEXT: and 7, 7, 3 +; AIX32-NEXT: L..BB3_10: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 8, 0, 18 -; AIX32-NEXT: and 3, 8, 5 -; AIX32-NEXT: cmpw 3, 7 -; AIX32-NEXT: bne 0, L..BB3_15 -; AIX32-NEXT: # %bb.14: # %entry +; AIX32-NEXT: and 5, 8, 3 +; AIX32-NEXT: cmpw 5, 7 +; AIX32-NEXT: bne 0, L..BB3_12 +; AIX32-NEXT: # %bb.11: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: andc 8, 8, 5 +; AIX32-NEXT: andc 8, 8, 3 ; AIX32-NEXT: or 8, 8, 6 ; AIX32-NEXT: stwcx. 8, 0, 18 -; AIX32-NEXT: bne 0, L..BB3_13 -; AIX32-NEXT: b L..BB3_16 -; AIX32-NEXT: L..BB3_15: # %entry -; AIX32-NEXT: stwcx. 8, 0, 18 -; AIX32-NEXT: L..BB3_16: # %entry +; AIX32-NEXT: bne 0, L..BB3_10 +; AIX32-NEXT: L..BB3_12: # %entry ; AIX32-NEXT: lwsync -; AIX32-NEXT: srw 3, 3, 21 +; AIX32-NEXT: srw 3, 5, 21 ; AIX32-NEXT: lwz 17, L..C4(2) # @si ; AIX32-NEXT: lbz 5, 0(28) ; AIX32-NEXT: sth 3, 0(4) ; AIX32-NEXT: lbz 3, 0(29) ; AIX32-NEXT: sync -; AIX32-NEXT: extsb 5, 5 -; AIX32-NEXT: L..BB3_17: # %entry +; AIX32-NEXT: extsb 4, 5 +; AIX32-NEXT: L..BB3_13: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: lwarx 4, 0, 17 -; AIX32-NEXT: cmpw 3, 4 -; AIX32-NEXT: bne 0, L..BB3_19 -; AIX32-NEXT: # %bb.18: # %entry +; AIX32-NEXT: lwarx 5, 0, 17 +; AIX32-NEXT: cmpw 5, 3 +; AIX32-NEXT: bne 0, L..BB3_15 +; AIX32-NEXT: # %bb.14: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: stwcx. 5, 0, 17 -; AIX32-NEXT: bne 0, L..BB3_17 -; AIX32-NEXT: b L..BB3_20 -; AIX32-NEXT: L..BB3_19: # %entry ; AIX32-NEXT: stwcx. 4, 0, 17 -; AIX32-NEXT: L..BB3_20: # %entry +; AIX32-NEXT: bne 0, L..BB3_13 +; AIX32-NEXT: L..BB3_15: # %entry ; AIX32-NEXT: lwsync -; AIX32-NEXT: stw 4, 0(17) ; AIX32-NEXT: lwz 27, L..C5(2) # @ui +; AIX32-NEXT: stw 5, 0(17) ; AIX32-NEXT: lbz 4, 0(28) ; AIX32-NEXT: lbz 3, 0(29) ; AIX32-NEXT: sync -; AIX32-NEXT: extsb 5, 4 -; AIX32-NEXT: L..BB3_21: # %entry +; AIX32-NEXT: extsb 4, 4 +; AIX32-NEXT: L..BB3_16: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: lwarx 4, 0, 27 -; AIX32-NEXT: cmpw 3, 4 -; AIX32-NEXT: bne 0, L..BB3_23 -; AIX32-NEXT: # %bb.22: # %entry +; AIX32-NEXT: lwarx 5, 0, 27 +; AIX32-NEXT: cmpw 5, 3 +; AIX32-NEXT: bne 0, L..BB3_18 +; AIX32-NEXT: # %bb.17: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: stwcx. 5, 0, 27 -; AIX32-NEXT: bne 0, L..BB3_21 -; AIX32-NEXT: b L..BB3_24 -; AIX32-NEXT: L..BB3_23: # %entry ; AIX32-NEXT: stwcx. 4, 0, 27 -; AIX32-NEXT: L..BB3_24: # %entry +; AIX32-NEXT: bne 0, L..BB3_16 +; AIX32-NEXT: L..BB3_18: # %entry ; AIX32-NEXT: lwsync -; AIX32-NEXT: stw 4, 0(27) ; AIX32-NEXT: lwz 31, L..C6(2) # @sll +; AIX32-NEXT: stw 5, 0(27) ; AIX32-NEXT: li 26, 0 ; AIX32-NEXT: li 7, 5 ; AIX32-NEXT: lbz 4, 0(28) @@ -4929,28 +4863,25 @@ ; AIX32-NEXT: li 3, 255 ; AIX32-NEXT: stw 5, 0(30) ; AIX32-NEXT: slw 5, 6, 23 -; AIX32-NEXT: slw 7, 4, 23 +; AIX32-NEXT: slw 6, 4, 23 ; AIX32-NEXT: slw 3, 3, 23 ; AIX32-NEXT: sync -; AIX32-NEXT: and 6, 5, 3 -; AIX32-NEXT: and 7, 7, 3 -; AIX32-NEXT: L..BB3_25: # %entry +; AIX32-NEXT: and 5, 5, 3 +; AIX32-NEXT: and 6, 6, 3 +; AIX32-NEXT: L..BB3_19: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 8, 0, 19 -; AIX32-NEXT: and 5, 8, 3 -; AIX32-NEXT: cmpw 5, 7 -; AIX32-NEXT: bne 0, L..BB3_27 -; AIX32-NEXT: # %bb.26: # %entry +; AIX32-NEXT: and 7, 8, 3 +; AIX32-NEXT: cmpw 7, 6 +; AIX32-NEXT: bne 0, L..BB3_21 +; AIX32-NEXT: # %bb.20: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: andc 8, 8, 3 -; AIX32-NEXT: or 8, 8, 6 -; AIX32-NEXT: stwcx. 8, 0, 19 -; AIX32-NEXT: bne 0, L..BB3_25 -; AIX32-NEXT: b L..BB3_28 -; AIX32-NEXT: L..BB3_27: # %entry +; AIX32-NEXT: or 8, 8, 5 ; AIX32-NEXT: stwcx. 8, 0, 19 -; AIX32-NEXT: L..BB3_28: # %entry -; AIX32-NEXT: srw 5, 5, 23 +; AIX32-NEXT: bne 0, L..BB3_19 +; AIX32-NEXT: L..BB3_21: # %entry +; AIX32-NEXT: srw 5, 7, 23 ; AIX32-NEXT: lwsync ; AIX32-NEXT: li 3, 1 ; AIX32-NEXT: li 7, 255 @@ -4965,22 +4896,19 @@ ; AIX32-NEXT: sync ; AIX32-NEXT: and 7, 5, 6 ; AIX32-NEXT: and 8, 8, 6 -; AIX32-NEXT: L..BB3_29: # %entry +; AIX32-NEXT: L..BB3_22: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 9, 0, 22 ; AIX32-NEXT: and 5, 9, 6 ; AIX32-NEXT: cmpw 5, 8 -; AIX32-NEXT: bne 0, L..BB3_31 -; AIX32-NEXT: # %bb.30: # %entry +; AIX32-NEXT: bne 0, L..BB3_24 +; AIX32-NEXT: # %bb.23: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: andc 9, 9, 6 ; AIX32-NEXT: or 9, 9, 7 ; AIX32-NEXT: stwcx. 9, 0, 22 -; AIX32-NEXT: bne 0, L..BB3_29 -; AIX32-NEXT: b L..BB3_32 -; AIX32-NEXT: L..BB3_31: # %entry -; AIX32-NEXT: stwcx. 9, 0, 22 -; AIX32-NEXT: L..BB3_32: # %entry +; AIX32-NEXT: bne 0, L..BB3_22 +; AIX32-NEXT: L..BB3_24: # %entry ; AIX32-NEXT: lwsync ; AIX32-NEXT: srw 5, 5, 25 ; AIX32-NEXT: lbz 6, 0(28) @@ -4997,22 +4925,19 @@ ; AIX32-NEXT: slw 6, 5, 24 ; AIX32-NEXT: and 7, 7, 6 ; AIX32-NEXT: and 8, 8, 6 -; AIX32-NEXT: L..BB3_33: # %entry +; AIX32-NEXT: L..BB3_25: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 9, 0, 20 ; AIX32-NEXT: and 5, 9, 6 ; AIX32-NEXT: cmpw 5, 8 -; AIX32-NEXT: bne 0, L..BB3_35 -; AIX32-NEXT: # %bb.34: # %entry +; AIX32-NEXT: bne 0, L..BB3_27 +; AIX32-NEXT: # %bb.26: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: andc 9, 9, 6 ; AIX32-NEXT: or 9, 9, 7 ; AIX32-NEXT: stwcx. 9, 0, 20 -; AIX32-NEXT: bne 0, L..BB3_33 -; AIX32-NEXT: b L..BB3_36 -; AIX32-NEXT: L..BB3_35: # %entry -; AIX32-NEXT: stwcx. 9, 0, 20 -; AIX32-NEXT: L..BB3_36: # %entry +; AIX32-NEXT: bne 0, L..BB3_25 +; AIX32-NEXT: L..BB3_27: # %entry ; AIX32-NEXT: lwsync ; AIX32-NEXT: srw 5, 5, 24 ; AIX32-NEXT: lbz 6, 0(28) @@ -5023,77 +4948,66 @@ ; AIX32-NEXT: ori 5, 5, 65535 ; AIX32-NEXT: extsb 6, 6 ; AIX32-NEXT: stw 7, 0(27) -; AIX32-NEXT: slw 7, 6, 21 -; AIX32-NEXT: slw 8, 4, 21 +; AIX32-NEXT: slw 6, 6, 21 +; AIX32-NEXT: slw 7, 4, 21 ; AIX32-NEXT: sync -; AIX32-NEXT: slw 6, 5, 21 -; AIX32-NEXT: and 7, 7, 6 -; AIX32-NEXT: and 8, 8, 6 -; AIX32-NEXT: L..BB3_37: # %entry +; AIX32-NEXT: slw 5, 5, 21 +; AIX32-NEXT: and 6, 6, 5 +; AIX32-NEXT: and 7, 7, 5 +; AIX32-NEXT: L..BB3_28: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 9, 0, 18 -; AIX32-NEXT: and 5, 9, 6 -; AIX32-NEXT: cmpw 5, 8 -; AIX32-NEXT: bne 0, L..BB3_39 -; AIX32-NEXT: # %bb.38: # %entry +; AIX32-NEXT: and 8, 9, 5 +; AIX32-NEXT: cmpw 8, 7 +; AIX32-NEXT: bne 0, L..BB3_30 +; AIX32-NEXT: # %bb.29: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: andc 9, 9, 6 -; AIX32-NEXT: or 9, 9, 7 -; AIX32-NEXT: stwcx. 9, 0, 18 -; AIX32-NEXT: bne 0, L..BB3_37 -; AIX32-NEXT: b L..BB3_40 -; AIX32-NEXT: L..BB3_39: # %entry +; AIX32-NEXT: andc 9, 9, 5 +; AIX32-NEXT: or 9, 9, 6 ; AIX32-NEXT: stwcx. 9, 0, 18 -; AIX32-NEXT: L..BB3_40: # %entry -; AIX32-NEXT: srw 5, 5, 21 +; AIX32-NEXT: bne 0, L..BB3_28 +; AIX32-NEXT: L..BB3_30: # %entry +; AIX32-NEXT: srw 5, 8, 21 ; AIX32-NEXT: lwsync ; AIX32-NEXT: cmpw 5, 4 ; AIX32-NEXT: lbz 5, 0(28) ; AIX32-NEXT: iseleq 4, 3, 26 ; AIX32-NEXT: stw 4, 0(27) ; AIX32-NEXT: lbz 4, 0(29) -; AIX32-NEXT: extsb 6, 5 +; AIX32-NEXT: extsb 5, 5 ; AIX32-NEXT: sync -; AIX32-NEXT: L..BB3_41: # %entry +; AIX32-NEXT: L..BB3_31: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: lwarx 5, 0, 17 -; AIX32-NEXT: cmpw 4, 5 -; AIX32-NEXT: bne 0, L..BB3_43 -; AIX32-NEXT: # %bb.42: # %entry +; AIX32-NEXT: lwarx 6, 0, 17 +; AIX32-NEXT: cmpw 1, 6, 4 +; AIX32-NEXT: bne 1, L..BB3_33 +; AIX32-NEXT: # %bb.32: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: stwcx. 6, 0, 17 -; AIX32-NEXT: bne 0, L..BB3_41 -; AIX32-NEXT: b L..BB3_44 -; AIX32-NEXT: L..BB3_43: # %entry ; AIX32-NEXT: stwcx. 5, 0, 17 -; AIX32-NEXT: L..BB3_44: # %entry -; AIX32-NEXT: cmpw 5, 4 +; AIX32-NEXT: bne 0, L..BB3_31 +; AIX32-NEXT: L..BB3_33: # %entry ; AIX32-NEXT: lwsync -; AIX32-NEXT: iseleq 4, 3, 26 +; AIX32-NEXT: isel 4, 3, 26, 6 ; AIX32-NEXT: lbz 5, 0(28) ; AIX32-NEXT: stw 4, 0(27) ; AIX32-NEXT: lbz 4, 0(29) -; AIX32-NEXT: extsb 6, 5 ; AIX32-NEXT: sync -; AIX32-NEXT: L..BB3_45: # %entry +; AIX32-NEXT: extsb 5, 5 +; AIX32-NEXT: L..BB3_34: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: lwarx 5, 0, 27 -; AIX32-NEXT: cmpw 4, 5 -; AIX32-NEXT: bne 0, L..BB3_47 -; AIX32-NEXT: # %bb.46: # %entry +; AIX32-NEXT: lwarx 6, 0, 27 +; AIX32-NEXT: cmpw 1, 6, 4 +; AIX32-NEXT: bne 1, L..BB3_36 +; AIX32-NEXT: # %bb.35: # %entry ; AIX32-NEXT: # -; AIX32-NEXT: stwcx. 6, 0, 27 -; AIX32-NEXT: bne 0, L..BB3_45 -; AIX32-NEXT: b L..BB3_48 -; AIX32-NEXT: L..BB3_47: # %entry ; AIX32-NEXT: stwcx. 5, 0, 27 -; AIX32-NEXT: L..BB3_48: # %entry +; AIX32-NEXT: bne 0, L..BB3_34 +; AIX32-NEXT: L..BB3_36: # %entry ; AIX32-NEXT: lwsync -; AIX32-NEXT: cmpw 5, 4 +; AIX32-NEXT: isel 3, 3, 26, 6 ; AIX32-NEXT: li 7, 5 ; AIX32-NEXT: li 8, 5 ; AIX32-NEXT: lbz 4, 0(28) -; AIX32-NEXT: iseleq 3, 3, 26 ; AIX32-NEXT: lbz 9, 0(29) ; AIX32-NEXT: stw 3, 0(27) ; AIX32-NEXT: mr 3, 31 @@ -5583,8 +5497,8 @@ ; CHECK-NEXT: .LBB5_1: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: lwarx 5, 0, 6 -; CHECK-NEXT: cmplw 3, 5 -; CHECK-NEXT: bge 0, .LBB5_3 +; CHECK-NEXT: cmplwi 5, 5 +; CHECK-NEXT: blt 0, .LBB5_3 ; CHECK-NEXT: # %bb.2: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stwcx. 3, 0, 6 @@ -5597,8 +5511,8 @@ ; CHECK-NEXT: .LBB5_4: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: lwarx 8, 0, 7 -; CHECK-NEXT: cmpw 3, 8 -; CHECK-NEXT: bge 0, .LBB5_6 +; CHECK-NEXT: cmpwi 8, 5 +; CHECK-NEXT: blt 0, .LBB5_6 ; CHECK-NEXT: # %bb.5: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stwcx. 3, 0, 7 @@ -5609,8 +5523,8 @@ ; CHECK-NEXT: .LBB5_7: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: lwarx 8, 0, 6 -; CHECK-NEXT: cmplw 3, 8 -; CHECK-NEXT: ble 0, .LBB5_9 +; CHECK-NEXT: cmplwi 8, 5 +; CHECK-NEXT: bgt 0, .LBB5_9 ; CHECK-NEXT: # %bb.8: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stwcx. 3, 0, 6 @@ -5622,8 +5536,8 @@ ; CHECK-NEXT: .LBB5_10: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: lwarx 4, 0, 7 -; CHECK-NEXT: cmpw 3, 4 -; CHECK-NEXT: ble 0, .LBB5_12 +; CHECK-NEXT: cmpwi 4, 5 +; CHECK-NEXT: bgt 0, .LBB5_12 ; CHECK-NEXT: # %bb.11: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stwcx. 3, 0, 7 @@ -5639,8 +5553,8 @@ ; AIX32-NEXT: L..BB5_1: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 5, 0, 4 -; AIX32-NEXT: cmplw 3, 5 -; AIX32-NEXT: bge 0, L..BB5_3 +; AIX32-NEXT: cmplwi 5, 5 +; AIX32-NEXT: blt 0, L..BB5_3 ; AIX32-NEXT: # %bb.2: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: stwcx. 3, 0, 4 @@ -5652,8 +5566,8 @@ ; AIX32-NEXT: L..BB5_4: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 6, 0, 5 -; AIX32-NEXT: cmpw 3, 6 -; AIX32-NEXT: bge 0, L..BB5_6 +; AIX32-NEXT: cmpwi 6, 5 +; AIX32-NEXT: blt 0, L..BB5_6 ; AIX32-NEXT: # %bb.5: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: stwcx. 3, 0, 5 @@ -5664,8 +5578,8 @@ ; AIX32-NEXT: L..BB5_7: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 6, 0, 4 -; AIX32-NEXT: cmplw 3, 6 -; AIX32-NEXT: ble 0, L..BB5_9 +; AIX32-NEXT: cmplwi 6, 5 +; AIX32-NEXT: bgt 0, L..BB5_9 ; AIX32-NEXT: # %bb.8: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: stwcx. 3, 0, 4 @@ -5677,8 +5591,8 @@ ; AIX32-NEXT: L..BB5_10: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 4, 0, 5 -; AIX32-NEXT: cmpw 3, 4 -; AIX32-NEXT: ble 0, L..BB5_12 +; AIX32-NEXT: cmpwi 4, 5 +; AIX32-NEXT: bgt 0, L..BB5_12 ; AIX32-NEXT: # %bb.11: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: stwcx. 3, 0, 5 @@ -5701,24 +5615,20 @@ define dso_local i64 @cmpswplp(ptr noundef %ptr, ptr nocapture noundef readnone %oldval, i64 noundef %newval) local_unnamed_addr #0 { ; CHECK-LABEL: cmpswplp: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: addi 6, 5, 1 +; CHECK-NEXT: addi 4, 5, 1 ; CHECK-NEXT: .LBB6_1: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: ldarx 4, 0, 3 -; CHECK-NEXT: cmpd 5, 4 -; CHECK-NEXT: bne 0, .LBB6_3 +; CHECK-NEXT: ldarx 6, 0, 3 +; CHECK-NEXT: cmpd 1, 6, 5 +; CHECK-NEXT: bne 1, .LBB6_3 ; CHECK-NEXT: # %bb.2: # %entry ; CHECK-NEXT: # -; CHECK-NEXT: stdcx. 6, 0, 3 +; CHECK-NEXT: stdcx. 4, 0, 3 ; CHECK-NEXT: bne 0, .LBB6_1 -; CHECK-NEXT: b .LBB6_4 ; CHECK-NEXT: .LBB6_3: # %entry -; CHECK-NEXT: stdcx. 4, 0, 3 -; CHECK-NEXT: .LBB6_4: # %entry -; CHECK-NEXT: cmpd 4, 5 ; CHECK-NEXT: li 3, 66 ; CHECK-NEXT: li 4, 55 -; CHECK-NEXT: iseleq 3, 4, 3 +; CHECK-NEXT: isel 3, 4, 3, 6 ; CHECK-NEXT: blr ; ; AIX32-LABEL: cmpswplp: @@ -5761,18 +5671,17 @@ ; CHECK-NEXT: .LBB7_1: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: ldarx 5, 0, 3 -; CHECK-NEXT: cmpd 4, 5 -; CHECK-NEXT: ble 0, .LBB7_3 +; CHECK-NEXT: cmpd 1, 5, 4 +; CHECK-NEXT: bgt 1, .LBB7_3 ; CHECK-NEXT: # %bb.2: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stdcx. 4, 0, 3 ; CHECK-NEXT: bne 0, .LBB7_1 ; CHECK-NEXT: .LBB7_3: # %entry -; CHECK-NEXT: cmpd 5, 4 ; CHECK-NEXT: li 3, 55 ; CHECK-NEXT: li 4, 66 ; CHECK-NEXT: lwsync -; CHECK-NEXT: iselgt 3, 4, 3 +; CHECK-NEXT: isel 3, 4, 3, 5 ; CHECK-NEXT: blr ; ; AIX32-LABEL: atommax8: @@ -5846,18 +5755,17 @@ ; CHECK-NEXT: .LBB8_1: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: lwarx 5, 0, 3 -; CHECK-NEXT: cmpw 4, 5 -; CHECK-NEXT: ble 0, .LBB8_3 +; CHECK-NEXT: cmpw 1, 5, 4 +; CHECK-NEXT: bgt 1, .LBB8_3 ; CHECK-NEXT: # %bb.2: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stwcx. 4, 0, 3 ; CHECK-NEXT: bne 0, .LBB8_1 ; CHECK-NEXT: .LBB8_3: # %entry -; CHECK-NEXT: cmpw 5, 4 ; CHECK-NEXT: li 3, 55 ; CHECK-NEXT: li 4, 66 ; CHECK-NEXT: lwsync -; CHECK-NEXT: iselgt 3, 4, 3 +; CHECK-NEXT: isel 3, 4, 3, 5 ; CHECK-NEXT: blr ; ; AIX32-LABEL: atommax4: @@ -5866,18 +5774,17 @@ ; AIX32-NEXT: L..BB8_1: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 5, 0, 3 -; AIX32-NEXT: cmpw 4, 5 -; AIX32-NEXT: ble 0, L..BB8_3 +; AIX32-NEXT: cmpw 1, 5, 4 +; AIX32-NEXT: bgt 1, L..BB8_3 ; AIX32-NEXT: # %bb.2: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: stwcx. 4, 0, 3 ; AIX32-NEXT: bne 0, L..BB8_1 ; AIX32-NEXT: L..BB8_3: # %entry -; AIX32-NEXT: cmpw 5, 4 ; AIX32-NEXT: li 3, 55 ; AIX32-NEXT: li 4, 66 ; AIX32-NEXT: lwsync -; AIX32-NEXT: iselgt 3, 4, 3 +; AIX32-NEXT: isel 3, 4, 3, 5 ; AIX32-NEXT: blr entry: %0 = atomicrmw max ptr %ptr, i32 %val seq_cst, align 4 @@ -5894,18 +5801,17 @@ ; CHECK-NEXT: # ; CHECK-NEXT: lharx 5, 0, 3 ; CHECK-NEXT: extsh 5, 5 -; CHECK-NEXT: cmpw 4, 5 -; CHECK-NEXT: ble 0, .LBB9_3 +; CHECK-NEXT: cmpw 1, 5, 4 +; CHECK-NEXT: bgt 1, .LBB9_3 ; CHECK-NEXT: # %bb.2: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: sthcx. 4, 0, 3 ; CHECK-NEXT: bne 0, .LBB9_1 ; CHECK-NEXT: .LBB9_3: # %entry -; CHECK-NEXT: cmpw 5, 4 ; CHECK-NEXT: li 3, 55 ; CHECK-NEXT: li 4, 66 ; CHECK-NEXT: lwsync -; CHECK-NEXT: iselgt 3, 4, 3 +; CHECK-NEXT: isel 3, 4, 3, 5 ; CHECK-NEXT: blr ; ; AIX32-LABEL: atommax2: @@ -5925,8 +5831,8 @@ ; AIX32-NEXT: and 9, 8, 6 ; AIX32-NEXT: srw 9, 9, 5 ; AIX32-NEXT: extsh 9, 9 -; AIX32-NEXT: cmpw 4, 9 -; AIX32-NEXT: ble 0, L..BB9_3 +; AIX32-NEXT: cmpw 9, 4 +; AIX32-NEXT: bgt 0, L..BB9_3 ; AIX32-NEXT: # %bb.2: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: andc 9, 8, 6 @@ -5957,18 +5863,17 @@ ; CHECK-NEXT: .LBB10_1: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: lbarx 5, 0, 3 -; CHECK-NEXT: cmplw 4, 5 -; CHECK-NEXT: ble 0, .LBB10_3 +; CHECK-NEXT: cmplw 1, 5, 4 +; CHECK-NEXT: bgt 1, .LBB10_3 ; CHECK-NEXT: # %bb.2: # %entry ; CHECK-NEXT: # ; CHECK-NEXT: stbcx. 4, 0, 3 ; CHECK-NEXT: bne 0, .LBB10_1 ; CHECK-NEXT: .LBB10_3: # %entry -; CHECK-NEXT: cmplw 5, 4 ; CHECK-NEXT: li 3, 55 ; CHECK-NEXT: li 4, 66 ; CHECK-NEXT: lwsync -; CHECK-NEXT: iselgt 3, 4, 3 +; CHECK-NEXT: isel 3, 4, 3, 5 ; CHECK-NEXT: blr ; ; AIX32-LABEL: atommax1: @@ -5985,8 +5890,8 @@ ; AIX32-NEXT: # ; AIX32-NEXT: lwarx 9, 0, 3 ; AIX32-NEXT: and 10, 9, 7 -; AIX32-NEXT: cmplw 6, 10 -; AIX32-NEXT: ble 0, L..BB10_3 +; AIX32-NEXT: cmplw 10, 6 +; AIX32-NEXT: bgt 0, L..BB10_3 ; AIX32-NEXT: # %bb.2: # %entry ; AIX32-NEXT: # ; AIX32-NEXT: andc 10, 9, 7 diff --git a/llvm/test/CodeGen/PowerPC/atomic-1.ll b/llvm/test/CodeGen/PowerPC/atomic-1.ll --- a/llvm/test/CodeGen/PowerPC/atomic-1.ll +++ b/llvm/test/CodeGen/PowerPC/atomic-1.ll @@ -13,7 +13,6 @@ ; CHECK: lwarx %tmppair = cmpxchg i32* %mem, i32 0, i32 1 monotonic monotonic %tmp = extractvalue { i32, i1 } %tmppair, 0 -; CHECK: stwcx. ; CHECK: stwcx. ret i32 %tmp } diff --git a/llvm/test/CodeGen/PowerPC/atomic-2.ll b/llvm/test/CodeGen/PowerPC/atomic-2.ll --- a/llvm/test/CodeGen/PowerPC/atomic-2.ll +++ b/llvm/test/CodeGen/PowerPC/atomic-2.ll @@ -36,7 +36,6 @@ ; CHECK: ldarx %tmppair = cmpxchg i64* %mem, i64 0, i64 1 monotonic monotonic %tmp = extractvalue { i64, i1 } %tmppair, 0 -; CHECK: stdcx. ; CHECK: stdcx. ret i64 %tmp } @@ -48,7 +47,6 @@ ; CHECK-P8U: lbarx %tmppair = cmpxchg i8* %mem, i8 0, i8 1 monotonic monotonic %tmp = extractvalue { i8, i1 } %tmppair, 0 -; CHECK-P8U: stbcx. ; CHECK-P8U: stbcx. ret i8 %tmp } @@ -60,7 +58,6 @@ ; CHECK-P8U: lharx %tmppair = cmpxchg i16* %mem, i16 0, i16 1 monotonic monotonic %tmp = extractvalue { i16, i1 } %tmppair, 0 -; CHECK-P8U: sthcx. ; CHECK-P8U: sthcx. ret i16 %tmp } diff --git a/llvm/test/CodeGen/PowerPC/atomic-float.ll b/llvm/test/CodeGen/PowerPC/atomic-float.ll --- a/llvm/test/CodeGen/PowerPC/atomic-float.ll +++ b/llvm/test/CodeGen/PowerPC/atomic-float.ll @@ -9,36 +9,33 @@ ; CHECK-64: # %bb.0: # %entry ; CHECK-64-NEXT: sync ; CHECK-64-NEXT: lfs 0, 0(3) -; CHECK-64-NEXT: b .LBB0_3 +; CHECK-64-NEXT: b .LBB0_2 ; CHECK-64-NEXT: .LBB0_1: # %atomicrmw.start ; CHECK-64-NEXT: # -; CHECK-64-NEXT: stwcx. 5, 0, 3 -; CHECK-64-NEXT: .LBB0_2: # %atomicrmw.start -; CHECK-64-NEXT: # -; CHECK-64-NEXT: stw 5, -4(1) -; CHECK-64-NEXT: cmplw 5, 4 +; CHECK-64-NEXT: stw 6, -4(1) +; CHECK-64-NEXT: cmplw 6, 4 ; CHECK-64-NEXT: lfs 0, -4(1) -; CHECK-64-NEXT: beq 0, .LBB0_6 -; CHECK-64-NEXT: .LBB0_3: # %atomicrmw.start +; CHECK-64-NEXT: beq 0, .LBB0_5 +; CHECK-64-NEXT: .LBB0_2: # %atomicrmw.start ; CHECK-64-NEXT: # =>This Loop Header: Depth=1 -; CHECK-64-NEXT: # Child Loop BB0_4 Depth 2 +; CHECK-64-NEXT: # Child Loop BB0_3 Depth 2 ; CHECK-64-NEXT: fadds 2, 0, 1 ; CHECK-64-NEXT: stfs 2, -8(1) ; CHECK-64-NEXT: stfs 0, -12(1) -; CHECK-64-NEXT: lwz 6, -8(1) +; CHECK-64-NEXT: lwz 5, -8(1) ; CHECK-64-NEXT: lwz 4, -12(1) -; CHECK-64-NEXT: .LBB0_4: # %atomicrmw.start -; CHECK-64-NEXT: # Parent Loop BB0_3 Depth=1 +; CHECK-64-NEXT: .LBB0_3: # %atomicrmw.start +; CHECK-64-NEXT: # Parent Loop BB0_2 Depth=1 ; CHECK-64-NEXT: # => This Inner Loop Header: Depth=2 -; CHECK-64-NEXT: lwarx 5, 0, 3 -; CHECK-64-NEXT: cmpw 4, 5 +; CHECK-64-NEXT: lwarx 6, 0, 3 +; CHECK-64-NEXT: cmpw 6, 4 ; CHECK-64-NEXT: bne 0, .LBB0_1 -; CHECK-64-NEXT: # %bb.5: # %atomicrmw.start +; CHECK-64-NEXT: # %bb.4: # %atomicrmw.start ; CHECK-64-NEXT: # -; CHECK-64-NEXT: stwcx. 6, 0, 3 -; CHECK-64-NEXT: bne 0, .LBB0_4 -; CHECK-64-NEXT: b .LBB0_2 -; CHECK-64-NEXT: .LBB0_6: # %atomicrmw.end +; CHECK-64-NEXT: stwcx. 5, 0, 3 +; CHECK-64-NEXT: bne 0, .LBB0_3 +; CHECK-64-NEXT: b .LBB0_1 +; CHECK-64-NEXT: .LBB0_5: # %atomicrmw.end ; CHECK-64-NEXT: fmr 1, 0 ; CHECK-64-NEXT: lwsync ; CHECK-64-NEXT: blr @@ -49,36 +46,33 @@ ; CHECK-32-NEXT: .cfi_def_cfa_offset 32 ; CHECK-32-NEXT: sync ; CHECK-32-NEXT: lfs 0, 0(3) -; CHECK-32-NEXT: b .LBB0_3 +; CHECK-32-NEXT: b .LBB0_2 ; CHECK-32-NEXT: .LBB0_1: # %atomicrmw.start ; CHECK-32-NEXT: # -; CHECK-32-NEXT: stwcx. 5, 0, 3 -; CHECK-32-NEXT: .LBB0_2: # %atomicrmw.start -; CHECK-32-NEXT: # -; CHECK-32-NEXT: stw 5, 28(1) -; CHECK-32-NEXT: cmplw 5, 4 +; CHECK-32-NEXT: stw 6, 28(1) +; CHECK-32-NEXT: cmplw 6, 4 ; CHECK-32-NEXT: lfs 0, 28(1) -; CHECK-32-NEXT: beq 0, .LBB0_6 -; CHECK-32-NEXT: .LBB0_3: # %atomicrmw.start +; CHECK-32-NEXT: beq 0, .LBB0_5 +; CHECK-32-NEXT: .LBB0_2: # %atomicrmw.start ; CHECK-32-NEXT: # =>This Loop Header: Depth=1 -; CHECK-32-NEXT: # Child Loop BB0_4 Depth 2 +; CHECK-32-NEXT: # Child Loop BB0_3 Depth 2 ; CHECK-32-NEXT: fadds 2, 0, 1 ; CHECK-32-NEXT: stfs 2, 24(1) ; CHECK-32-NEXT: stfs 0, 20(1) -; CHECK-32-NEXT: lwz 6, 24(1) +; CHECK-32-NEXT: lwz 5, 24(1) ; CHECK-32-NEXT: lwz 4, 20(1) -; CHECK-32-NEXT: .LBB0_4: # %atomicrmw.start -; CHECK-32-NEXT: # Parent Loop BB0_3 Depth=1 +; CHECK-32-NEXT: .LBB0_3: # %atomicrmw.start +; CHECK-32-NEXT: # Parent Loop BB0_2 Depth=1 ; CHECK-32-NEXT: # => This Inner Loop Header: Depth=2 -; CHECK-32-NEXT: lwarx 5, 0, 3 -; CHECK-32-NEXT: cmpw 4, 5 +; CHECK-32-NEXT: lwarx 6, 0, 3 +; CHECK-32-NEXT: cmpw 6, 4 ; CHECK-32-NEXT: bne 0, .LBB0_1 -; CHECK-32-NEXT: # %bb.5: # %atomicrmw.start +; CHECK-32-NEXT: # %bb.4: # %atomicrmw.start ; CHECK-32-NEXT: # -; CHECK-32-NEXT: stwcx. 6, 0, 3 -; CHECK-32-NEXT: bne 0, .LBB0_4 -; CHECK-32-NEXT: b .LBB0_2 -; CHECK-32-NEXT: .LBB0_6: # %atomicrmw.end +; CHECK-32-NEXT: stwcx. 5, 0, 3 +; CHECK-32-NEXT: bne 0, .LBB0_3 +; CHECK-32-NEXT: b .LBB0_1 +; CHECK-32-NEXT: .LBB0_5: # %atomicrmw.end ; CHECK-32-NEXT: fmr 1, 0 ; CHECK-32-NEXT: lwsync ; CHECK-32-NEXT: addi 1, 1, 32 diff --git a/llvm/test/CodeGen/PowerPC/atomic-minmax.ll b/llvm/test/CodeGen/PowerPC/atomic-minmax.ll --- a/llvm/test/CodeGen/PowerPC/atomic-minmax.ll +++ b/llvm/test/CodeGen/PowerPC/atomic-minmax.ll @@ -1,433 +1,586 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py ; RUN: llc -verify-machineinstrs < %s | FileCheck %s target datalayout = "E-m:e-i64:64-n32:64" target triple = "powerpc64-unknown-linux-gnu" define void @a32min(i32* nocapture dereferenceable(4) %minimum, i32 %val) #0 { +; CHECK-LABEL: a32min: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB0_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 5, 0, 3 +; CHECK-NEXT: cmpw 5, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stwcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB0_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw min i32* %minimum, i32 %val monotonic ret void -; CHECK-LABEL: @a32min -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpw 4, [[OLDV]] -; CHECK: bgelr 0 -; CHECK: stwcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a32max(i32* nocapture dereferenceable(4) %minimum, i32 %val) #0 { +; CHECK-LABEL: a32max: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB1_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 5, 0, 3 +; CHECK-NEXT: cmpw 5, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stwcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB1_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw max i32* %minimum, i32 %val monotonic ret void -; CHECK-LABEL: @a32max -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpw 4, [[OLDV]] -; CHECK: blelr 0 -; CHECK: stwcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a32umin(i32* nocapture dereferenceable(4) %minimum, i32 %val) #0 { +; CHECK-LABEL: a32umin: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB2_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 5, 0, 3 +; CHECK-NEXT: cmplw 5, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stwcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB2_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umin i32* %minimum, i32 %val monotonic ret void -; CHECK-LABEL: @a32umin -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmplw 4, [[OLDV]] -; CHECK: bgelr 0 -; CHECK: stwcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a32umax(i32* nocapture dereferenceable(4) %minimum, i32 %val) #0 { +; CHECK-LABEL: a32umax: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB3_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 5, 0, 3 +; CHECK-NEXT: cmplw 5, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stwcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB3_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umax i32* %minimum, i32 %val monotonic ret void -; CHECK-LABEL: @a32umax -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmplw 4, [[OLDV]] -; CHECK: blelr 0 -; CHECK: stwcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a16min(i16* nocapture dereferenceable(4) %minimum, i16 %val) #1 { +; CHECK-LABEL: a16min: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: extsh 4, 4 +; CHECK-NEXT: .LBB4_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lharx 5, 0, 3 +; CHECK-NEXT: extsh 5, 5 +; CHECK-NEXT: cmpw 5, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: sthcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB4_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw min i16* %minimum, i16 %val monotonic ret void -; CHECK-LABEL: @a16min -; CHECK: lharx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpw 4, [[OLDV]] -; CHECK: bgelr 0 -; CHECK: sthcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a16max(i16* nocapture dereferenceable(4) %minimum, i16 %val) #1 { +; CHECK-LABEL: a16max: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: extsh 4, 4 +; CHECK-NEXT: .LBB5_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lharx 5, 0, 3 +; CHECK-NEXT: extsh 5, 5 +; CHECK-NEXT: cmpw 5, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: sthcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB5_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw max i16* %minimum, i16 %val monotonic ret void -; CHECK-LABEL: @a16max -; CHECK: lharx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpw 4, [[OLDV]] -; CHECK: blelr 0 -; CHECK: sthcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a16umin(i16* nocapture dereferenceable(4) %minimum, i16 %val) #1 { +; CHECK-LABEL: a16umin: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB6_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lharx 5, 0, 3 +; CHECK-NEXT: cmplw 5, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: sthcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB6_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umin i16* %minimum, i16 %val monotonic ret void -; CHECK-LABEL: @a16umin -; CHECK: lharx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmplw 4, [[OLDV]] -; CHECK: bgelr 0 -; CHECK: sthcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a16umax(i16* nocapture dereferenceable(4) %minimum, i16 %val) #1 { +; CHECK-LABEL: a16umax: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB7_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lharx 5, 0, 3 +; CHECK-NEXT: cmplw 5, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: sthcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB7_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umax i16* %minimum, i16 %val monotonic ret void -; CHECK-LABEL: @a16umax -; CHECK: lharx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmplw 4, [[OLDV]] -; CHECK: blelr 0 -; CHECK: sthcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a8min(i8* nocapture dereferenceable(4) %minimum, i8 %val) #1 { +; CHECK-LABEL: a8min: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: extsb 4, 4 +; CHECK-NEXT: .LBB8_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lbarx 5, 0, 3 +; CHECK-NEXT: extsb 5, 5 +; CHECK-NEXT: cmpw 5, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stbcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB8_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw min i8* %minimum, i8 %val monotonic ret void -; CHECK-LABEL: @a8min -; CHECK: lbarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpw 4, [[OLDV]] -; CHECK: bgelr 0 -; CHECK: stbcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a8max(i8* nocapture dereferenceable(4) %minimum, i8 %val) #1 { +; CHECK-LABEL: a8max: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: extsb 4, 4 +; CHECK-NEXT: .LBB9_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lbarx 5, 0, 3 +; CHECK-NEXT: extsb 5, 5 +; CHECK-NEXT: cmpw 5, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stbcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB9_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw max i8* %minimum, i8 %val monotonic ret void -; CHECK-LABEL: @a8max -; CHECK: lbarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpw 4, [[OLDV]] -; CHECK: blelr 0 -; CHECK: stbcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a8umin(i8* nocapture dereferenceable(4) %minimum, i8 %val) #1 { +; CHECK-LABEL: a8umin: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB10_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lbarx 5, 0, 3 +; CHECK-NEXT: cmplw 5, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stbcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB10_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umin i8* %minimum, i8 %val monotonic ret void -; CHECK-LABEL: @a8umin -; CHECK: lbarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmplw 4, [[OLDV]] -; CHECK: bgelr 0 -; CHECK: stbcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a8umax(i8* nocapture dereferenceable(4) %minimum, i8 %val) #1 { +; CHECK-LABEL: a8umax: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB11_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lbarx 5, 0, 3 +; CHECK-NEXT: cmplw 5, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stbcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB11_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umax i8* %minimum, i8 %val monotonic ret void -; CHECK-LABEL: @a8umax -; CHECK: lbarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmplw 4, [[OLDV]] -; CHECK: blelr 0 -; CHECK: stbcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a64min(i64* nocapture dereferenceable(4) %minimum, i64 %val) #0 { +; CHECK-LABEL: a64min: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB12_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: ldarx 5, 0, 3 +; CHECK-NEXT: cmpd 5, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stdcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB12_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw min i64* %minimum, i64 %val monotonic ret void -; CHECK-LABEL: @a64min -; CHECK: ldarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpd 4, [[OLDV]] -; CHECK: bgelr 0 -; CHECK: stdcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a64max(i64* nocapture dereferenceable(4) %minimum, i64 %val) #0 { +; CHECK-LABEL: a64max: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB13_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: ldarx 5, 0, 3 +; CHECK-NEXT: cmpd 5, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stdcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB13_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw max i64* %minimum, i64 %val monotonic ret void -; CHECK-LABEL: @a64max -; CHECK: ldarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpd 4, [[OLDV]] -; CHECK: blelr 0 -; CHECK: stdcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a64umin(i64* nocapture dereferenceable(4) %minimum, i64 %val) #0 { +; CHECK-LABEL: a64umin: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB14_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: ldarx 5, 0, 3 +; CHECK-NEXT: cmpld 5, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stdcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB14_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umin i64* %minimum, i64 %val monotonic ret void -; CHECK-LABEL: @a64umin -; CHECK: ldarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpld 4, [[OLDV]] -; CHECK: bgelr 0 -; CHECK: stdcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @a64umax(i64* nocapture dereferenceable(4) %minimum, i64 %val) #0 { +; CHECK-LABEL: a64umax: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: .LBB15_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: ldarx 5, 0, 3 +; CHECK-NEXT: cmpld 5, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: stdcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB15_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umax i64* %minimum, i64 %val monotonic ret void -; CHECK-LABEL: @a64umax -; CHECK: ldarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: cmpld 4, [[OLDV]] -; CHECK: blelr 0 -; CHECK: stdcx. 4, 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @ae16min(i16* nocapture dereferenceable(4) %minimum, i16 %val) #0 { +; CHECK-LABEL: ae16min: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: li 5, 0 +; CHECK-NEXT: rlwinm 6, 3, 3, 27, 27 +; CHECK-NEXT: ori 7, 5, 65535 +; CHECK-NEXT: xori 5, 6, 16 +; CHECK-NEXT: slw 8, 4, 5 +; CHECK-NEXT: slw 6, 7, 5 +; CHECK-NEXT: rldicr 3, 3, 0, 61 +; CHECK-NEXT: and 7, 8, 6 +; CHECK-NEXT: .LBB16_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 8, 0, 3 +; CHECK-NEXT: and 9, 8, 6 +; CHECK-NEXT: srw 9, 9, 5 +; CHECK-NEXT: extsh 9, 9 +; CHECK-NEXT: cmpw 9, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: andc 8, 8, 6 +; CHECK-NEXT: or 8, 7, 8 +; CHECK-NEXT: stwcx. 8, 0, 3 +; CHECK-NEXT: bne 0, .LBB16_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw min i16* %minimum, i16 %val monotonic ret void -; CHECK-LABEL: @ae16min -; CHECK-DAG: rlwinm [[SA1:[0-9]+]], 3, 3, 27, 27 -; CHECK-DAG: li [[M1:[0-9]+]], 0 -; CHECK-DAG: rldicr 3, 3, 0, 61 -; CHECK-DAG: xori [[SA:[0-9]+]], [[SA1]], 16 -; CHECK-DAG: ori [[M2:[0-9]+]], [[M1]], 65535 -; CHECK-DAG: slw [[SV:[0-9]+]], 4, [[SA]] -; CHECK-DAG: slw [[M:[0-9]+]], [[M2]], [[SA]] -; CHECK-DAG: and [[SMV:[0-9]+]], [[SV]], [[M]] -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: and [[MOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: srw [[SMOLDV:[0-9]+]], [[MOLDV]], [[SA]] -; CHECK: extsh [[SESMOLDV:[0-9]+]], [[SMOLDV]] -; CHECK: cmpw 4, [[SESMOLDV]] -; CHECK: bgelr 0 -; CHECK: andc [[NOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: or [[NEWV:[0-9]+]], [[SMV]], [[NOLDV]] -; CHECK: stwcx. [[NEWV]], 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @ae16max(i16* nocapture dereferenceable(4) %minimum, i16 %val) #0 { +; CHECK-LABEL: ae16max: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: li 5, 0 +; CHECK-NEXT: rlwinm 6, 3, 3, 27, 27 +; CHECK-NEXT: ori 7, 5, 65535 +; CHECK-NEXT: xori 5, 6, 16 +; CHECK-NEXT: slw 8, 4, 5 +; CHECK-NEXT: slw 6, 7, 5 +; CHECK-NEXT: rldicr 3, 3, 0, 61 +; CHECK-NEXT: and 7, 8, 6 +; CHECK-NEXT: .LBB17_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 8, 0, 3 +; CHECK-NEXT: and 9, 8, 6 +; CHECK-NEXT: srw 9, 9, 5 +; CHECK-NEXT: extsh 9, 9 +; CHECK-NEXT: cmpw 9, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: andc 8, 8, 6 +; CHECK-NEXT: or 8, 7, 8 +; CHECK-NEXT: stwcx. 8, 0, 3 +; CHECK-NEXT: bne 0, .LBB17_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw max i16* %minimum, i16 %val monotonic ret void -; CHECK-LABEL: @ae16max -; CHECK-DAG: rlwinm [[SA1:[0-9]+]], 3, 3, 27, 27 -; CHECK-DAG: li [[M1:[0-9]+]], 0 -; CHECK-DAG: rldicr 3, 3, 0, 61 -; CHECK-DAG: xori [[SA:[0-9]+]], [[SA1]], 16 -; CHECK-DAG: ori [[M2:[0-9]+]], [[M1]], 65535 -; CHECK-DAG: slw [[SV:[0-9]+]], 4, [[SA]] -; CHECK-DAG: slw [[M:[0-9]+]], [[M2]], [[SA]] -; CHECK-DAG: and [[SMV:[0-9]+]], [[SV]], [[M]] -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: and [[MOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: srw [[SMOLDV:[0-9]+]], [[MOLDV]], [[SA]] -; CHECK: extsh [[SESMOLDV:[0-9]+]], [[SMOLDV]] -; CHECK: cmpw 4, [[SESMOLDV]] -; CHECK: blelr 0 -; CHECK: andc [[NOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: or [[NEWV:[0-9]+]], [[SMV]], [[NOLDV]] -; CHECK: stwcx. [[NEWV]], 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @ae16umin(i16* nocapture dereferenceable(4) %minimum, i16 %val) #0 { +; CHECK-LABEL: ae16umin: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: li 5, 0 +; CHECK-NEXT: rlwinm 6, 3, 3, 27, 27 +; CHECK-NEXT: ori 5, 5, 65535 +; CHECK-NEXT: xori 6, 6, 16 +; CHECK-NEXT: slw 4, 4, 6 +; CHECK-NEXT: slw 5, 5, 6 +; CHECK-NEXT: rldicr 3, 3, 0, 61 +; CHECK-NEXT: and 6, 4, 5 +; CHECK-NEXT: .LBB18_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 7, 0, 3 +; CHECK-NEXT: and 8, 7, 5 +; CHECK-NEXT: cmplw 8, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: andc 7, 7, 5 +; CHECK-NEXT: or 7, 6, 7 +; CHECK-NEXT: stwcx. 7, 0, 3 +; CHECK-NEXT: bne 0, .LBB18_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umin i16* %minimum, i16 %val monotonic ret void -; CHECK-LABEL: @ae16umin -; CHECK-DAG: rlwinm [[SA1:[0-9]+]], 3, 3, 27, 27 -; CHECK-DAG: li [[M1:[0-9]+]], 0 -; CHECK-DAG: rldicr 3, 3, 0, 61 -; CHECK-DAG: xori [[SA:[0-9]+]], [[SA1]], 16 -; CHECK-DAG: ori [[M2:[0-9]+]], [[M1]], 65535 -; CHECK-DAG: slw [[SV:[0-9]+]], 4, [[SA]] -; CHECK-DAG: slw [[M:[0-9]+]], [[M2]], [[SA]] -; CHECK-DAG: and [[SMV:[0-9]+]], [[SV]], [[M]] -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: and [[MOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: cmplw 4, [[MOLDV]] -; CHECK: bgelr 0 -; CHECK: andc [[NOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: or [[NEWV:[0-9]+]], [[SMV]], [[NOLDV]] -; CHECK: stwcx. [[NEWV]], 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @ae16umax(i16* nocapture dereferenceable(4) %minimum, i16 %val) #0 { +; CHECK-LABEL: ae16umax: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: li 5, 0 +; CHECK-NEXT: rlwinm 6, 3, 3, 27, 27 +; CHECK-NEXT: ori 5, 5, 65535 +; CHECK-NEXT: xori 6, 6, 16 +; CHECK-NEXT: slw 4, 4, 6 +; CHECK-NEXT: slw 5, 5, 6 +; CHECK-NEXT: rldicr 3, 3, 0, 61 +; CHECK-NEXT: and 6, 4, 5 +; CHECK-NEXT: .LBB19_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 7, 0, 3 +; CHECK-NEXT: and 8, 7, 5 +; CHECK-NEXT: cmplw 8, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: andc 7, 7, 5 +; CHECK-NEXT: or 7, 6, 7 +; CHECK-NEXT: stwcx. 7, 0, 3 +; CHECK-NEXT: bne 0, .LBB19_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umax i16* %minimum, i16 %val monotonic ret void -; CHECK-LABEL: @ae16umax -; CHECK-DAG: rlwinm [[SA1:[0-9]+]], 3, 3, 27, 27 -; CHECK-DAG: li [[M1:[0-9]+]], 0 -; CHECK-DAG: rldicr 3, 3, 0, 61 -; CHECK-DAG: xori [[SA:[0-9]+]], [[SA1]], 16 -; CHECK-DAG: ori [[M2:[0-9]+]], [[M1]], 65535 -; CHECK-DAG: slw [[SV:[0-9]+]], 4, [[SA]] -; CHECK-DAG: slw [[M:[0-9]+]], [[M2]], [[SA]] -; CHECK-DAG: and [[SMV:[0-9]+]], [[SV]], [[M]] -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: and [[MOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: cmplw 4, [[MOLDV]] -; CHECK: blelr 0 -; CHECK: andc [[NOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: or [[NEWV:[0-9]+]], [[SMV]], [[NOLDV]] -; CHECK: stwcx. [[NEWV]], 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @ae8min(i8* nocapture dereferenceable(4) %minimum, i8 %val) #0 { +; CHECK-LABEL: ae8min: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: rlwinm 5, 3, 3, 27, 28 +; CHECK-NEXT: li 6, 255 +; CHECK-NEXT: xori 5, 5, 24 +; CHECK-NEXT: rldicr 3, 3, 0, 61 +; CHECK-NEXT: slw 7, 4, 5 +; CHECK-NEXT: slw 6, 6, 5 +; CHECK-NEXT: and 7, 7, 6 +; CHECK-NEXT: .LBB20_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 8, 0, 3 +; CHECK-NEXT: and 9, 8, 6 +; CHECK-NEXT: srw 9, 9, 5 +; CHECK-NEXT: extsb 9, 9 +; CHECK-NEXT: cmpw 9, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: andc 8, 8, 6 +; CHECK-NEXT: or 8, 7, 8 +; CHECK-NEXT: stwcx. 8, 0, 3 +; CHECK-NEXT: bne 0, .LBB20_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw min i8* %minimum, i8 %val monotonic ret void -; CHECK-LABEL: @ae8min -; CHECK-DAG: rlwinm [[SA1:[0-9]+]], 3, 3, 27, 28 -; CHECK-DAG: li [[M1:[0-9]+]], 255 -; CHECK-DAG: rldicr 3, 3, 0, 61 -; CHECK-DAG: xori [[SA:[0-9]+]], [[SA1]], 24 -; CHECK-DAG: slw [[SV:[0-9]+]], 4, [[SA]] -; CHECK-DAG: slw [[M:[0-9]+]], [[M1]], [[SA]] -; CHECK-DAG: and [[SMV:[0-9]+]], [[SV]], [[M]] -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: and [[MOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: srw [[SMOLDV:[0-9]+]], [[MOLDV]], [[SA]] -; CHECK: extsb [[SESMOLDV:[0-9]+]], [[SMOLDV]] -; CHECK: cmpw 4, [[SESMOLDV]] -; CHECK: bgelr 0 -; CHECK: andc [[NOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: or [[NEWV:[0-9]+]], [[SMV]], [[NOLDV]] -; CHECK: stwcx. [[NEWV]], 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @ae8max(i8* nocapture dereferenceable(4) %minimum, i8 %val) #0 { +; CHECK-LABEL: ae8max: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: rlwinm 5, 3, 3, 27, 28 +; CHECK-NEXT: li 6, 255 +; CHECK-NEXT: xori 5, 5, 24 +; CHECK-NEXT: rldicr 3, 3, 0, 61 +; CHECK-NEXT: slw 7, 4, 5 +; CHECK-NEXT: slw 6, 6, 5 +; CHECK-NEXT: and 7, 7, 6 +; CHECK-NEXT: .LBB21_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 8, 0, 3 +; CHECK-NEXT: and 9, 8, 6 +; CHECK-NEXT: srw 9, 9, 5 +; CHECK-NEXT: extsb 9, 9 +; CHECK-NEXT: cmpw 9, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: andc 8, 8, 6 +; CHECK-NEXT: or 8, 7, 8 +; CHECK-NEXT: stwcx. 8, 0, 3 +; CHECK-NEXT: bne 0, .LBB21_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw max i8* %minimum, i8 %val monotonic ret void -; CHECK-LABEL: @ae8max -; CHECK-DAG: rlwinm [[SA1:[0-9]+]], 3, 3, 27, 28 -; CHECK-DAG: li [[M1:[0-9]+]], 255 -; CHECK-DAG: rldicr 3, 3, 0, 61 -; CHECK-DAG: xori [[SA:[0-9]+]], [[SA1]], 24 -; CHECK-DAG: slw [[SV:[0-9]+]], 4, [[SA]] -; CHECK-DAG: slw [[M:[0-9]+]], [[M1]], [[SA]] -; CHECK-DAG: and [[SMV:[0-9]+]], [[SV]], [[M]] -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: and [[MOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: srw [[SMOLDV:[0-9]+]], [[MOLDV]], [[SA]] -; CHECK: extsb [[SESMOLDV:[0-9]+]], [[SMOLDV]] -; CHECK: cmpw 4, [[SESMOLDV]] -; CHECK: blelr 0 -; CHECK: andc [[NOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: or [[NEWV:[0-9]+]], [[SMV]], [[NOLDV]] -; CHECK: stwcx. [[NEWV]], 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @ae8umin(i8* nocapture dereferenceable(4) %minimum, i8 %val) #0 { +; CHECK-LABEL: ae8umin: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: rlwinm 6, 3, 3, 27, 28 +; CHECK-NEXT: li 5, 255 +; CHECK-NEXT: xori 6, 6, 24 +; CHECK-NEXT: rldicr 3, 3, 0, 61 +; CHECK-NEXT: slw 4, 4, 6 +; CHECK-NEXT: slw 5, 5, 6 +; CHECK-NEXT: and 6, 4, 5 +; CHECK-NEXT: .LBB22_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 7, 0, 3 +; CHECK-NEXT: and 8, 7, 5 +; CHECK-NEXT: cmplw 8, 4 +; CHECK-NEXT: bltlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: andc 7, 7, 5 +; CHECK-NEXT: or 7, 6, 7 +; CHECK-NEXT: stwcx. 7, 0, 3 +; CHECK-NEXT: bne 0, .LBB22_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umin i8* %minimum, i8 %val monotonic ret void -; CHECK-LABEL: @ae8umin -; CHECK-DAG: rlwinm [[SA1:[0-9]+]], 3, 3, 27, 28 -; CHECK-DAG: li [[M1:[0-9]+]], 255 -; CHECK-DAG: rldicr 3, 3, 0, 61 -; CHECK-DAG: xori [[SA:[0-9]+]], [[SA1]], 24 -; CHECK-DAG: slw [[SV:[0-9]+]], 4, [[SA]] -; CHECK-DAG: slw [[M:[0-9]+]], [[M1]], [[SA]] -; CHECK-DAG: and [[SMV:[0-9]+]], [[SV]], [[M]] -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: and [[MOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: cmplw 4, [[MOLDV]] -; CHECK: bgelr 0 -; CHECK: andc [[NOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: or [[NEWV:[0-9]+]], [[SMV]], [[NOLDV]] -; CHECK: stwcx. [[NEWV]], 0, 3 -; CHECK: bne 0, -; CHECK: blr } define void @ae8umax(i8* nocapture dereferenceable(4) %minimum, i8 %val) #0 { +; CHECK-LABEL: ae8umax: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: rlwinm 6, 3, 3, 27, 28 +; CHECK-NEXT: li 5, 255 +; CHECK-NEXT: xori 6, 6, 24 +; CHECK-NEXT: rldicr 3, 3, 0, 61 +; CHECK-NEXT: slw 4, 4, 6 +; CHECK-NEXT: slw 5, 5, 6 +; CHECK-NEXT: and 6, 4, 5 +; CHECK-NEXT: .LBB23_1: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: lwarx 7, 0, 3 +; CHECK-NEXT: and 8, 7, 5 +; CHECK-NEXT: cmplw 8, 4 +; CHECK-NEXT: bgtlr 0 +; CHECK-NEXT: # %bb.2: # %entry +; CHECK-NEXT: # +; CHECK-NEXT: andc 7, 7, 5 +; CHECK-NEXT: or 7, 6, 7 +; CHECK-NEXT: stwcx. 7, 0, 3 +; CHECK-NEXT: bne 0, .LBB23_1 +; CHECK-NEXT: # %bb.3: # %entry +; CHECK-NEXT: blr entry: %0 = atomicrmw umax i8* %minimum, i8 %val monotonic ret void -; CHECK-LABEL: @ae8umax -; CHECK-DAG: rlwinm [[SA1:[0-9]+]], 3, 3, 27, 28 -; CHECK-DAG: li [[M1:[0-9]+]], 255 -; CHECK-DAG: rldicr 3, 3, 0, 61 -; CHECK-DAG: xori [[SA:[0-9]+]], [[SA1]], 24 -; CHECK-DAG: slw [[SV:[0-9]+]], 4, [[SA]] -; CHECK-DAG: slw [[M:[0-9]+]], [[M1]], [[SA]] -; CHECK-DAG: and [[SMV:[0-9]+]], [[SV]], [[M]] -; CHECK: lwarx [[OLDV:[0-9]+]], 0, 3 -; CHECK: and [[MOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: cmplw 4, [[MOLDV]] -; CHECK: blelr 0 -; CHECK: andc [[NOLDV:[0-9]+]], [[OLDV]], [[M]] -; CHECK: or [[NEWV:[0-9]+]], [[SMV]], [[NOLDV]] -; CHECK: stwcx. [[NEWV]], 0, 3 -; CHECK: bne 0, -; CHECK: blr } attributes #0 = { nounwind "target-cpu"="ppc64" } diff --git a/llvm/test/CodeGen/PowerPC/atomics-regression.ll b/llvm/test/CodeGen/PowerPC/atomics-regression.ll --- a/llvm/test/CodeGen/PowerPC/atomics-regression.ll +++ b/llvm/test/CodeGen/PowerPC/atomics-regression.ll @@ -403,14 +403,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 24 ; PPC64LE-NEXT: .LBB40_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB40_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB40_1 -; PPC64LE-NEXT: .LBB40_3: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB40_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val monotonic monotonic ret void @@ -422,16 +420,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 24 ; PPC64LE-NEXT: .LBB41_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB41_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB41_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB41_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB41_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB41_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val acquire monotonic @@ -444,16 +438,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 24 ; PPC64LE-NEXT: .LBB42_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB42_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB42_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB42_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB42_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB42_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val acquire acquire @@ -467,14 +457,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB43_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB43_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB43_1 -; PPC64LE-NEXT: .LBB43_3: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB43_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val release monotonic ret void @@ -487,16 +475,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB44_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB44_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB44_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB44_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB44_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB44_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val release acquire @@ -510,16 +494,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB45_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB45_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB45_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB45_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB45_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB45_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val acq_rel monotonic @@ -533,16 +513,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB46_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB46_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB46_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB46_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB46_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB46_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val acq_rel acquire @@ -556,16 +532,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB47_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB47_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB47_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB47_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB47_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB47_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val seq_cst monotonic @@ -579,16 +551,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB48_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB48_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB48_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB48_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB48_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB48_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val seq_cst acquire @@ -602,16 +570,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB49_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB49_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB49_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB49_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB49_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB49_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val seq_cst seq_cst @@ -624,14 +588,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 16 ; PPC64LE-NEXT: .LBB50_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB50_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB50_1 -; PPC64LE-NEXT: .LBB50_3: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB50_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val monotonic monotonic ret void @@ -643,16 +605,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 16 ; PPC64LE-NEXT: .LBB51_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB51_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB51_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB51_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB51_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB51_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val acquire monotonic @@ -665,16 +623,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 16 ; PPC64LE-NEXT: .LBB52_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB52_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB52_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB52_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB52_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB52_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val acquire acquire @@ -688,14 +642,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB53_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB53_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB53_1 -; PPC64LE-NEXT: .LBB53_3: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB53_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val release monotonic ret void @@ -708,16 +660,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB54_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB54_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB54_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB54_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB54_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB54_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val release acquire @@ -731,16 +679,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB55_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB55_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB55_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB55_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB55_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB55_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val acq_rel monotonic @@ -754,16 +698,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB56_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB56_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB56_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB56_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB56_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB56_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val acq_rel acquire @@ -777,16 +717,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB57_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB57_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB57_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB57_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB57_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB57_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val seq_cst monotonic @@ -800,16 +736,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB58_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB58_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB58_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB58_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB58_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB58_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val seq_cst acquire @@ -823,16 +755,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB59_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB59_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB59_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB59_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB59_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB59_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val seq_cst seq_cst @@ -844,14 +772,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB60_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB60_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB60_1 -; PPC64LE-NEXT: .LBB60_3: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB60_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val monotonic monotonic ret void @@ -862,16 +788,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB61_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB61_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB61_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB61_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB61_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB61_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val acquire monotonic @@ -883,16 +805,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB62_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB62_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB62_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB62_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB62_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB62_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val acquire acquire @@ -905,14 +823,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB63_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB63_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB63_1 -; PPC64LE-NEXT: .LBB63_3: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB63_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val release monotonic ret void @@ -924,16 +840,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB64_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB64_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB64_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB64_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB64_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB64_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val release acquire @@ -946,16 +858,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB65_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB65_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB65_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB65_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB65_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB65_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val acq_rel monotonic @@ -968,16 +876,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB66_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB66_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB66_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB66_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB66_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB66_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val acq_rel acquire @@ -990,16 +894,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB67_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB67_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB67_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB67_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB67_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB67_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val seq_cst monotonic @@ -1012,16 +912,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB68_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB68_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB68_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB68_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB68_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB68_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val seq_cst acquire @@ -1034,16 +930,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB69_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB69_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB69_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB69_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB69_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB69_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val seq_cst seq_cst @@ -1055,14 +947,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB70_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB70_3 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB70_1 -; PPC64LE-NEXT: .LBB70_3: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB70_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val monotonic monotonic ret void @@ -1073,16 +963,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB71_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB71_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB71_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB71_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB71_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB71_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val acquire monotonic @@ -1094,16 +980,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB72_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB72_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB72_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB72_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB72_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB72_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val acquire acquire @@ -1116,14 +998,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB73_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB73_3 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB73_1 -; PPC64LE-NEXT: .LBB73_3: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB73_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val release monotonic ret void @@ -1135,16 +1015,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB74_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB74_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB74_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB74_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB74_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB74_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val release acquire @@ -1157,16 +1033,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB75_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB75_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB75_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB75_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB75_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB75_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val acq_rel monotonic @@ -1179,16 +1051,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB76_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB76_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB76_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB76_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB76_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB76_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val acq_rel acquire @@ -1201,16 +1069,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB77_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB77_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB77_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB77_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB77_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB77_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val seq_cst monotonic @@ -1223,16 +1087,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB78_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB78_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB78_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB78_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB78_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB78_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val seq_cst acquire @@ -1245,16 +1105,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB79_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB79_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB79_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB79_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB79_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB79_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val seq_cst seq_cst @@ -1267,14 +1123,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 24 ; PPC64LE-NEXT: .LBB80_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB80_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB80_1 -; PPC64LE-NEXT: .LBB80_3: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB80_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") monotonic monotonic ret void @@ -1286,16 +1140,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 24 ; PPC64LE-NEXT: .LBB81_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB81_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB81_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB81_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB81_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB81_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") acquire monotonic @@ -1308,16 +1158,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 24 ; PPC64LE-NEXT: .LBB82_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB82_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB82_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB82_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB82_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB82_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") acquire acquire @@ -1331,14 +1177,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB83_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB83_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB83_1 -; PPC64LE-NEXT: .LBB83_3: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB83_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") release monotonic ret void @@ -1351,16 +1195,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB84_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB84_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB84_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB84_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB84_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB84_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") release acquire @@ -1374,16 +1214,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB85_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB85_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB85_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB85_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB85_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB85_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") acq_rel monotonic @@ -1397,16 +1233,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB86_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB86_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB86_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB86_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB86_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB86_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") acq_rel acquire @@ -1420,16 +1252,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB87_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB87_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB87_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB87_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB87_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB87_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") seq_cst monotonic @@ -1443,16 +1271,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB88_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB88_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB88_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB88_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB88_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB88_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") seq_cst acquire @@ -1466,16 +1290,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB89_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB89_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB89_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB89_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB89_4: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB89_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val syncscope("singlethread") seq_cst seq_cst @@ -1488,14 +1308,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 16 ; PPC64LE-NEXT: .LBB90_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB90_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB90_1 -; PPC64LE-NEXT: .LBB90_3: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB90_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") monotonic monotonic ret void @@ -1507,16 +1325,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 16 ; PPC64LE-NEXT: .LBB91_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB91_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB91_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB91_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB91_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB91_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") acquire monotonic @@ -1529,16 +1343,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 16 ; PPC64LE-NEXT: .LBB92_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB92_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB92_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB92_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB92_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB92_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") acquire acquire @@ -1552,14 +1362,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB93_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB93_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB93_1 -; PPC64LE-NEXT: .LBB93_3: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB93_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") release monotonic ret void @@ -1572,16 +1380,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB94_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB94_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB94_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB94_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB94_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB94_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") release acquire @@ -1595,16 +1399,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB95_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB95_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB95_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB95_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB95_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB95_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") acq_rel monotonic @@ -1618,16 +1418,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB96_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB96_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB96_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB96_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB96_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB96_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") acq_rel acquire @@ -1641,16 +1437,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB97_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB97_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB97_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB97_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB97_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB97_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") seq_cst monotonic @@ -1664,16 +1456,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB98_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB98_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB98_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB98_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB98_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB98_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") seq_cst acquire @@ -1687,16 +1475,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB99_1: ; PPC64LE-NEXT: lharx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB99_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB99_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB99_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB99_4: -; PPC64LE-NEXT: sthcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB99_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i16* %ptr, i16 %cmp, i16 %val syncscope("singlethread") seq_cst seq_cst @@ -1708,14 +1492,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB100_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB100_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB100_1 -; PPC64LE-NEXT: .LBB100_3: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB100_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") monotonic monotonic ret void @@ -1726,16 +1508,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB101_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB101_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB101_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB101_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB101_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB101_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") acquire monotonic @@ -1747,16 +1525,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB102_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB102_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB102_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB102_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB102_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB102_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") acquire acquire @@ -1769,14 +1543,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB103_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB103_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB103_1 -; PPC64LE-NEXT: .LBB103_3: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB103_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") release monotonic ret void @@ -1788,16 +1560,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB104_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB104_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB104_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB104_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB104_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB104_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") release acquire @@ -1810,16 +1578,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB105_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB105_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB105_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB105_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB105_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB105_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") acq_rel monotonic @@ -1832,16 +1596,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB106_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB106_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB106_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB106_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB106_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB106_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") acq_rel acquire @@ -1854,16 +1614,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB107_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB107_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB107_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB107_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB107_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB107_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") seq_cst monotonic @@ -1876,16 +1632,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB108_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB108_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB108_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB108_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB108_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB108_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") seq_cst acquire @@ -1898,16 +1650,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB109_1: ; PPC64LE-NEXT: lwarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB109_4 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bne 0, .LBB109_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB109_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB109_4: -; PPC64LE-NEXT: stwcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB109_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i32* %ptr, i32 %cmp, i32 %val syncscope("singlethread") seq_cst seq_cst @@ -1919,14 +1667,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB110_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB110_3 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB110_1 -; PPC64LE-NEXT: .LBB110_3: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB110_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") monotonic monotonic ret void @@ -1937,16 +1683,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB111_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB111_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB111_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB111_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB111_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB111_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") acquire monotonic @@ -1958,16 +1700,12 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB112_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB112_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB112_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB112_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB112_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB112_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") acquire acquire @@ -1980,14 +1718,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB113_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB113_3 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB113_1 -; PPC64LE-NEXT: .LBB113_3: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB113_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") release monotonic ret void @@ -1999,16 +1735,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB114_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB114_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB114_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB114_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB114_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB114_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") release acquire @@ -2021,16 +1753,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB115_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB115_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB115_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB115_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB115_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB115_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") acq_rel monotonic @@ -2043,16 +1771,12 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB116_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB116_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB116_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB116_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB116_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB116_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") acq_rel acquire @@ -2065,16 +1789,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB117_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB117_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB117_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB117_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB117_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB117_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") seq_cst monotonic @@ -2087,16 +1807,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB118_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB118_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB118_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB118_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB118_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB118_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") seq_cst acquire @@ -2109,16 +1825,12 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB119_1: ; PPC64LE-NEXT: ldarx 6, 0, 3 -; PPC64LE-NEXT: cmpd 4, 6 -; PPC64LE-NEXT: bne 0, .LBB119_4 +; PPC64LE-NEXT: cmpd 6, 4 +; PPC64LE-NEXT: bne 0, .LBB119_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB119_1 -; PPC64LE-NEXT: # %bb.3: -; PPC64LE-NEXT: lwsync -; PPC64LE-NEXT: blr -; PPC64LE-NEXT: .LBB119_4: -; PPC64LE-NEXT: stdcx. 6, 0, 3 +; PPC64LE-NEXT: .LBB119_3: ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: blr %res = cmpxchg i64* %ptr, i64 %cmp, i64 %val syncscope("singlethread") seq_cst seq_cst @@ -4380,8 +4092,8 @@ ; PPC64LE-NEXT: .LBB260_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB260_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB260_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB260_1 @@ -4399,8 +4111,8 @@ ; PPC64LE-NEXT: .LBB261_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB261_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB261_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB261_1 @@ -4420,8 +4132,8 @@ ; PPC64LE-NEXT: .LBB262_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB262_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB262_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB262_1 @@ -4440,8 +4152,8 @@ ; PPC64LE-NEXT: .LBB263_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB263_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB263_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB263_1 @@ -4461,8 +4173,8 @@ ; PPC64LE-NEXT: .LBB264_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB264_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB264_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB264_1 @@ -4481,8 +4193,8 @@ ; PPC64LE-NEXT: .LBB265_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB265_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB265_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB265_1 @@ -4500,8 +4212,8 @@ ; PPC64LE-NEXT: .LBB266_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB266_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB266_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB266_1 @@ -4521,8 +4233,8 @@ ; PPC64LE-NEXT: .LBB267_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB267_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB267_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB267_1 @@ -4541,8 +4253,8 @@ ; PPC64LE-NEXT: .LBB268_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB268_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB268_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB268_1 @@ -4562,8 +4274,8 @@ ; PPC64LE-NEXT: .LBB269_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB269_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB269_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB269_1 @@ -4580,8 +4292,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB270_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB270_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB270_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB270_1 @@ -4598,8 +4310,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB271_1: ; PPC64LE-NEXT: lwarx 3, 0, 5 -; PPC64LE-NEXT: cmpw 4, 3 -; PPC64LE-NEXT: ble 0, .LBB271_3 +; PPC64LE-NEXT: cmpw 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB271_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB271_1 @@ -4616,8 +4328,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB272_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB272_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB272_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB272_1 @@ -4634,8 +4346,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB273_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB273_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB273_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB273_1 @@ -4653,8 +4365,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB274_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB274_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB274_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB274_1 @@ -4671,8 +4383,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB275_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: ble 0, .LBB275_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB275_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB275_1 @@ -4689,8 +4401,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB276_1: ; PPC64LE-NEXT: ldarx 3, 0, 5 -; PPC64LE-NEXT: cmpd 4, 3 -; PPC64LE-NEXT: ble 0, .LBB276_3 +; PPC64LE-NEXT: cmpd 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB276_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB276_1 @@ -4707,8 +4419,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB277_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: ble 0, .LBB277_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB277_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB277_1 @@ -4725,8 +4437,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB278_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: ble 0, .LBB278_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB278_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB278_1 @@ -4744,8 +4456,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB279_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: ble 0, .LBB279_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB279_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB279_1 @@ -4764,8 +4476,8 @@ ; PPC64LE-NEXT: .LBB280_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB280_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB280_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB280_1 @@ -4783,8 +4495,8 @@ ; PPC64LE-NEXT: .LBB281_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB281_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB281_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB281_1 @@ -4804,8 +4516,8 @@ ; PPC64LE-NEXT: .LBB282_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB282_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB282_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB282_1 @@ -4824,8 +4536,8 @@ ; PPC64LE-NEXT: .LBB283_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB283_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB283_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB283_1 @@ -4845,8 +4557,8 @@ ; PPC64LE-NEXT: .LBB284_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB284_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB284_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB284_1 @@ -4865,8 +4577,8 @@ ; PPC64LE-NEXT: .LBB285_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB285_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB285_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB285_1 @@ -4884,8 +4596,8 @@ ; PPC64LE-NEXT: .LBB286_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB286_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB286_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB286_1 @@ -4905,8 +4617,8 @@ ; PPC64LE-NEXT: .LBB287_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB287_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB287_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB287_1 @@ -4925,8 +4637,8 @@ ; PPC64LE-NEXT: .LBB288_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB288_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB288_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB288_1 @@ -4946,8 +4658,8 @@ ; PPC64LE-NEXT: .LBB289_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB289_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB289_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB289_1 @@ -4964,8 +4676,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB290_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB290_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB290_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB290_1 @@ -4982,8 +4694,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB291_1: ; PPC64LE-NEXT: lwarx 3, 0, 5 -; PPC64LE-NEXT: cmpw 4, 3 -; PPC64LE-NEXT: bge 0, .LBB291_3 +; PPC64LE-NEXT: cmpw 3, 4 +; PPC64LE-NEXT: blt 0, .LBB291_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB291_1 @@ -5000,8 +4712,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB292_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB292_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB292_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB292_1 @@ -5018,8 +4730,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB293_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB293_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB293_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB293_1 @@ -5037,8 +4749,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB294_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB294_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB294_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB294_1 @@ -5055,8 +4767,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB295_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: bge 0, .LBB295_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: blt 0, .LBB295_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB295_1 @@ -5073,8 +4785,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB296_1: ; PPC64LE-NEXT: ldarx 3, 0, 5 -; PPC64LE-NEXT: cmpd 4, 3 -; PPC64LE-NEXT: bge 0, .LBB296_3 +; PPC64LE-NEXT: cmpd 3, 4 +; PPC64LE-NEXT: blt 0, .LBB296_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB296_1 @@ -5091,8 +4803,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB297_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: bge 0, .LBB297_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: blt 0, .LBB297_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB297_1 @@ -5109,8 +4821,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB298_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: bge 0, .LBB298_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: blt 0, .LBB298_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB298_1 @@ -5128,8 +4840,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB299_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: bge 0, .LBB299_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: blt 0, .LBB299_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB299_1 @@ -5146,8 +4858,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB300_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB300_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB300_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB300_1 @@ -5164,8 +4876,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB301_1: ; PPC64LE-NEXT: lbarx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: ble 0, .LBB301_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB301_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB301_1 @@ -5182,8 +4894,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB302_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB302_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB302_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB302_1 @@ -5200,8 +4912,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB303_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB303_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB303_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB303_1 @@ -5219,8 +4931,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB304_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB304_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB304_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB304_1 @@ -5237,8 +4949,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB305_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB305_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB305_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB305_1 @@ -5255,8 +4967,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB306_1: ; PPC64LE-NEXT: lharx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: ble 0, .LBB306_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB306_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB306_1 @@ -5273,8 +4985,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB307_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB307_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB307_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB307_1 @@ -5291,8 +5003,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB308_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB308_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB308_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB308_1 @@ -5310,8 +5022,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB309_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB309_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB309_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB309_1 @@ -5328,8 +5040,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB310_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB310_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB310_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB310_1 @@ -5346,8 +5058,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB311_1: ; PPC64LE-NEXT: lwarx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: ble 0, .LBB311_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB311_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB311_1 @@ -5364,8 +5076,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB312_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB312_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB312_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB312_1 @@ -5382,8 +5094,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB313_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB313_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB313_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB313_1 @@ -5401,8 +5113,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB314_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB314_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB314_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB314_1 @@ -5419,8 +5131,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB315_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: ble 0, .LBB315_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB315_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB315_1 @@ -5437,8 +5149,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB316_1: ; PPC64LE-NEXT: ldarx 3, 0, 5 -; PPC64LE-NEXT: cmpld 4, 3 -; PPC64LE-NEXT: ble 0, .LBB316_3 +; PPC64LE-NEXT: cmpld 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB316_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB316_1 @@ -5455,8 +5167,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB317_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: ble 0, .LBB317_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB317_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB317_1 @@ -5473,8 +5185,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB318_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: ble 0, .LBB318_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB318_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB318_1 @@ -5492,8 +5204,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB319_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: ble 0, .LBB319_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB319_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB319_1 @@ -5510,8 +5222,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB320_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB320_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB320_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB320_1 @@ -5528,8 +5240,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB321_1: ; PPC64LE-NEXT: lbarx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: bge 0, .LBB321_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: blt 0, .LBB321_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB321_1 @@ -5546,8 +5258,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB322_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB322_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB322_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB322_1 @@ -5564,8 +5276,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB323_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB323_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB323_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB323_1 @@ -5583,8 +5295,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB324_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB324_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB324_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB324_1 @@ -5601,8 +5313,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB325_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB325_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB325_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB325_1 @@ -5619,8 +5331,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB326_1: ; PPC64LE-NEXT: lharx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: bge 0, .LBB326_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: blt 0, .LBB326_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB326_1 @@ -5637,8 +5349,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB327_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB327_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB327_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB327_1 @@ -5655,8 +5367,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB328_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB328_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB328_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB328_1 @@ -5674,8 +5386,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB329_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB329_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB329_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB329_1 @@ -5692,8 +5404,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB330_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB330_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB330_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB330_1 @@ -5710,8 +5422,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB331_1: ; PPC64LE-NEXT: lwarx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: bge 0, .LBB331_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: blt 0, .LBB331_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB331_1 @@ -5728,8 +5440,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB332_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB332_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB332_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB332_1 @@ -5746,8 +5458,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB333_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB333_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB333_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB333_1 @@ -5765,8 +5477,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB334_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB334_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB334_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB334_1 @@ -5783,8 +5495,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB335_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: bge 0, .LBB335_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: blt 0, .LBB335_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB335_1 @@ -5801,8 +5513,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB336_1: ; PPC64LE-NEXT: ldarx 3, 0, 5 -; PPC64LE-NEXT: cmpld 4, 3 -; PPC64LE-NEXT: bge 0, .LBB336_3 +; PPC64LE-NEXT: cmpld 3, 4 +; PPC64LE-NEXT: blt 0, .LBB336_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB336_1 @@ -5819,8 +5531,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB337_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: bge 0, .LBB337_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: blt 0, .LBB337_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB337_1 @@ -5837,8 +5549,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB338_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: bge 0, .LBB338_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: blt 0, .LBB338_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB338_1 @@ -5856,8 +5568,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB339_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: bge 0, .LBB339_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: blt 0, .LBB339_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB339_1 @@ -8124,8 +7836,8 @@ ; PPC64LE-NEXT: .LBB480_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB480_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB480_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB480_1 @@ -8143,8 +7855,8 @@ ; PPC64LE-NEXT: .LBB481_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB481_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB481_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB481_1 @@ -8164,8 +7876,8 @@ ; PPC64LE-NEXT: .LBB482_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB482_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB482_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB482_1 @@ -8184,8 +7896,8 @@ ; PPC64LE-NEXT: .LBB483_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB483_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB483_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB483_1 @@ -8205,8 +7917,8 @@ ; PPC64LE-NEXT: .LBB484_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB484_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB484_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB484_1 @@ -8225,8 +7937,8 @@ ; PPC64LE-NEXT: .LBB485_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB485_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB485_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB485_1 @@ -8244,8 +7956,8 @@ ; PPC64LE-NEXT: .LBB486_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB486_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB486_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB486_1 @@ -8265,8 +7977,8 @@ ; PPC64LE-NEXT: .LBB487_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB487_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB487_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB487_1 @@ -8285,8 +7997,8 @@ ; PPC64LE-NEXT: .LBB488_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB488_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB488_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB488_1 @@ -8306,8 +8018,8 @@ ; PPC64LE-NEXT: .LBB489_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: ble 0, .LBB489_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: bgt 0, .LBB489_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB489_1 @@ -8324,8 +8036,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB490_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB490_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB490_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB490_1 @@ -8342,8 +8054,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB491_1: ; PPC64LE-NEXT: lwarx 3, 0, 5 -; PPC64LE-NEXT: cmpw 4, 3 -; PPC64LE-NEXT: ble 0, .LBB491_3 +; PPC64LE-NEXT: cmpw 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB491_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB491_1 @@ -8360,8 +8072,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB492_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB492_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB492_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB492_1 @@ -8378,8 +8090,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB493_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB493_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB493_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB493_1 @@ -8397,8 +8109,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB494_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB494_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB494_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB494_1 @@ -8415,8 +8127,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB495_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: ble 0, .LBB495_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB495_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB495_1 @@ -8433,8 +8145,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB496_1: ; PPC64LE-NEXT: ldarx 3, 0, 5 -; PPC64LE-NEXT: cmpd 4, 3 -; PPC64LE-NEXT: ble 0, .LBB496_3 +; PPC64LE-NEXT: cmpd 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB496_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB496_1 @@ -8451,8 +8163,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB497_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: ble 0, .LBB497_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB497_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB497_1 @@ -8469,8 +8181,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB498_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: ble 0, .LBB498_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB498_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB498_1 @@ -8488,8 +8200,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB499_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: ble 0, .LBB499_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB499_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB499_1 @@ -8508,8 +8220,8 @@ ; PPC64LE-NEXT: .LBB500_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB500_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB500_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB500_1 @@ -8527,8 +8239,8 @@ ; PPC64LE-NEXT: .LBB501_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB501_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB501_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB501_1 @@ -8548,8 +8260,8 @@ ; PPC64LE-NEXT: .LBB502_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB502_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB502_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB502_1 @@ -8568,8 +8280,8 @@ ; PPC64LE-NEXT: .LBB503_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB503_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB503_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB503_1 @@ -8589,8 +8301,8 @@ ; PPC64LE-NEXT: .LBB504_1: ; PPC64LE-NEXT: lbarx 4, 0, 3 ; PPC64LE-NEXT: extsb 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB504_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB504_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB504_1 @@ -8609,8 +8321,8 @@ ; PPC64LE-NEXT: .LBB505_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB505_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB505_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB505_1 @@ -8628,8 +8340,8 @@ ; PPC64LE-NEXT: .LBB506_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB506_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB506_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB506_1 @@ -8649,8 +8361,8 @@ ; PPC64LE-NEXT: .LBB507_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB507_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB507_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB507_1 @@ -8669,8 +8381,8 @@ ; PPC64LE-NEXT: .LBB508_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB508_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB508_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB508_1 @@ -8690,8 +8402,8 @@ ; PPC64LE-NEXT: .LBB509_1: ; PPC64LE-NEXT: lharx 4, 0, 3 ; PPC64LE-NEXT: extsh 6, 4 -; PPC64LE-NEXT: cmpw 5, 6 -; PPC64LE-NEXT: bge 0, .LBB509_3 +; PPC64LE-NEXT: cmpw 6, 5 +; PPC64LE-NEXT: blt 0, .LBB509_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 5, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB509_1 @@ -8708,8 +8420,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB510_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB510_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB510_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB510_1 @@ -8726,8 +8438,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB511_1: ; PPC64LE-NEXT: lwarx 3, 0, 5 -; PPC64LE-NEXT: cmpw 4, 3 -; PPC64LE-NEXT: bge 0, .LBB511_3 +; PPC64LE-NEXT: cmpw 3, 4 +; PPC64LE-NEXT: blt 0, .LBB511_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB511_1 @@ -8744,8 +8456,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB512_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB512_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB512_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB512_1 @@ -8762,8 +8474,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB513_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB513_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB513_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB513_1 @@ -8781,8 +8493,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB514_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmpw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB514_3 +; PPC64LE-NEXT: cmpw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB514_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB514_1 @@ -8799,8 +8511,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB515_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: bge 0, .LBB515_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: blt 0, .LBB515_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB515_1 @@ -8817,8 +8529,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB516_1: ; PPC64LE-NEXT: ldarx 3, 0, 5 -; PPC64LE-NEXT: cmpd 4, 3 -; PPC64LE-NEXT: bge 0, .LBB516_3 +; PPC64LE-NEXT: cmpd 3, 4 +; PPC64LE-NEXT: blt 0, .LBB516_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB516_1 @@ -8835,8 +8547,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB517_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: bge 0, .LBB517_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: blt 0, .LBB517_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB517_1 @@ -8853,8 +8565,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB518_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: bge 0, .LBB518_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: blt 0, .LBB518_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB518_1 @@ -8872,8 +8584,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB519_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpd 4, 5 -; PPC64LE-NEXT: bge 0, .LBB519_3 +; PPC64LE-NEXT: cmpd 5, 4 +; PPC64LE-NEXT: blt 0, .LBB519_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB519_1 @@ -8890,8 +8602,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB520_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB520_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB520_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB520_1 @@ -8908,8 +8620,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB521_1: ; PPC64LE-NEXT: lbarx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: ble 0, .LBB521_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB521_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB521_1 @@ -8926,8 +8638,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB522_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB522_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB522_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB522_1 @@ -8944,8 +8656,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB523_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB523_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB523_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB523_1 @@ -8963,8 +8675,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB524_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB524_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB524_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB524_1 @@ -8981,8 +8693,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB525_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB525_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB525_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB525_1 @@ -8999,8 +8711,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB526_1: ; PPC64LE-NEXT: lharx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: ble 0, .LBB526_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB526_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB526_1 @@ -9017,8 +8729,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB527_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB527_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB527_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB527_1 @@ -9035,8 +8747,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB528_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB528_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB528_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB528_1 @@ -9054,8 +8766,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB529_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB529_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB529_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB529_1 @@ -9072,8 +8784,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB530_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB530_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB530_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB530_1 @@ -9090,8 +8802,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB531_1: ; PPC64LE-NEXT: lwarx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: ble 0, .LBB531_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB531_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB531_1 @@ -9108,8 +8820,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB532_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB532_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB532_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB532_1 @@ -9126,8 +8838,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB533_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB533_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB533_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB533_1 @@ -9145,8 +8857,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB534_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: ble 0, .LBB534_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB534_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB534_1 @@ -9163,8 +8875,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB535_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: ble 0, .LBB535_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB535_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB535_1 @@ -9181,8 +8893,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB536_1: ; PPC64LE-NEXT: ldarx 3, 0, 5 -; PPC64LE-NEXT: cmpld 4, 3 -; PPC64LE-NEXT: ble 0, .LBB536_3 +; PPC64LE-NEXT: cmpld 3, 4 +; PPC64LE-NEXT: bgt 0, .LBB536_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB536_1 @@ -9199,8 +8911,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB537_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: ble 0, .LBB537_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB537_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB537_1 @@ -9217,8 +8929,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB538_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: ble 0, .LBB538_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB538_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB538_1 @@ -9236,8 +8948,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB539_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: ble 0, .LBB539_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: bgt 0, .LBB539_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB539_1 @@ -9254,8 +8966,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB540_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB540_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB540_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB540_1 @@ -9272,8 +8984,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB541_1: ; PPC64LE-NEXT: lbarx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: bge 0, .LBB541_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: blt 0, .LBB541_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB541_1 @@ -9290,8 +9002,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB542_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB542_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB542_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB542_1 @@ -9308,8 +9020,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB543_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB543_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB543_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB543_1 @@ -9327,8 +9039,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB544_1: ; PPC64LE-NEXT: lbarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB544_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB544_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB544_1 @@ -9345,8 +9057,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB545_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB545_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB545_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB545_1 @@ -9363,8 +9075,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB546_1: ; PPC64LE-NEXT: lharx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: bge 0, .LBB546_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: blt 0, .LBB546_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB546_1 @@ -9381,8 +9093,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB547_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB547_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB547_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB547_1 @@ -9399,8 +9111,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB548_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB548_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB548_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB548_1 @@ -9418,8 +9130,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB549_1: ; PPC64LE-NEXT: lharx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB549_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB549_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: sthcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB549_1 @@ -9436,8 +9148,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB550_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB550_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB550_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB550_1 @@ -9454,8 +9166,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB551_1: ; PPC64LE-NEXT: lwarx 3, 0, 5 -; PPC64LE-NEXT: cmplw 4, 3 -; PPC64LE-NEXT: bge 0, .LBB551_3 +; PPC64LE-NEXT: cmplw 3, 4 +; PPC64LE-NEXT: blt 0, .LBB551_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB551_1 @@ -9472,8 +9184,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB552_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB552_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB552_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB552_1 @@ -9490,8 +9202,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB553_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB553_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB553_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB553_1 @@ -9509,8 +9221,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB554_1: ; PPC64LE-NEXT: lwarx 5, 0, 3 -; PPC64LE-NEXT: cmplw 4, 5 -; PPC64LE-NEXT: bge 0, .LBB554_3 +; PPC64LE-NEXT: cmplw 5, 4 +; PPC64LE-NEXT: blt 0, .LBB554_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stwcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB554_1 @@ -9527,8 +9239,8 @@ ; PPC64LE: # %bb.0: ; PPC64LE-NEXT: .LBB555_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: bge 0, .LBB555_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: blt 0, .LBB555_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB555_1 @@ -9545,8 +9257,8 @@ ; PPC64LE-NEXT: mr 5, 3 ; PPC64LE-NEXT: .LBB556_1: ; PPC64LE-NEXT: ldarx 3, 0, 5 -; PPC64LE-NEXT: cmpld 4, 3 -; PPC64LE-NEXT: bge 0, .LBB556_3 +; PPC64LE-NEXT: cmpld 3, 4 +; PPC64LE-NEXT: blt 0, .LBB556_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 5 ; PPC64LE-NEXT: bne 0, .LBB556_1 @@ -9563,8 +9275,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB557_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: bge 0, .LBB557_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: blt 0, .LBB557_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB557_1 @@ -9581,8 +9293,8 @@ ; PPC64LE-NEXT: lwsync ; PPC64LE-NEXT: .LBB558_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: bge 0, .LBB558_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: blt 0, .LBB558_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB558_1 @@ -9600,8 +9312,8 @@ ; PPC64LE-NEXT: sync ; PPC64LE-NEXT: .LBB559_1: ; PPC64LE-NEXT: ldarx 5, 0, 3 -; PPC64LE-NEXT: cmpld 4, 5 -; PPC64LE-NEXT: bge 0, .LBB559_3 +; PPC64LE-NEXT: cmpld 5, 4 +; PPC64LE-NEXT: blt 0, .LBB559_3 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stdcx. 4, 0, 3 ; PPC64LE-NEXT: bne 0, .LBB559_1 diff --git a/llvm/test/CodeGen/PowerPC/atomics.ll b/llvm/test/CodeGen/PowerPC/atomics.ll --- a/llvm/test/CodeGen/PowerPC/atomics.ll +++ b/llvm/test/CodeGen/PowerPC/atomics.ll @@ -143,27 +143,24 @@ ; PPC32-NEXT: li r7, 255 ; PPC32-NEXT: rlwinm r4, r3, 0, 0, 29 ; PPC32-NEXT: xori r3, r8, 24 -; PPC32-NEXT: slw r5, r5, r3 -; PPC32-NEXT: slw r8, r6, r3 -; PPC32-NEXT: slw r6, r7, r3 -; PPC32-NEXT: and r7, r5, r6 -; PPC32-NEXT: and r8, r8, r6 +; PPC32-NEXT: slw r8, r5, r3 +; PPC32-NEXT: slw r9, r6, r3 +; PPC32-NEXT: slw r5, r7, r3 +; PPC32-NEXT: and r6, r8, r5 +; PPC32-NEXT: and r7, r9, r5 ; PPC32-NEXT: sync ; PPC32-NEXT: .LBB8_1: ; PPC32-NEXT: lwarx r9, 0, r4 -; PPC32-NEXT: and r5, r9, r6 -; PPC32-NEXT: cmpw r5, r8 +; PPC32-NEXT: and r8, r9, r5 +; PPC32-NEXT: cmpw r8, r7 ; PPC32-NEXT: bne cr0, .LBB8_3 ; PPC32-NEXT: # %bb.2: -; PPC32-NEXT: andc r9, r9, r6 -; PPC32-NEXT: or r9, r9, r7 +; PPC32-NEXT: andc r9, r9, r5 +; PPC32-NEXT: or r9, r9, r6 ; PPC32-NEXT: stwcx. r9, 0, r4 ; PPC32-NEXT: bne cr0, .LBB8_1 -; PPC32-NEXT: b .LBB8_4 ; PPC32-NEXT: .LBB8_3: -; PPC32-NEXT: stwcx. r9, 0, r4 -; PPC32-NEXT: .LBB8_4: -; PPC32-NEXT: srw r3, r5, r3 +; PPC32-NEXT: srw r3, r8, r3 ; PPC32-NEXT: lwsync ; PPC32-NEXT: blr ; @@ -175,27 +172,24 @@ ; PPC64-NEXT: li r7, 255 ; PPC64-NEXT: rldicr r4, r3, 0, 61 ; PPC64-NEXT: xori r3, r8, 24 -; PPC64-NEXT: slw r5, r5, r3 -; PPC64-NEXT: slw r8, r6, r3 -; PPC64-NEXT: slw r6, r7, r3 -; PPC64-NEXT: and r7, r5, r6 -; PPC64-NEXT: and r8, r8, r6 +; PPC64-NEXT: slw r8, r5, r3 +; PPC64-NEXT: slw r9, r6, r3 +; PPC64-NEXT: slw r5, r7, r3 +; PPC64-NEXT: and r6, r8, r5 +; PPC64-NEXT: and r7, r9, r5 ; PPC64-NEXT: sync ; PPC64-NEXT: .LBB8_1: ; PPC64-NEXT: lwarx r9, 0, r4 -; PPC64-NEXT: and r5, r9, r6 -; PPC64-NEXT: cmpw r5, r8 +; PPC64-NEXT: and r8, r9, r5 +; PPC64-NEXT: cmpw r8, r7 ; PPC64-NEXT: bne cr0, .LBB8_3 ; PPC64-NEXT: # %bb.2: -; PPC64-NEXT: andc r9, r9, r6 -; PPC64-NEXT: or r9, r9, r7 +; PPC64-NEXT: andc r9, r9, r5 +; PPC64-NEXT: or r9, r9, r6 ; PPC64-NEXT: stwcx. r9, 0, r4 ; PPC64-NEXT: bne cr0, .LBB8_1 -; PPC64-NEXT: b .LBB8_4 ; PPC64-NEXT: .LBB8_3: -; PPC64-NEXT: stwcx. r9, 0, r4 -; PPC64-NEXT: .LBB8_4: -; PPC64-NEXT: srw r3, r5, r3 +; PPC64-NEXT: srw r3, r8, r3 ; PPC64-NEXT: lwsync ; PPC64-NEXT: blr %val = cmpxchg i8* %mem, i8 0, i8 1 seq_cst seq_cst @@ -215,22 +209,19 @@ ; PPC32-NEXT: slw r5, r7, r4 ; PPC32-NEXT: rlwinm r3, r3, 0, 0, 29 ; PPC32-NEXT: and r6, r8, r5 -; PPC32-NEXT: and r8, r9, r5 +; PPC32-NEXT: and r7, r9, r5 ; PPC32-NEXT: .LBB9_1: ; PPC32-NEXT: lwarx r9, 0, r3 -; PPC32-NEXT: and r7, r9, r5 -; PPC32-NEXT: cmpw r7, r8 +; PPC32-NEXT: and r8, r9, r5 +; PPC32-NEXT: cmpw r8, r7 ; PPC32-NEXT: bne cr0, .LBB9_3 ; PPC32-NEXT: # %bb.2: ; PPC32-NEXT: andc r9, r9, r5 ; PPC32-NEXT: or r9, r9, r6 ; PPC32-NEXT: stwcx. r9, 0, r3 ; PPC32-NEXT: bne cr0, .LBB9_1 -; PPC32-NEXT: b .LBB9_4 ; PPC32-NEXT: .LBB9_3: -; PPC32-NEXT: stwcx. r9, 0, r3 -; PPC32-NEXT: .LBB9_4: -; PPC32-NEXT: srw r3, r7, r4 +; PPC32-NEXT: srw r3, r8, r4 ; PPC32-NEXT: lwsync ; PPC32-NEXT: blr ; @@ -246,22 +237,19 @@ ; PPC64-NEXT: slw r5, r7, r4 ; PPC64-NEXT: rldicr r3, r3, 0, 61 ; PPC64-NEXT: and r6, r8, r5 -; PPC64-NEXT: and r8, r9, r5 +; PPC64-NEXT: and r7, r9, r5 ; PPC64-NEXT: .LBB9_1: ; PPC64-NEXT: lwarx r9, 0, r3 -; PPC64-NEXT: and r7, r9, r5 -; PPC64-NEXT: cmpw r7, r8 +; PPC64-NEXT: and r8, r9, r5 +; PPC64-NEXT: cmpw r8, r7 ; PPC64-NEXT: bne cr0, .LBB9_3 ; PPC64-NEXT: # %bb.2: ; PPC64-NEXT: andc r9, r9, r5 ; PPC64-NEXT: or r9, r9, r6 ; PPC64-NEXT: stwcx. r9, 0, r3 ; PPC64-NEXT: bne cr0, .LBB9_1 -; PPC64-NEXT: b .LBB9_4 ; PPC64-NEXT: .LBB9_3: -; PPC64-NEXT: stwcx. r9, 0, r3 -; PPC64-NEXT: .LBB9_4: -; PPC64-NEXT: srw r3, r7, r4 +; PPC64-NEXT: srw r3, r8, r4 ; PPC64-NEXT: lwsync ; PPC64-NEXT: blr %val = cmpxchg weak i16* %mem, i16 0, i16 1 acquire acquire @@ -272,19 +260,15 @@ ; CHECK-LABEL: cas_strong_i32_acqrel_acquire: ; CHECK: # %bb.0: ; CHECK-NEXT: li r5, 1 -; CHECK-NEXT: li r6, 0 ; CHECK-NEXT: lwsync ; CHECK-NEXT: .LBB10_1: ; CHECK-NEXT: lwarx r4, 0, r3 -; CHECK-NEXT: cmpw r6, r4 +; CHECK-NEXT: cmpwi r4, 0 ; CHECK-NEXT: bne cr0, .LBB10_3 ; CHECK-NEXT: # %bb.2: ; CHECK-NEXT: stwcx. r5, 0, r3 ; CHECK-NEXT: bne cr0, .LBB10_1 -; CHECK-NEXT: b .LBB10_4 ; CHECK-NEXT: .LBB10_3: -; CHECK-NEXT: stwcx. r4, 0, r3 -; CHECK-NEXT: .LBB10_4: ; CHECK-NEXT: mr r3, r4 ; CHECK-NEXT: lwsync ; CHECK-NEXT: blr @@ -319,20 +303,15 @@ ; PPC64-LABEL: cas_weak_i64_release_monotonic: ; PPC64: # %bb.0: ; PPC64-NEXT: li r5, 1 -; PPC64-NEXT: li r6, 0 ; PPC64-NEXT: lwsync ; PPC64-NEXT: .LBB11_1: ; PPC64-NEXT: ldarx r4, 0, r3 -; PPC64-NEXT: cmpd r6, r4 -; PPC64-NEXT: bne cr0, .LBB11_4 +; PPC64-NEXT: cmpdi r4, 0 +; PPC64-NEXT: bne cr0, .LBB11_3 ; PPC64-NEXT: # %bb.2: ; PPC64-NEXT: stdcx. r5, 0, r3 ; PPC64-NEXT: bne cr0, .LBB11_1 -; PPC64-NEXT: # %bb.3: -; PPC64-NEXT: mr r3, r4 -; PPC64-NEXT: blr -; PPC64-NEXT: .LBB11_4: -; PPC64-NEXT: stdcx. r4, 0, r3 +; PPC64-NEXT: .LBB11_3: ; PPC64-NEXT: mr r3, r4 ; PPC64-NEXT: blr %val = cmpxchg weak i64* %mem, i64 0, i64 1 release monotonic diff --git a/llvm/test/CodeGen/PowerPC/branch-on-store-cond.ll b/llvm/test/CodeGen/PowerPC/branch-on-store-cond.ll new file mode 100644 --- /dev/null +++ b/llvm/test/CodeGen/PowerPC/branch-on-store-cond.ll @@ -0,0 +1,209 @@ +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu \ +; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-aix \ +; RUN: -mcpu=pwr8 < %s | FileCheck %s --check-prefix=CHECK-AIX + +define dso_local zeroext i8 @test1(ptr noundef %addr, i8 noundef zeroext %newval) local_unnamed_addr #0 { +; CHECK-LABEL: test1: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: mflr 0 +; CHECK-NEXT: std 0, 16(1) +; CHECK-NEXT: stdu 1, -32(1) +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: .cfi_offset lr, 16 +; CHECK-NEXT: stbcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB0_2 +; CHECK-NEXT: # %bb.1: # %if.then +; CHECK-NEXT: bl dummy +; CHECK-NEXT: nop +; CHECK-NEXT: .LBB0_2: # %if.end +; CHECK-NEXT: li 3, 55 +; CHECK-NEXT: addi 1, 1, 32 +; CHECK-NEXT: ld 0, 16(1) +; CHECK-NEXT: mtlr 0 +; CHECK-NEXT: blr +; +; CHECK-AIX-LABEL: test1: +; CHECK-AIX: # %bb.0: # %entry +; CHECK-AIX-NEXT: mflr 0 +; CHECK-AIX-NEXT: std 0, 16(1) +; CHECK-AIX-NEXT: stdu 1, -112(1) +; CHECK-AIX-NEXT: stbcx. 4, 0, 3 +; CHECK-AIX-NEXT: bne 0, L..BB0_2 +; CHECK-AIX-NEXT: # %bb.1: # %if.then +; CHECK-AIX-NEXT: bl .dummy[PR] +; CHECK-AIX-NEXT: nop +; CHECK-AIX-NEXT: L..BB0_2: # %if.end +; CHECK-AIX-NEXT: li 3, 55 +; CHECK-AIX-NEXT: addi 1, 1, 112 +; CHECK-AIX-NEXT: ld 0, 16(1) +; CHECK-AIX-NEXT: mtlr 0 +; CHECK-AIX-NEXT: blr +entry: + %conv = zext i8 %newval to i32 + %0 = tail call i32 @llvm.ppc.stbcx(ptr %addr, i32 %conv) + %tobool.not = icmp eq i32 %0, 0 + br i1 %tobool.not, label %if.end, label %if.then + +if.then: ; preds = %entry + tail call void @dummy() #3 + br label %if.end + +if.end: ; preds = %if.then, %entry + ret i8 55 +} + +define dso_local signext i16 @test2(ptr noundef %addr, i16 noundef signext %newval) local_unnamed_addr #0 { +; CHECK-LABEL: test2: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: mflr 0 +; CHECK-NEXT: std 0, 16(1) +; CHECK-NEXT: stdu 1, -32(1) +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: .cfi_offset lr, 16 +; CHECK-NEXT: sthcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB1_2 +; CHECK-NEXT: # %bb.1: # %if.then +; CHECK-NEXT: bl dummy +; CHECK-NEXT: nop +; CHECK-NEXT: .LBB1_2: # %if.end +; CHECK-NEXT: li 3, 55 +; CHECK-NEXT: addi 1, 1, 32 +; CHECK-NEXT: ld 0, 16(1) +; CHECK-NEXT: mtlr 0 +; CHECK-NEXT: blr +; +; CHECK-AIX-LABEL: test2: +; CHECK-AIX: # %bb.0: # %entry +; CHECK-AIX-NEXT: mflr 0 +; CHECK-AIX-NEXT: std 0, 16(1) +; CHECK-AIX-NEXT: stdu 1, -112(1) +; CHECK-AIX-NEXT: sthcx. 4, 0, 3 +; CHECK-AIX-NEXT: bne 0, L..BB1_2 +; CHECK-AIX-NEXT: # %bb.1: # %if.then +; CHECK-AIX-NEXT: bl .dummy[PR] +; CHECK-AIX-NEXT: nop +; CHECK-AIX-NEXT: L..BB1_2: # %if.end +; CHECK-AIX-NEXT: li 3, 55 +; CHECK-AIX-NEXT: addi 1, 1, 112 +; CHECK-AIX-NEXT: ld 0, 16(1) +; CHECK-AIX-NEXT: mtlr 0 +; CHECK-AIX-NEXT: blr +entry: + %0 = sext i16 %newval to i32 + %1 = tail call i32 @llvm.ppc.sthcx(ptr %addr, i32 %0) + %tobool.not = icmp eq i32 %1, 0 + br i1 %tobool.not, label %if.end, label %if.then + +if.then: ; preds = %entry + tail call void @dummy() #3 + br label %if.end + +if.end: ; preds = %if.then, %entry + ret i16 55 +} + +define dso_local signext i32 @test3(ptr noundef %addr, i32 noundef signext %newval) local_unnamed_addr #0 { +; CHECK-LABEL: test3: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: mflr 0 +; CHECK-NEXT: std 0, 16(1) +; CHECK-NEXT: stdu 1, -32(1) +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: .cfi_offset lr, 16 +; CHECK-NEXT: stwcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB2_2 +; CHECK-NEXT: # %bb.1: # %if.then +; CHECK-NEXT: bl dummy +; CHECK-NEXT: nop +; CHECK-NEXT: .LBB2_2: # %if.end +; CHECK-NEXT: li 3, 55 +; CHECK-NEXT: addi 1, 1, 32 +; CHECK-NEXT: ld 0, 16(1) +; CHECK-NEXT: mtlr 0 +; CHECK-NEXT: blr +; +; CHECK-AIX-LABEL: test3: +; CHECK-AIX: # %bb.0: # %entry +; CHECK-AIX-NEXT: mflr 0 +; CHECK-AIX-NEXT: std 0, 16(1) +; CHECK-AIX-NEXT: stdu 1, -112(1) +; CHECK-AIX-NEXT: stwcx. 4, 0, 3 +; CHECK-AIX-NEXT: bne 0, L..BB2_2 +; CHECK-AIX-NEXT: # %bb.1: # %if.then +; CHECK-AIX-NEXT: bl .dummy[PR] +; CHECK-AIX-NEXT: nop +; CHECK-AIX-NEXT: L..BB2_2: # %if.end +; CHECK-AIX-NEXT: li 3, 55 +; CHECK-AIX-NEXT: addi 1, 1, 112 +; CHECK-AIX-NEXT: ld 0, 16(1) +; CHECK-AIX-NEXT: mtlr 0 +; CHECK-AIX-NEXT: blr +entry: + %0 = tail call i32 @llvm.ppc.stwcx(ptr %addr, i32 %newval) + %tobool.not = icmp eq i32 %0, 0 + br i1 %tobool.not, label %if.end, label %if.then + +if.then: ; preds = %entry + tail call void @dummy() #3 + br label %if.end + +if.end: ; preds = %if.then, %entry + ret i32 55 +} + +define dso_local i64 @test4(ptr noundef %addr, i64 noundef %newval) local_unnamed_addr #0 { +; CHECK-LABEL: test4: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: mflr 0 +; CHECK-NEXT: std 0, 16(1) +; CHECK-NEXT: stdu 1, -32(1) +; CHECK-NEXT: .cfi_def_cfa_offset 32 +; CHECK-NEXT: .cfi_offset lr, 16 +; CHECK-NEXT: stdcx. 4, 0, 3 +; CHECK-NEXT: bne 0, .LBB3_2 +; CHECK-NEXT: # %bb.1: # %if.then +; CHECK-NEXT: bl dummy +; CHECK-NEXT: nop +; CHECK-NEXT: .LBB3_2: # %if.end +; CHECK-NEXT: li 3, 55 +; CHECK-NEXT: addi 1, 1, 32 +; CHECK-NEXT: ld 0, 16(1) +; CHECK-NEXT: mtlr 0 +; CHECK-NEXT: blr +; +; CHECK-AIX-LABEL: test4: +; CHECK-AIX: # %bb.0: # %entry +; CHECK-AIX-NEXT: mflr 0 +; CHECK-AIX-NEXT: std 0, 16(1) +; CHECK-AIX-NEXT: stdu 1, -112(1) +; CHECK-AIX-NEXT: stdcx. 4, 0, 3 +; CHECK-AIX-NEXT: bne 0, L..BB3_2 +; CHECK-AIX-NEXT: # %bb.1: # %if.then +; CHECK-AIX-NEXT: bl .dummy[PR] +; CHECK-AIX-NEXT: nop +; CHECK-AIX-NEXT: L..BB3_2: # %if.end +; CHECK-AIX-NEXT: li 3, 55 +; CHECK-AIX-NEXT: addi 1, 1, 112 +; CHECK-AIX-NEXT: ld 0, 16(1) +; CHECK-AIX-NEXT: mtlr 0 +; CHECK-AIX-NEXT: blr +entry: + %0 = tail call i32 @llvm.ppc.stdcx(ptr %addr, i64 %newval) + %tobool.not = icmp eq i32 %0, 0 + br i1 %tobool.not, label %if.end, label %if.then + +if.then: ; preds = %entry + tail call void @dummy() #3 + br label %if.end + +if.end: ; preds = %if.then, %entry + ret i64 55 +} + +declare i32 @llvm.ppc.stbcx(ptr, i32) #1 +declare i32 @llvm.ppc.sthcx(ptr, i32) #1 +declare i32 @llvm.ppc.stwcx(ptr, i32) #1 +declare i32 @llvm.ppc.stdcx(ptr, i64) #1 +declare void @dummy(...) local_unnamed_addr #2 diff --git a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-check-ldarx-opt.ll b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-check-ldarx-opt.ll --- a/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-check-ldarx-opt.ll +++ b/llvm/test/CodeGen/PowerPC/builtins-ppc-xlcompat-check-ldarx-opt.ll @@ -14,17 +14,14 @@ ; CHECK-NEXT: li 4, 0 ; CHECK-NEXT: std 3, -8(1) ; CHECK-NEXT: addi 3, 1, -8 -; CHECK-NEXT: .p2align 5 +; CHECK-NEXT: .p2align 4 ; CHECK-NEXT: .LBB0_1: # %do.body ; CHECK-NEXT: # ; CHECK-NEXT: #APP ; CHECK-NEXT: ldarx 5, 0, 3 ; CHECK-NEXT: #NO_APP ; CHECK-NEXT: stdcx. 4, 0, 3 -; CHECK-NEXT: mfocrf 5, 128 -; CHECK-NEXT: srwi 5, 5, 28 -; CHECK-NEXT: cmplwi 5, 0 -; CHECK-NEXT: beq 0, .LBB0_1 +; CHECK-NEXT: bne 0, .LBB0_1 ; CHECK-NEXT: # %bb.2: # %do.end ; CHECK-NEXT: ld 3, -8(1) ; CHECK-NEXT: li 4, 55 @@ -39,17 +36,14 @@ ; CHECK-AIX-NEXT: li 4, 0 ; CHECK-AIX-NEXT: std 3, -8(1) ; CHECK-AIX-NEXT: addi 3, 1, -8 -; CHECK-AIX-NEXT: .align 5 +; CHECK-AIX-NEXT: .align 4 ; CHECK-AIX-NEXT: L..BB0_1: # %do.body ; CHECK-AIX-NEXT: # ; CHECK-AIX-NEXT: #APP ; CHECK-AIX-NEXT: ldarx 5, 0, 3 ; CHECK-AIX-NEXT: #NO_APP ; CHECK-AIX-NEXT: stdcx. 4, 0, 3 -; CHECK-AIX-NEXT: mfocrf 5, 128 -; CHECK-AIX-NEXT: srwi 5, 5, 28 -; CHECK-AIX-NEXT: cmplwi 5, 0 -; CHECK-AIX-NEXT: beq 0, L..BB0_1 +; CHECK-AIX-NEXT: bne 0, L..BB0_1 ; CHECK-AIX-NEXT: # %bb.2: # %do.end ; CHECK-AIX-NEXT: ld 3, -8(1) ; CHECK-AIX-NEXT: li 4, 55 diff --git a/llvm/test/CodeGen/PowerPC/loop-comment.ll b/llvm/test/CodeGen/PowerPC/loop-comment.ll --- a/llvm/test/CodeGen/PowerPC/loop-comment.ll +++ b/llvm/test/CodeGen/PowerPC/loop-comment.ll @@ -7,14 +7,12 @@ ; PPC64LE-NEXT: clrlwi 4, 4, 24 ; PPC64LE-NEXT: .LBB0_1: ; PPC64LE-NEXT: lbarx 6, 0, 3 -; PPC64LE-NEXT: cmpw 4, 6 -; PPC64LE-NEXT: bne 0, .LBB0_3 +; PPC64LE-NEXT: cmpw 6, 4 +; PPC64LE-NEXT: bnelr 0 ; PPC64LE-NEXT: # %bb.2: ; PPC64LE-NEXT: stbcx. 5, 0, 3 -; PPC64LE-NEXT: beqlr 0 -; PPC64LE-NEXT: b .LBB0_1 -; PPC64LE-NEXT: .LBB0_3: -; PPC64LE-NEXT: stbcx. 6, 0, 3 +; PPC64LE-NEXT: bne 0, .LBB0_1 +; PPC64LE-NEXT: # %bb.3: ; PPC64LE-NEXT: blr %res = cmpxchg i8* %ptr, i8 %cmp, i8 %val monotonic monotonic ret void diff --git a/llvm/test/CodeGen/PowerPC/pr30451.ll b/llvm/test/CodeGen/PowerPC/pr30451.ll --- a/llvm/test/CodeGen/PowerPC/pr30451.ll +++ b/llvm/test/CodeGen/PowerPC/pr30451.ll @@ -12,8 +12,8 @@ ; CHECK-LABEL: atomic_min_i8 ; CHECK: lbarx [[DST:[0-9]+]], ; CHECK-NEXT: extsb [[EXT:[0-9]+]], [[DST]] -; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]] -; CHECK-NEXT: bge 0 +; CHECK-NEXT: cmpw [[EXT]], {{[0-9]+}} +; CHECK-NEXT: blt 0 } define i16 @atomic_min_i16() { top: @@ -28,8 +28,8 @@ ; CHECK-LABEL: atomic_min_i16 ; CHECK: lharx [[DST:[0-9]+]], ; CHECK-NEXT: extsh [[EXT:[0-9]+]], [[DST]] -; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]] -; CHECK-NEXT: bge 0 +; CHECK-NEXT: cmpw [[EXT]], {{[0-9]+}} +; CHECK-NEXT: blt 0 } define i8 @atomic_max_i8() { @@ -45,8 +45,8 @@ ; CHECK-LABEL: atomic_max_i8 ; CHECK: lbarx [[DST:[0-9]+]], ; CHECK-NEXT: extsb [[EXT:[0-9]+]], [[DST]] -; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]] -; CHECK-NEXT: ble 0 +; CHECK-NEXT: cmpw [[EXT]], {{[0-9]+}} +; CHECK-NEXT: bgt 0 } define i16 @atomic_max_i16() { top: @@ -61,8 +61,8 @@ ; CHECK-LABEL: atomic_max_i16 ; CHECK: lharx [[DST:[0-9]+]], ; CHECK-NEXT: extsh [[EXT:[0-9]+]], [[DST]] -; CHECK-NEXT: cmpw {{[0-9]+}}, [[EXT]] -; CHECK-NEXT: ble 0 +; CHECK-NEXT: cmpw [[EXT]], {{[0-9]+}} +; CHECK-NEXT: bgt 0 } declare void @llvm.lifetime.start.p0i8(i64, i8*) diff --git a/llvm/test/CodeGen/PowerPC/sign-ext-atomics.ll b/llvm/test/CodeGen/PowerPC/sign-ext-atomics.ll --- a/llvm/test/CodeGen/PowerPC/sign-ext-atomics.ll +++ b/llvm/test/CodeGen/PowerPC/sign-ext-atomics.ll @@ -11,8 +11,8 @@ ; CHECK-NEXT: # ; CHECK-NEXT: lharx 5, 0, 4 ; CHECK-NEXT: extsh 5, 5 -; CHECK-NEXT: cmpw 3, 5 -; CHECK-NEXT: bge 0, .LBB0_3 +; CHECK-NEXT: cmpw 5, 3 +; CHECK-NEXT: blt 0, .LBB0_3 ; CHECK-NEXT: # %bb.2: # %top ; CHECK-NEXT: # ; CHECK-NEXT: sthcx. 3, 0, 4 @@ -45,8 +45,8 @@ ; CHECK-NEXT: # ; CHECK-NEXT: lharx 5, 0, 4 ; CHECK-NEXT: extsh 5, 5 -; CHECK-NEXT: cmpw 3, 5 -; CHECK-NEXT: bge 0, .LBB1_3 +; CHECK-NEXT: cmpw 5, 3 +; CHECK-NEXT: blt 0, .LBB1_3 ; CHECK-NEXT: # %bb.2: # %top ; CHECK-NEXT: # ; CHECK-NEXT: sthcx. 3, 0, 4 @@ -79,8 +79,8 @@ ; CHECK-NEXT: # ; CHECK-NEXT: lharx 5, 0, 4 ; CHECK-NEXT: extsh 5, 5 -; CHECK-NEXT: cmpw 3, 5 -; CHECK-NEXT: bge 0, .LBB2_3 +; CHECK-NEXT: cmpw 5, 3 +; CHECK-NEXT: blt 0, .LBB2_3 ; CHECK-NEXT: # %bb.2: # %top ; CHECK-NEXT: # ; CHECK-NEXT: sthcx. 3, 0, 4