Index: lib/Target/PowerPC/PPCISelDAGToDAG.cpp =================================================================== --- lib/Target/PowerPC/PPCISelDAGToDAG.cpp +++ lib/Target/PowerPC/PPCISelDAGToDAG.cpp @@ -75,8 +75,6 @@ "Number of (zext(setcc)) nodes expanded into GPR sequence."); STATISTIC(SignExtensionsAdded, "Number of sign extensions for compare inputs added."); -STATISTIC(ZeroExtensionsAdded, - "Number of zero extensions for compare inputs added."); STATISTIC(NumLogicOpsOnComparison, "Number of logical ops on i1 values calculated in GPR."); STATISTIC(OmittedForNonExtendUses, @@ -292,7 +290,6 @@ bool tryLogicOpOfCompares(SDNode *N); SDValue computeLogicOpInGPR(SDValue LogicOp); SDValue signExtendInputIfNeeded(SDValue Input); - SDValue zeroExtendInputIfNeeded(SDValue Input); SDValue addExtOrTrunc(SDValue NatWidthRes, ExtOrTruncConversion Conv); SDValue getCompoundZeroComparisonInGPR(SDValue LHS, SDLoc dl, ZeroCompare CmpTy); @@ -2548,15 +2545,15 @@ return false; SDLoc dl(N); - bool Inputs32Bit = N->getOperand(0).getOperand(0).getValueType() == MVT::i32; + bool Input32Bit = WideRes.getValueType() == MVT::i32; bool Output32Bit = N->getValueType(0) == MVT::i32; NumSextSetcc += N->getOpcode() == ISD::SIGN_EXTEND ? 1 : 0; NumZextSetcc += N->getOpcode() == ISD::SIGN_EXTEND ? 0 : 1; SDValue ConvOp = WideRes; - if (Inputs32Bit != Output32Bit) - ConvOp = addExtOrTrunc(WideRes, Inputs32Bit ? ExtOrTruncConversion::Ext : + if (Input32Bit != Output32Bit) + ConvOp = addExtOrTrunc(WideRes, Input32Bit ? ExtOrTruncConversion::Ext : ExtOrTruncConversion::Trunc); ReplaceNode(N, ConvOp.getNode()); @@ -2717,6 +2714,7 @@ } /// If the value isn't guaranteed to be sign-extended to 64-bits, extend it. +/// Otherwise just reinterpret it as a 64-bit value. /// Useful when emitting comparison code for 32-bit values without using /// the compare instruction (which only considers the lower 32-bits). SDValue PPCDAGToDAGISel::signExtendInputIfNeeded(SDValue Input) { @@ -2729,51 +2727,23 @@ if (Opc == ISD::TRUNCATE && (Input.getOperand(0).getOpcode() == ISD::AssertSext || Input.getOperand(0).getOpcode() == ISD::SIGN_EXTEND)) - return Input; + return addExtOrTrunc(Input, ExtOrTruncConversion::Ext); LoadSDNode *InputLoad = dyn_cast(Input); // The input is a sign-extending load. No reason to sign-extend. if (InputLoad && InputLoad->getExtensionType() == ISD::SEXTLOAD) - return Input; + return addExtOrTrunc(Input, ExtOrTruncConversion::Ext); ConstantSDNode *InputConst = dyn_cast(Input); // We don't sign-extend constants and already sign-extended values. if (InputConst || Opc == ISD::AssertSext || Opc == ISD::SIGN_EXTEND_INREG || Opc == ISD::SIGN_EXTEND) - return Input; + return addExtOrTrunc(Input, ExtOrTruncConversion::Ext); SDLoc dl(Input); SignExtensionsAdded++; - return SDValue(CurDAG->getMachineNode(PPC::EXTSW_32, dl, MVT::i32, Input), 0); -} - -/// If the value isn't guaranteed to be zero-extended to 64-bits, extend it. -/// Useful when emitting comparison code for 32-bit values without using -/// the compare instruction (which only considers the lower 32-bits). -SDValue PPCDAGToDAGISel::zeroExtendInputIfNeeded(SDValue Input) { - assert(Input.getValueType() == MVT::i32 && - "Can only zero-extend 32-bit values here."); - LoadSDNode *InputLoad = dyn_cast(Input); - unsigned Opc = Input.getOpcode(); - - // No need to zero-extend loaded values (unless they're loaded with - // a sign-extending load). - if (InputLoad && InputLoad->getExtensionType() != ISD::SEXTLOAD) - return Input; - - ConstantSDNode *InputConst = dyn_cast(Input); - bool InputZExtConst = InputConst && InputConst->getSExtValue() >= 0; - // An ISD::TRUNCATE will be lowered to an EXTRACT_SUBREG so we have - // to conservatively actually clear the high bits. We also don't need to - // zero-extend constants or values that are already zero-extended. - if (InputZExtConst || Opc == ISD::AssertZext || Opc == ISD::ZERO_EXTEND) - return Input; - - SDLoc dl(Input); - ZeroExtensionsAdded++; - return SDValue(CurDAG->getMachineNode(PPC::RLDICL_32, dl, MVT::i32, Input, - getI64Imm(0, dl), getI64Imm(32, dl)), - 0); + return SDValue(CurDAG->getMachineNode(PPC::EXTSW_32_64, dl, + MVT::i64, Input), 0); } // Handle a 32-bit value in a 64-bit register and vice-versa. These are of @@ -2822,10 +2792,12 @@ case ZeroCompare::LEZExt: case ZeroCompare::LESExt: { if (Is32Bit) { + // The 32-bit value must be sign-extended to 64 bits. + LHS = signExtendInputIfNeeded(LHS); SDValue Neg = - SDValue(CurDAG->getMachineNode(PPC::NEG, dl, MVT::i32, LHS), 0); + SDValue(CurDAG->getMachineNode(PPC::NEG8, dl, MVT::i64, LHS), 0); ToExtend = - SDValue(CurDAG->getMachineNode(PPC::RLDICL_32, dl, MVT::i32, + SDValue(CurDAG->getMachineNode(PPC::RLDICL, dl, MVT::i64, Neg, getI64Imm(1, dl), getI64Imm(63, dl)), 0); } else { @@ -2851,6 +2823,8 @@ getI64Imm(63, dl)), 0); assert(Is32Bit && "Should have handled the 32-bit sequences above."); + SDValue ExtVal; + // For 32-bit sequences, the extensions differ between GE/LE cases. switch (CmpTy) { case ZeroCompare::GEZExt: { @@ -2863,10 +2837,10 @@ return SDValue(CurDAG->getMachineNode(PPC::SRAWI, dl, MVT::i32, ToExtend, getI32Imm(31, dl)), 0); case ZeroCompare::LEZExt: - return SDValue(CurDAG->getMachineNode(PPC::XORI, dl, MVT::i32, ToExtend, - getI32Imm(1, dl)), 0); + return SDValue(CurDAG->getMachineNode(PPC::XORI8, dl, MVT::i64, ToExtend, + getI32Imm(1, dl)), 0); case ZeroCompare::LESExt: - return SDValue(CurDAG->getMachineNode(PPC::ADDI, dl, MVT::i32, ToExtend, + return SDValue(CurDAG->getMachineNode(PPC::ADDI8, dl, MVT::i64, ToExtend, getI32Imm(-1, dl)), 0); } @@ -2881,6 +2855,8 @@ ISD::CondCode CC, int64_t RHSValue, SDLoc dl) { bool IsRHSZero = RHSValue == 0; + bool IsRHSOne = RHSValue == 1; + bool IsRHSNegOne = RHSValue == -1LL; switch (CC) { default: return SDValue(); case ISD::SETEQ: { @@ -2927,13 +2903,66 @@ // (zext (setcc %a, 0, setle)) -> (xor (lshr (- %a), 63), 1) if(IsRHSZero) return getCompoundZeroComparisonInGPR(LHS, dl, ZeroCompare::LEZExt); + // The upper 32-bits of the register can't be undefined for this sequence. + LHS = signExtendInputIfNeeded(LHS); + RHS = signExtendInputIfNeeded(RHS); SDValue Sub = - SDValue(CurDAG->getMachineNode(PPC::SUBF, dl, MVT::i32, LHS, RHS), 0); + SDValue(CurDAG->getMachineNode(PPC::SUBF8, dl, MVT::i64, LHS, RHS), 0); SDValue Shift = - SDValue(CurDAG->getMachineNode(PPC::RLDICL_32, dl, MVT::i32, Sub, + SDValue(CurDAG->getMachineNode(PPC::RLDICL, dl, MVT::i64, Sub, getI64Imm(1, dl), getI64Imm(63, dl)), 0); - return SDValue(CurDAG->getMachineNode(PPC::XORI, dl, - MVT::i32, Shift, getI32Imm(1, dl)), 0); + return + SDValue(CurDAG->getMachineNode(PPC::XORI8, dl, + MVT::i64, Shift, getI32Imm(1, dl)), 0); + } + case ISD::SETGT: { + // (zext (setcc %a, %b, setgt)) -> (lshr (sub %b, %a), 63) + // (zext (setcc %a, -1, setgt)) -> (lshr (~ %a), 31) + // (zext (setcc %a, 0, setgt)) -> (lshr (- %a), 63) + // Handle SETLT -1 (which is equivalent to SETGE 0). + if (IsRHSNegOne) + return getCompoundZeroComparisonInGPR(LHS, dl, ZeroCompare::GEZExt); + + if (IsRHSZero) { + // The upper 32-bits of the register can't be undefined for this sequence. + LHS = signExtendInputIfNeeded(LHS); + RHS = signExtendInputIfNeeded(RHS); + SDValue Neg = + SDValue(CurDAG->getMachineNode(PPC::NEG8, dl, MVT::i64, LHS), 0); + return SDValue(CurDAG->getMachineNode(PPC::RLDICL, dl, MVT::i64, + Neg, getI32Imm(1, dl), getI32Imm(63, dl)), 0); + } + // Not a special case (i.e. RHS == 0 or RHS == -1). Handle (%a > %b) as + // (%b < %a) by swapping inputs and falling through. + std::swap(LHS, RHS); + ConstantSDNode *RHSConst = dyn_cast(RHS); + IsRHSZero = RHSConst && RHSConst->isNullValue(); + IsRHSOne = RHSConst && RHSConst->getSExtValue() == 1; + LLVM_FALLTHROUGH; + } + case ISD::SETLT: { + // (zext (setcc %a, %b, setlt)) -> (lshr (sub %a, %b), 63) + // (zext (setcc %a, 1, setlt)) -> (xor (lshr (- %a), 63), 1) + // (zext (setcc %a, 0, setlt)) -> (lshr %a, 31) + // Handle SETLT 1 (which is equivalent to SETLE 0). + if (IsRHSOne) + return getCompoundZeroComparisonInGPR(LHS, dl, ZeroCompare::LEZExt); + + if (IsRHSZero) { + SDValue ShiftOps[] = { LHS, getI32Imm(1, dl), getI32Imm(31, dl), + getI32Imm(31, dl) }; + return SDValue(CurDAG->getMachineNode(PPC::RLWINM, dl, MVT::i32, + ShiftOps), 0); + } + + // The upper 32-bits of the register can't be undefined for this sequence. + LHS = signExtendInputIfNeeded(LHS); + RHS = signExtendInputIfNeeded(RHS); + SDValue SUBFNode = + SDValue(CurDAG->getMachineNode(PPC::SUBF8, dl, MVT::i64, RHS, LHS), 0); + return SDValue(CurDAG->getMachineNode(PPC::RLDICL, dl, MVT::i64, + SUBFNode, getI64Imm(1, dl), + getI64Imm(63, dl)), 0); } } } @@ -2944,6 +2973,9 @@ ISD::CondCode CC, int64_t RHSValue, SDLoc dl) { bool IsRHSZero = RHSValue == 0; + bool IsRHSOne = RHSValue == 1; + bool IsRHSNegOne = RHSValue == -1LL; + switch (CC) { default: return SDValue(); case ISD::SETEQ: { @@ -2955,11 +2987,11 @@ SDValue(CurDAG->getMachineNode(PPC::XOR, dl, MVT::i32, LHS, RHS), 0); SDValue Cntlzw = SDValue(CurDAG->getMachineNode(PPC::CNTLZW, dl, MVT::i32, CountInput), 0); - SDValue SHLOps[] = { Cntlzw, getI32Imm(58, dl), getI32Imm(0, dl) }; - SDValue Sldi = - SDValue(CurDAG->getMachineNode(PPC::RLDICR_32, dl, MVT::i32, SHLOps), 0); - return SDValue(CurDAG->getMachineNode(PPC::SRADI_32, dl, MVT::i32, Sldi, - getI32Imm(63, dl)), 0); + SDValue SHLOps[] = { Cntlzw, getI32Imm(27, dl), + getI32Imm(5, dl), getI32Imm(31, dl) }; + SDValue Slwi = + SDValue(CurDAG->getMachineNode(PPC::RLWINM, dl, MVT::i32, SHLOps), 0); + return SDValue(CurDAG->getMachineNode(PPC::NEG, dl, MVT::i32, Slwi), 0); } case ISD::SETNE: { // Bitwise xor the operands, count leading zeros, shift right by 5 bits and @@ -3000,16 +3032,61 @@ // (sext (setcc %a, 0, setle)) -> (add (lshr (- %a), 63), -1) if (IsRHSZero) return getCompoundZeroComparisonInGPR(LHS, dl, ZeroCompare::LESExt); + + // The upper 32-bits of the register can't be undefined for this sequence. + LHS = signExtendInputIfNeeded(LHS); + RHS = signExtendInputIfNeeded(RHS); SDValue SUBFNode = - SDValue(CurDAG->getMachineNode(PPC::SUBF, dl, MVT::i32, MVT::Glue, + SDValue(CurDAG->getMachineNode(PPC::SUBF8, dl, MVT::i64, MVT::Glue, LHS, RHS), 0); SDValue Srdi = - SDValue(CurDAG->getMachineNode(PPC::RLDICL_32, dl, MVT::i32, + SDValue(CurDAG->getMachineNode(PPC::RLDICL, dl, MVT::i64, SUBFNode, getI64Imm(1, dl), getI64Imm(63, dl)), 0); - return SDValue(CurDAG->getMachineNode(PPC::ADDI, dl, MVT::i32, Srdi, + return SDValue(CurDAG->getMachineNode(PPC::ADDI8, dl, MVT::i64, Srdi, getI32Imm(-1, dl)), 0); } + case ISD::SETGT: { + // (sext (setcc %a, %b, setgt)) -> (ashr (sub %b, %a), 63) + // (sext (setcc %a, -1, setgt)) -> (ashr (~ %a), 31) + // (sext (setcc %a, 0, setgt)) -> (ashr (- %a), 63) + if (IsRHSNegOne) + return getCompoundZeroComparisonInGPR(LHS, dl, ZeroCompare::GESExt); + if (IsRHSZero) { + // The upper 32-bits of the register can't be undefined for this sequence. + LHS = signExtendInputIfNeeded(LHS); + RHS = signExtendInputIfNeeded(RHS); + SDValue Neg = + SDValue(CurDAG->getMachineNode(PPC::NEG8, dl, MVT::i64, LHS), 0); + return SDValue(CurDAG->getMachineNode(PPC::SRADI, dl, MVT::i64, Neg, + getI64Imm(63, dl)), 0); + } + // Not a special case (i.e. RHS == 0 or RHS == -1). Handle (%a > %b) as + // (%b < %a) by swapping inputs and falling through. + std::swap(LHS, RHS); + ConstantSDNode *RHSConst = dyn_cast(RHS); + IsRHSZero = RHSConst && RHSConst->isNullValue(); + IsRHSOne = RHSConst && RHSConst->getSExtValue() == 1; + LLVM_FALLTHROUGH; + } + case ISD::SETLT: { + // (sext (setcc %a, %b, setgt)) -> (ashr (sub %a, %b), 63) + // (sext (setcc %a, 1, setgt)) -> (add (lshr (- %a), 63), -1) + // (sext (setcc %a, 0, setgt)) -> (ashr %a, 31) + if (IsRHSOne) + return getCompoundZeroComparisonInGPR(LHS, dl, ZeroCompare::LESExt); + if (IsRHSZero) + return SDValue(CurDAG->getMachineNode(PPC::SRAWI, dl, MVT::i32, LHS, + getI32Imm(31, dl)), 0); + + // The upper 32-bits of the register can't be undefined for this sequence. + LHS = signExtendInputIfNeeded(LHS); + RHS = signExtendInputIfNeeded(RHS); + SDValue SUBFNode = + SDValue(CurDAG->getMachineNode(PPC::SUBF8, dl, MVT::i64, RHS, LHS), 0); + return SDValue(CurDAG->getMachineNode(PPC::SRADI, dl, MVT::i64, + SUBFNode, getI64Imm(63, dl)), 0); + } } } @@ -3140,13 +3217,6 @@ CC = ISD::getSetCCInverse(CC, true); bool Inputs32Bit = InputVT == MVT::i32; - if (ISD::isSignedIntSetCC(CC) && Inputs32Bit) { - LHS = signExtendInputIfNeeded(LHS); - RHS = signExtendInputIfNeeded(RHS); - } else if (ISD::isUnsignedIntSetCC(CC) && Inputs32Bit) { - LHS = zeroExtendInputIfNeeded(LHS); - RHS = zeroExtendInputIfNeeded(RHS); - } SDLoc dl(Compare); ConstantSDNode *RHSConst = dyn_cast(RHS); Index: test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll =================================================================== --- test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll +++ test/CodeGen/PowerPC/memCmpUsedInZeroEqualityComparison.ll @@ -115,10 +115,9 @@ ; CHECK-NEXT: li 12, -1 ; CHECK-NEXT: isel 5, 12, 11, 0 ; CHECK-NEXT: .LBB3_3: # %endblock -; CHECK-NEXT: cmpwi 5, 1 -; CHECK-NEXT: li 3, 0 -; CHECK-NEXT: li 4, 1 -; CHECK-NEXT: isel 3, 4, 3, 0 +; CHECK-NEXT: neg 3, 5 +; CHECK-NEXT: rldicl 3, 3, 1, 63 +; CHECK-NEXT: xori 3, 3, 1 ; CHECK-NEXT: blr %call = tail call signext i32 @memcmp(i8* bitcast ([4 x i32]* @zeroEqualityTest02.buffer1 to i8*), i8* bitcast ([4 x i32]* @zeroEqualityTest02.buffer2 to i8*), i64 16) %not.cmp = icmp slt i32 %call, 1 Index: test/CodeGen/PowerPC/no-pref-jumps.ll =================================================================== --- test/CodeGen/PowerPC/no-pref-jumps.ll +++ test/CodeGen/PowerPC/no-pref-jumps.ll @@ -11,9 +11,13 @@ br i1 %or.cond, label %if.then, label %if.else ; CHECK-LABEL: @foo -; CHECK: cmpwi -; CHECK: cmpwi -; CHECK: cror +; CHECK: li +; CHECK: li +; CHECK: sub +; CHECK: sub +; CHECK: rldicl +; CHECK: rldicl +; CHECK: or. ; CHECK: blr if.then: ; preds = %entry Index: test/CodeGen/PowerPC/testComparesieqsc.ll =================================================================== --- test/CodeGen/PowerPC/testComparesieqsc.ll +++ test/CodeGen/PowerPC/testComparesieqsc.ll @@ -29,8 +29,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i8 %a, %b @@ -56,8 +56,8 @@ ; CHECK-LABEL: test_ieqsc_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i8 %a, 0 @@ -91,8 +91,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stb r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -126,8 +126,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stb r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesieqsi.ll =================================================================== --- test/CodeGen/PowerPC/testComparesieqsi.ll +++ test/CodeGen/PowerPC/testComparesieqsi.ll @@ -29,8 +29,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i32 %a, %b @@ -56,8 +56,8 @@ ; CHECK-LABEL: test_ieqsi_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i32 %a, 0 @@ -91,8 +91,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stw r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -126,8 +126,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stw r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesieqss.ll =================================================================== --- test/CodeGen/PowerPC/testComparesieqss.ll +++ test/CodeGen/PowerPC/testComparesieqss.ll @@ -29,8 +29,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i16 %a, %b @@ -56,8 +56,8 @@ ; CHECK-LABEL: test_ieqss_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i16 %a, 0 @@ -91,8 +91,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: sth r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -126,8 +126,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: sth r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesiequc.ll =================================================================== --- test/CodeGen/PowerPC/testComparesiequc.ll +++ test/CodeGen/PowerPC/testComparesiequc.ll @@ -29,8 +29,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i8 %a, %b @@ -56,8 +56,8 @@ ; CHECK-LABEL: test_iequc_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i8 %a, 0 @@ -91,8 +91,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stb r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -126,8 +126,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stb r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesiequi.ll =================================================================== --- test/CodeGen/PowerPC/testComparesiequi.ll +++ test/CodeGen/PowerPC/testComparesiequi.ll @@ -29,8 +29,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i32 %a, %b @@ -56,8 +56,8 @@ ; CHECK-LABEL: test_iequi_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i32 %a, 0 @@ -91,8 +91,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stw r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -126,8 +126,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stw r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesiequs.ll =================================================================== --- test/CodeGen/PowerPC/testComparesiequs.ll +++ test/CodeGen/PowerPC/testComparesiequs.ll @@ -29,8 +29,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i16 %a, %b @@ -56,8 +56,8 @@ ; CHECK-LABEL: test_iequs_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i16 %a, 0 @@ -91,8 +91,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: sth r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -126,8 +126,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: sth r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesigesc.ll =================================================================== --- test/CodeGen/PowerPC/testComparesigesc.ll +++ test/CodeGen/PowerPC/testComparesigesc.ll @@ -10,7 +10,7 @@ define signext i32 @test_igesc(i8 signext %a, i8 signext %b) { ; CHECK-LABEL: test_igesc: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define signext i32 @test_igesc_sext(i8 signext %a, i8 signext %b) { ; CHECK-LABEL: test_igesc_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_igesc_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_igesc_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesigesi.ll =================================================================== --- test/CodeGen/PowerPC/testComparesigesi.ll +++ test/CodeGen/PowerPC/testComparesigesi.ll @@ -10,7 +10,7 @@ define signext i32 @test_igesi(i32 signext %a, i32 signext %b) { ; CHECK-LABEL: test_igesi: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define signext i32 @test_igesi_sext(i32 signext %a, i32 signext %b) { ; CHECK-LABEL: test_igesi_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_igesi_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_igesi_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesigess.ll =================================================================== --- test/CodeGen/PowerPC/testComparesigess.ll +++ test/CodeGen/PowerPC/testComparesigess.ll @@ -10,7 +10,7 @@ define signext i32 @test_igess(i16 signext %a, i16 signext %b) { ; CHECK-LABEL: test_igess: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define signext i32 @test_igess_sext(i16 signext %a, i16 signext %b) { ; CHECK-LABEL: test_igess_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_igess_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_igess_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesigtsc.ll =================================================================== --- test/CodeGen/PowerPC/testComparesigtsc.ll +++ test/CodeGen/PowerPC/testComparesigtsc.ll @@ -0,0 +1,116 @@ +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl + +@glob = common local_unnamed_addr global i8 0, align 1 + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtsc(i8 signext %a, i8 signext %b) { +; CHECK-LABEL: test_igtsc: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3 +; CHECK-NEXT: rldicl r3, [[REG]], 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i8 %a, %b + %conv2 = zext i1 %cmp to i32 + ret i32 %conv2 +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtsc_sext(i8 signext %a, i8 signext %b) { +; CHECK-LABEL: test_igtsc_sext: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3 +; CHECK-NEXT: sradi r3, [[REG]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i8 %a, %b + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; FIXME +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtsc_z(i8 signext %a) { +; CHECK-LABEL: test_igtsc_z: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: neg r3, r3 +; CHECK-NEXT: rldicl r3, r3, 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i8 %a, 0 + %conv1 = zext i1 %cmp to i32 + ret i32 %conv1 +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtsc_sext_z(i8 signext %a) { +; CHECK-LABEL: test_igtsc_sext_z: +; CHECK: neg [[REG2:r[0-9]+]], r3 +; CHECK-NEXT: sradi r3, [[REG2]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i8 %a, 0 + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind +define void @test_igtsc_store(i8 signext %a, i8 signext %b) { +; CHECK-LABEL: test_igtsc_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r4, r3 +; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63 +entry: + %cmp = icmp sgt i8 %a, %b + %conv3 = zext i1 %cmp to i8 + store i8 %conv3, i8* @glob, align 1 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_igtsc_sext_store(i8 signext %a, i8 signext %b) { +; CHECK-LABEL: test_igtsc_sext_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r4, r3 +; CHECK: sradi {{r[0-9]+}}, [[REG]], 63 +entry: + %cmp = icmp sgt i8 %a, %b + %conv3 = sext i1 %cmp to i8 + store i8 %conv3, i8* @glob, align 1 + ret void +} + +; FIXME +; Function Attrs: norecurse nounwind +define void @test_igtsc_z_store(i8 signext %a) { +; CHECK-LABEL: test_igtsc_z_store: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: addis r4, r2, .LC0@toc@ha +; CHECK-NEXT: neg r3, r3 +; CHECK-NEXT: ld r4, .LC0@toc@l(r4) +; CHECK-NEXT: rldicl r3, r3, 1, 63 +; CHECK-NEXT: stb r3, 0(r4) +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i8 %a, 0 + %conv2 = zext i1 %cmp to i8 + store i8 %conv2, i8* @glob, align 1 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_igtsc_sext_z_store(i8 signext %a) { +; CHECK-LABEL: test_igtsc_sext_z_store: +; CHECK: neg [[REG2:r[0-9]+]], r3 +; CHECK: sradi {{r[0-9]+}}, [[REG2]], 63 +entry: + %cmp = icmp sgt i8 %a, 0 + %conv2 = sext i1 %cmp to i8 + store i8 %conv2, i8* @glob, align 1 + ret void +} Index: test/CodeGen/PowerPC/testComparesigtsi.ll =================================================================== --- test/CodeGen/PowerPC/testComparesigtsi.ll +++ test/CodeGen/PowerPC/testComparesigtsi.ll @@ -0,0 +1,116 @@ +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl + +@glob = common local_unnamed_addr global i32 0, align 4 + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtsi(i32 signext %a, i32 signext %b) { +; CHECK-LABEL: test_igtsi: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3 +; CHECK-NEXT: rldicl r3, [[REG]], 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i32 %a, %b + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtsi_sext(i32 signext %a, i32 signext %b) { +; CHECK-LABEL: test_igtsi_sext: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3 +; CHECK-NEXT: sradi r3, [[REG]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i32 %a, %b + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; FIXME +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtsi_z(i32 signext %a) { +; CHECK-LABEL: test_igtsi_z: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: neg r3, r3 +; CHECK-NEXT: rldicl r3, r3, 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i32 %a, 0 + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtsi_sext_z(i32 signext %a) { +; CHECK-LABEL: test_igtsi_sext_z: +; CHECK: neg [[REG2:r[0-9]+]], r3 +; CHECK-NEXT: sradi r3, [[REG2]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i32 %a, 0 + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind +define void @test_igtsi_store(i32 signext %a, i32 signext %b) { +; CHECK-LABEL: test_igtsi_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r4, r3 +; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63 +entry: + %cmp = icmp sgt i32 %a, %b + %conv = zext i1 %cmp to i32 + store i32 %conv, i32* @glob, align 4 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_igtsi_sext_store(i32 signext %a, i32 signext %b) { +; CHECK-LABEL: test_igtsi_sext_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r4, r3 +; CHECK: sradi {{r[0-9]+}}, [[REG]], 63 +entry: + %cmp = icmp sgt i32 %a, %b + %sub = sext i1 %cmp to i32 + store i32 %sub, i32* @glob, align 4 + ret void +} + +; FIXME +; Function Attrs: norecurse nounwind +define void @test_igtsi_z_store(i32 signext %a) { +; CHECK-LABEL: test_igtsi_z_store: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: addis r4, r2, .LC0@toc@ha +; CHECK-NEXT: neg r3, r3 +; CHECK-NEXT: ld r4, .LC0@toc@l(r4) +; CHECK-NEXT: rldicl r3, r3, 1, 63 +; CHECK-NEXT: stw r3, 0(r4) +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i32 %a, 0 + %conv = zext i1 %cmp to i32 + store i32 %conv, i32* @glob, align 4 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_igtsi_sext_z_store(i32 signext %a) { +; CHECK-LABEL: test_igtsi_sext_z_store: +; CHECK: neg [[REG:r[0-9]+]], r3 +; CHECK: sradi {{r[0-9]+}}, [[REG]], 63 +entry: + %cmp = icmp sgt i32 %a, 0 + %sub = sext i1 %cmp to i32 + store i32 %sub, i32* @glob, align 4 + ret void +} Index: test/CodeGen/PowerPC/testComparesigtss.ll =================================================================== --- test/CodeGen/PowerPC/testComparesigtss.ll +++ test/CodeGen/PowerPC/testComparesigtss.ll @@ -0,0 +1,117 @@ +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl + +@glob = common local_unnamed_addr global i16 0, align 2 + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtss(i16 signext %a, i16 signext %b) { +; CHECK-LABEL: test_igtss: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG1:r[0-9]+]], r4, r3 +; CHECK-NEXT: rldicl r3, [[REG1]], 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i16 %a, %b + %conv2 = zext i1 %cmp to i32 + ret i32 %conv2 +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtss_sext(i16 signext %a, i16 signext %b) { +; CHECK-LABEL: test_igtss_sext: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r4, r3 +; CHECK-NEXT: sradi r3, [[REG]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i16 %a, %b + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; FIXME +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtss_z(i16 signext %a) { +; CHECK-LABEL: test_igtss_z: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: neg r3, r3 +; CHECK-NEXT: rldicl r3, r3, 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i16 %a, 0 + %conv1 = zext i1 %cmp to i32 + ret i32 %conv1 +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_igtss_sext_z(i16 signext %a) { +; CHECK-LABEL: test_igtss_sext_z: +; CHECK: # BB#0: # %entry +; CHECK: neg [[REG2:r[0-9]+]], r3 +; CHECK-NEXT: sradi r3, [[REG2]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i16 %a, 0 + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind +define void @test_igtss_store(i16 signext %a, i16 signext %b) { +; CHECK-LABEL: test_igtss_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG1:r[0-9]+]], r4, r3 +; CHECK: rldicl {{r[0-9]+}}, [[REG1]], 1, 63 +entry: + %cmp = icmp sgt i16 %a, %b + %conv3 = zext i1 %cmp to i16 + store i16 %conv3, i16* @glob, align 2 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_igtss_sext_store(i16 signext %a, i16 signext %b) { +; CHECK-LABEL: test_igtss_sext_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r4, r3 +; CHECK: sradi {{r[0-9]+}}, [[REG]], 63 +entry: + %cmp = icmp sgt i16 %a, %b + %conv3 = sext i1 %cmp to i16 + store i16 %conv3, i16* @glob, align 2 + ret void +} + +; FIXME +; Function Attrs: norecurse nounwind +define void @test_igtss_z_store(i16 signext %a) { +; CHECK-LABEL: test_igtss_z_store: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: addis r4, r2, .LC0@toc@ha +; CHECK-NEXT: neg r3, r3 +; CHECK-NEXT: ld r4, .LC0@toc@l(r4) +; CHECK-NEXT: rldicl r3, r3, 1, 63 +; CHECK-NEXT: sth r3, 0(r4) +; CHECK-NEXT: blr +entry: + %cmp = icmp sgt i16 %a, 0 + %conv2 = zext i1 %cmp to i16 + store i16 %conv2, i16* @glob, align 2 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_igtss_sext_z_store(i16 signext %a) { +; CHECK-LABEL: test_igtss_sext_z_store: +; CHECK: neg [[REG2:r[0-9]+]], r3 +; CHECK: sradi {{r[0-9]+}}, [[REG2]], 63 +entry: + %cmp = icmp sgt i16 %a, 0 + %conv2 = sext i1 %cmp to i16 + store i16 %conv2, i16* @glob, align 2 + ret void +} Index: test/CodeGen/PowerPC/testComparesilesc.ll =================================================================== --- test/CodeGen/PowerPC/testComparesilesc.ll +++ test/CodeGen/PowerPC/testComparesilesc.ll @@ -10,7 +10,7 @@ define signext i32 @test_ilesc(i8 signext %a, i8 signext %b) { ; CHECK-LABEL: test_ilesc: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define signext i32 @test_ilesc_sext(i8 signext %a, i8 signext %b) { ; CHECK-LABEL: test_ilesc_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_ilesc_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_ilesc_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesilesi.ll =================================================================== --- test/CodeGen/PowerPC/testComparesilesi.ll +++ test/CodeGen/PowerPC/testComparesilesi.ll @@ -10,7 +10,7 @@ define signext i32 @test_ilesi(i32 signext %a, i32 signext %b) { ; CHECK-LABEL: test_ilesi: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define signext i32 @test_ilesi_sext(i32 signext %a, i32 signext %b) { ; CHECK-LABEL: test_ilesi_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_ilesi_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_ilesi_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesiless.ll =================================================================== --- test/CodeGen/PowerPC/testComparesiless.ll +++ test/CodeGen/PowerPC/testComparesiless.ll @@ -10,7 +10,7 @@ define signext i32 @test_iless(i16 signext %a, i16 signext %b) { ; CHECK-LABEL: test_iless: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define signext i32 @test_iless_sext(i16 signext %a, i16 signext %b) { ; CHECK-LABEL: test_iless_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_iless_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_iless_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesiltsc.ll =================================================================== --- test/CodeGen/PowerPC/testComparesiltsc.ll +++ test/CodeGen/PowerPC/testComparesiltsc.ll @@ -0,0 +1,83 @@ +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py + +@glob = common local_unnamed_addr global i8 0, align 1 + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltsc(i8 signext %a, i8 signext %b) { +; CHECK-LABEL: test_iltsc: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r3, r4 +; CHECK-NEXT: rldicl r3, [[REG]], 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i8 %a, %b + %conv2 = zext i1 %cmp to i32 + ret i32 %conv2 +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltsc_sext(i8 signext %a, i8 signext %b) { +; CHECK-LABEL: test_iltsc_sext: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r3, r4 +; CHECK-NEXT: sradi r3, [[REG]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i8 %a, %b + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltsc_sext_z(i8 signext %a) { +; CHECK-LABEL: test_iltsc_sext_z: +; CHECK: srawi r3, r3, 31 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i8 %a, 0 + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind +define void @test_iltsc_store(i8 signext %a, i8 signext %b) { +; CHECK-LABEL: test_iltsc_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r3, r4 +; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63 +entry: + %cmp = icmp slt i8 %a, %b + %conv3 = zext i1 %cmp to i8 + store i8 %conv3, i8* @glob, align 1 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_iltsc_sext_store(i8 signext %a, i8 signext %b) { +; CHECK-LABEL: test_iltsc_sext_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r3, r4 +; CHECK: sradi {{r[0-9]+}}, [[REG]], 63 +entry: + %cmp = icmp slt i8 %a, %b + %conv3 = sext i1 %cmp to i8 + store i8 %conv3, i8* @glob, align 1 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_iltsc_sext_z_store(i8 signext %a) { +; CHECK-LABEL: test_iltsc_sext_z_store: +; CHECK: srwi {{r[0-9]+}}, r3, 7 +entry: + %cmp = icmp slt i8 %a, 0 + %conv2 = sext i1 %cmp to i8 + store i8 %conv2, i8* @glob, align 1 + ret void +} Index: test/CodeGen/PowerPC/testComparesiltsi.ll =================================================================== --- test/CodeGen/PowerPC/testComparesiltsi.ll +++ test/CodeGen/PowerPC/testComparesiltsi.ll @@ -0,0 +1,85 @@ +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py + +@glob = common local_unnamed_addr global i32 0, align 4 + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltsi(i32 signext %a, i32 signext %b) { +; CHECK-LABEL: test_iltsi: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r3, r4 +; CHECK-NEXT: rldicl r3, [[REG]], 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i32 %a, %b + %conv = zext i1 %cmp to i32 + ret i32 %conv +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltsi_sext(i32 signext %a, i32 signext %b) { +; CHECK-LABEL: test_iltsi_sext: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r3, r4 +; CHECK-NEXT: sradi r3, [[REG]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i32 %a, %b + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltsi_sext_z(i32 signext %a) { +; CHECK-LABEL: test_iltsi_sext_z: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: srawi r3, r3, 31 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i32 %a, 0 + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind +define void @test_iltsi_store(i32 signext %a, i32 signext %b) { +; CHECK-LABEL: test_iltsi_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r3, r4 +; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63 +entry: + %cmp = icmp slt i32 %a, %b + %conv = zext i1 %cmp to i32 + store i32 %conv, i32* @glob, align 4 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_iltsi_sext_store(i32 signext %a, i32 signext %b) { +; CHECK-LABEL: test_iltsi_sext_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r3, r4 +; CHECK: sradi {{r[0-9]+}}, [[REG]], 63 +entry: + %cmp = icmp slt i32 %a, %b + %sub = sext i1 %cmp to i32 + store i32 %sub, i32* @glob, align 4 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_iltsi_sext_z_store(i32 signext %a) { +; CHECK-LABEL: test_iltsi_sext_z_store: +; CHECK: srawi {{r[0-9]+}}, r3, 31 +; CHECK: blr +entry: + %cmp = icmp slt i32 %a, 0 + %sub = sext i1 %cmp to i32 + store i32 %sub, i32* @glob, align 4 + ret void +} Index: test/CodeGen/PowerPC/testComparesiltss.ll =================================================================== --- test/CodeGen/PowerPC/testComparesiltss.ll +++ test/CodeGen/PowerPC/testComparesiltss.ll @@ -0,0 +1,83 @@ +; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -O2 \ +; RUN: -ppc-asm-full-reg-names -mcpu=pwr8 < %s | FileCheck %s \ +; RUN: --implicit-check-not cmpw --implicit-check-not cmpd --implicit-check-not cmpl +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py + +@glob = common local_unnamed_addr global i16 0, align 2 + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltss(i16 signext %a, i16 signext %b) { +; CHECK-LABEL: test_iltss: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r3, r4 +; CHECK-NEXT: rldicl r3, [[REG]], 1, 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i16 %a, %b + %conv2 = zext i1 %cmp to i32 + ret i32 %conv2 +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltss_sext(i16 signext %a, i16 signext %b) { +; CHECK-LABEL: test_iltss_sext: +; CHECK: # BB#0: # %entry +; CHECK-NEXT: sub [[REG:r[0-9]+]], r3, r4 +; CHECK-NEXT: sradi r3, [[REG]], 63 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i16 %a, %b + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind readnone +define signext i32 @test_iltss_sext_z(i16 signext %a) { +; CHECK-LABEL: test_iltss_sext_z: +; CHECK: srawi r3, r3, 31 +; CHECK-NEXT: blr +entry: + %cmp = icmp slt i16 %a, 0 + %sub = sext i1 %cmp to i32 + ret i32 %sub +} + +; Function Attrs: norecurse nounwind +define void @test_iltss_store(i16 signext %a, i16 signext %b) { +; CHECK-LABEL: test_iltss_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r3, r4 +; CHECK: rldicl {{r[0-9]+}}, [[REG]], 1, 63 +entry: + %cmp = icmp slt i16 %a, %b + %conv3 = zext i1 %cmp to i16 + store i16 %conv3, i16* @glob, align 2 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_iltss_sext_store(i16 signext %a, i16 signext %b) { +; CHECK-LABEL: test_iltss_sext_store: +; CHECK: # BB#0: # %entry +; CHECK: sub [[REG:r[0-9]+]], r3, r4 +; CHECK: sradi {{r[0-9]+}}, [[REG]], 63 +entry: + %cmp = icmp slt i16 %a, %b + %conv3 = sext i1 %cmp to i16 + store i16 %conv3, i16* @glob, align 2 + ret void +} + +; Function Attrs: norecurse nounwind +define void @test_iltss_sext_z_store(i16 signext %a) { +; CHECK-LABEL: test_iltss_sext_z_store: +; CHECK: srwi {{r[0-9]+}}, r3, 15 +entry: + %cmp = icmp slt i16 %a, 0 + %sub = sext i1 %cmp to i16 + store i16 %sub, i16* @glob, align 2 + ret void +} Index: test/CodeGen/PowerPC/testCompareslleqsc.ll =================================================================== --- test/CodeGen/PowerPC/testCompareslleqsc.ll +++ test/CodeGen/PowerPC/testCompareslleqsc.ll @@ -29,8 +29,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i8 %a, %b @@ -56,8 +56,8 @@ ; CHECK-LABEL: test_lleqsc_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i8 %a, 0 @@ -91,8 +91,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stb r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -126,8 +126,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stb r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testCompareslleqsi.ll =================================================================== --- test/CodeGen/PowerPC/testCompareslleqsi.ll +++ test/CodeGen/PowerPC/testCompareslleqsi.ll @@ -28,8 +28,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i32 %a, %b @@ -55,8 +55,8 @@ ; CHECK-LABEL: test_lleqsi_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i32 %a, 0 @@ -90,8 +90,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stw r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -126,8 +126,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stw r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testCompareslleqss.ll =================================================================== --- test/CodeGen/PowerPC/testCompareslleqss.ll +++ test/CodeGen/PowerPC/testCompareslleqss.ll @@ -28,8 +28,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i16 %a, %b @@ -55,8 +55,8 @@ ; CHECK-LABEL: test_lleqss_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i16 %a, 0 @@ -90,8 +90,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: sth r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -125,8 +125,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: sth r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesllequc.ll =================================================================== --- test/CodeGen/PowerPC/testComparesllequc.ll +++ test/CodeGen/PowerPC/testComparesllequc.ll @@ -28,8 +28,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i8 %a, %b @@ -55,8 +55,8 @@ ; CHECK-LABEL: test_llequc_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i8 %a, 0 @@ -90,8 +90,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stb r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -125,8 +125,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stb r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesllequi.ll =================================================================== --- test/CodeGen/PowerPC/testComparesllequi.ll +++ test/CodeGen/PowerPC/testComparesllequi.ll @@ -28,8 +28,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i32 %a, %b @@ -55,8 +55,8 @@ ; CHECK-LABEL: test_llequi_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i32 %a, 0 @@ -90,8 +90,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stw r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -125,8 +125,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: stw r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesllequs.ll =================================================================== --- test/CodeGen/PowerPC/testComparesllequs.ll +++ test/CodeGen/PowerPC/testComparesllequs.ll @@ -28,8 +28,8 @@ ; CHECK: # BB#0: # %entry ; CHECK-NEXT: xor r3, r3, r4 ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i16 %a, %b @@ -55,8 +55,8 @@ ; CHECK-LABEL: test_llequs_sext_z: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: cntlzw r3, r3 -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: blr entry: %cmp = icmp eq i16 %a, 0 @@ -90,8 +90,8 @@ ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r5) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: sth r3, 0(r4) ; CHECK-NEXT: blr entry: @@ -125,8 +125,8 @@ ; CHECK-NEXT: addis r4, r2, .LC0@toc@ha ; CHECK-NEXT: cntlzw r3, r3 ; CHECK-NEXT: ld r4, .LC0@toc@l(r4) -; CHECK-NEXT: rldicr r3, r3, 58, 0 -; CHECK-NEXT: sradi r3, r3, 63 +; CHECK-NEXT: srwi r3, r3, 5 +; CHECK-NEXT: neg r3, r3 ; CHECK-NEXT: sth r3, 0(r4) ; CHECK-NEXT: blr entry: Index: test/CodeGen/PowerPC/testComparesllgesc.ll =================================================================== --- test/CodeGen/PowerPC/testComparesllgesc.ll +++ test/CodeGen/PowerPC/testComparesllgesc.ll @@ -10,7 +10,7 @@ define i64 @test_llgesc(i8 signext %a, i8 signext %b) { ; CHECK-LABEL: test_llgesc: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define i64 @test_llgesc_sext(i8 signext %a, i8 signext %b) { ; CHECK-LABEL: test_llgesc_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_llgesc_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_llgesc_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesllgesi.ll =================================================================== --- test/CodeGen/PowerPC/testComparesllgesi.ll +++ test/CodeGen/PowerPC/testComparesllgesi.ll @@ -10,7 +10,7 @@ define i64 @test_llgesi(i32 signext %a, i32 signext %b) { ; CHECK-LABEL: test_llgesi: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define i64 @test_llgesi_sext(i32 signext %a, i32 signext %b) { ; CHECK-LABEL: test_llgesi_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_llgesi_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_llgesi_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesllgess.ll =================================================================== --- test/CodeGen/PowerPC/testComparesllgess.ll +++ test/CodeGen/PowerPC/testComparesllgess.ll @@ -10,7 +10,7 @@ define i64 @test_llgess(i16 signext %a, i16 signext %b) { ; CHECK-LABEL: test_llgess: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -23,7 +23,7 @@ define i64 @test_llgess_sext(i16 signext %a, i16 signext %b) { ; CHECK-LABEL: test_llgess_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -37,7 +37,7 @@ ; CHECK-LABEL: test_llgess_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -54,7 +54,7 @@ ; CHECK-LABEL: test_llgess_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r4, r3 +; CHECK-NEXT: sub r3, r3, r4 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testCompareslllesc.ll =================================================================== --- test/CodeGen/PowerPC/testCompareslllesc.ll +++ test/CodeGen/PowerPC/testCompareslllesc.ll @@ -11,7 +11,7 @@ define i64 @test_lllesc(i8 signext %a, i8 signext %b) { ; CHECK-LABEL: test_lllesc: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -24,7 +24,7 @@ define i64 @test_lllesc_sext(i8 signext %a, i8 signext %b) { ; CHECK-LABEL: test_lllesc_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -38,7 +38,7 @@ ; CHECK-LABEL: test_lllesc_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -55,7 +55,7 @@ ; CHECK-LABEL: test_lllesc_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testCompareslllesi.ll =================================================================== --- test/CodeGen/PowerPC/testCompareslllesi.ll +++ test/CodeGen/PowerPC/testCompareslllesi.ll @@ -11,7 +11,7 @@ define i64 @test_lllesi(i32 signext %a, i32 signext %b) { ; CHECK-LABEL: test_lllesi: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -24,7 +24,7 @@ define i64 @test_lllesi_sext(i32 signext %a, i32 signext %b) { ; CHECK-LABEL: test_lllesi_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -38,7 +38,7 @@ ; CHECK-LABEL: test_lllesi_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -55,7 +55,7 @@ ; CHECK-LABEL: test_lllesi_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 Index: test/CodeGen/PowerPC/testComparesllless.ll =================================================================== --- test/CodeGen/PowerPC/testComparesllless.ll +++ test/CodeGen/PowerPC/testComparesllless.ll @@ -11,7 +11,7 @@ define i64 @test_llless(i16 signext %a, i16 signext %b) { ; CHECK-LABEL: test_llless: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 ; CHECK-NEXT: blr @@ -24,7 +24,7 @@ define i64 @test_llless_sext(i16 signext %a, i16 signext %b) { ; CHECK-LABEL: test_llless_sext: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1 ; CHECK-NEXT: blr @@ -38,7 +38,7 @@ ; CHECK-LABEL: test_llless_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: xori r3, r3, 1 @@ -55,7 +55,7 @@ ; CHECK-LABEL: test_llless_sext_store: ; CHECK: # BB#0: # %entry ; CHECK-NEXT: addis r5, r2, .LC0@toc@ha -; CHECK-NEXT: subf r3, r3, r4 +; CHECK-NEXT: sub r3, r4, r3 ; CHECK-NEXT: ld r12, .LC0@toc@l(r5) ; CHECK-NEXT: rldicl r3, r3, 1, 63 ; CHECK-NEXT: addi r3, r3, -1