Home | History | Annotate | Download | only in SelectionDAG

Lines Matching defs:DAG

48 bool TargetLowering::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
50 const Function *F = DAG.getMachineFunction().getFunction();
86 TargetLowering::makeLibCall(SelectionDAG &DAG,
98 Entry.Ty = Entry.Node.getValueType().getTypeForEVT(*DAG.getContext());
103 SDValue Callee = DAG.getExternalSymbol(getLibcallName(LC), getPointerTy());
105 Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext());
106 TargetLowering::CallLoweringInfo CLI(DAG);
107 CLI.setDebugLoc(dl).setChain(DAG.getEntryNode())
117 void TargetLowering::softenSetCCOperands(SelectionDAG &DAG, EVT VT,
201 NewLHS = makeLibCall(DAG, LC1, RetVT, Ops, 2, false/*sign irrelevant*/,
203 NewRHS = DAG.getConstant(0, RetVT);
206 SDValue Tmp = DAG.getNode(ISD::SETCC, dl,
207 getSetCCResultType(*DAG.getContext(), RetVT),
208 NewLHS, NewRHS, DAG.getCondCode(CCCode));
209 NewLHS = makeLibCall(DAG, LC2, RetVT, Ops, 2, false/*sign irrelevant*/,
211 NewLHS = DAG.getNode(ISD::SETCC, dl,
212 getSetCCResultType(*DAG.getContext(), RetVT), NewLHS,
213 NewRHS, DAG.getCondCode(getCmpLibcallCC(LC2)));
214 NewLHS = DAG.getNode(ISD::OR, dl, Tmp.getValueType(), Tmp, NewLHS);
236 SelectionDAG &DAG) const {
242 return DAG.getGLOBAL_OFFSET_TABLE(getPointerTy(0));
302 SDValue New = DAG.getNode(Op.getOpcode(), dl, VT, Op.getOperand(0),
303 DAG.getConstant(Demanded &
341 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
347 EVT SmallVT = EVT::getIntegerVT(*DAG.getContext(), SmallVTBits);
351 SDValue X = DAG.getNode(Op.getOpcode(), dl, SmallVT,
352 DAG.getNode(ISD::TRUNCATE, dl, SmallVT,
354 DAG.getNode(ISD::TRUNCATE, dl, SmallVT,
357 SDValue Z = DAG.getNode(NeedZext ? ISD::ZERO_EXTEND : ISD::ANY_EXTEND,
367 /// use this information to simplify Op, create a new simplified DAG node and
392 TLO.DAG.computeKnownBits(Op, KnownZero, KnownOne, Depth);
401 return TLO.CombineTo(Op, TLO.DAG
422 TLO.DAG.computeKnownBits(Op.getOperand(0), LHSZero, LHSOne, Depth);
449 return TLO.CombineTo(Op, TLO.DAG.getConstant(0, Op.getValueType()));
520 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, dl, Op.getValueType(),
537 SDValue ANDC = TLO.DAG.getConstant(~KnownOne & NewMask, VT);
538 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::AND, dl, VT,
552 SDValue New = TLO.DAG.getNode(Op.getOpcode(), dl,VT, Op.getOperand(0),
553 TLO.DAG.getConstant(Expanded, VT));
626 TLO.DAG.getConstant(Diff, Op.getOperand(1).getValueType());
628 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT,
649 TLO.DAG.getNode(ISD::SHL, dl, InnerVT, InnerOp,
650 TLO.DAG.getConstant(ShAmt, ShTy));
653 TLO.DAG.getNode(ISD::ANY_EXTEND, dl, Op.getValueType(),
672 TLO.DAG.getConstant(ShAmt - InnerShAmt,
675 SDValue NewExt = TLO.DAG.getNode(ISD::ANY_EXTEND, dl, VT,
677 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl, VT,
715 TLO.DAG.getConstant(Diff, Op.getOperand(1).getValueType());
716 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT,
740 TLO.DAG.getNode(ISD::SRL, dl, Op.getValueType(),
772 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl, VT,
780 TLO.DAG.getConstant(BitWidth - 1 - Log2,
782 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl, VT,
806 SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ShAmt, ShiftAmtTy);
807 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl,
843 TLO.DAG.getZeroExtendInReg(Op.getOperand(0),dl,ExVT));
888 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::ANY_EXTEND, dl,
910 return TLO.CombineTo(Op,TLO.DAG.getNode(ISD::ANY_EXTEND, dl,
928 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::ZERO_EXTEND, dl,
987 TLO.DAG.getConstant(ShVal, getShiftAmountTy(Op.getValueType()));
997 SDValue NewTrunc = TLO.DAG.getNode(ISD::TRUNCATE, dl,
1000 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl,
1040 SDValue Sign = TLO.DAG.getNode(ISD::FGETSIGN, dl, Ty, Op.getOperand(0));
1043 Sign = TLO.DAG.getNode(ISD::ZERO_EXTEND, dl, Op.getValueType(), Sign);
1045 SDValue ShAmt = TLO.DAG.getConstant(ShVal, Op.getValueType());
1046 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl,
1072 TLO.DAG.computeKnownBits(Op, KnownZero, KnownOne, Depth);
1079 return TLO.CombineTo(Op, TLO.DAG.getConstant(KnownOne, Op.getValueType()));
1090 const SelectionDAG &DAG,
1103 /// DAG Combiner.
1120 static bool ValueHasExactlyOneBitSet(SDValue Val, const SelectionDAG &DAG) {
1144 DAG.computeKnownBits(Val, KnownZero, KnownOne);
1209 SelectionDAG &DAG = DCI.DAG;
1215 case ISD::SETFALSE2: return DAG.getConstant(0, VT);
1220 return DAG.getConstant(
1231 return DAG.getSetCC(dl, VT, N1, N0, SwappedCC);
1255 SDValue Zero = DAG.getConstant(0, N0.getValueType());
1256 return DAG.getSetCC(dl, VT, N0.getOperand(0).getOperand(0),
1275 SDValue Sub = DAG.getNode(ISD::SUB, dl, CTVT, CTOp,
1276 DAG.getConstant(1, CTVT));
1277 SDValue And = DAG.getNode(ISD::AND, dl, CTVT, CTOp, Sub);
1279 return DAG.getSetCC(dl, VT, And, DAG.getConstant(0, CTVT), CC);
1312 EVT MinVT = EVT::getIntegerVT(*DAG.getContext(), MinBits);
1315 SDValue Trunc = DAG.getNode(ISD::TRUNCATE, dl, MinVT, PreZExt);
1316 SDValue C = DAG.getConstant(C1.trunc(MinBits), MinVT);
1317 return DAG.getSetCC(dl, VT, Trunc, C, Cond);
1361 EVT newVT = EVT::getIntegerVT(*DAG.getContext(), bestWidth);
1366 Ptr = DAG.getNode(ISD::ADD, dl, PtrType, Lod->getBasePtr(),
1367 DAG.getConstant(bestOffset, PtrType));
1369 SDValue NewLoad = DAG.getLoad(newVT, dl, Lod->getChain(), Ptr,
1372 return DAG.getSetCC(dl, VT,
1373 DAG.getNode(ISD::AND, dl, newVT, NewLoad,
1374 DAG.getConstant(bestMask.trunc(bestWidth),
1376 DAG.getConstant(0LL, newVT), Cond);
1392 case ISD::SETEQ: return DAG.getConstant(0, VT);
1395 case ISD::SETNE: return DAG.getConstant(1, VT);
1399 return DAG.getConstant(C1.isNegative(), VT);
1403 return DAG.getConstant(C1.isNonNegative(), VT);
1421 EVT NewSetCCVT = getSetCCResultType(*DAG.getContext(), newVT);
1422 SDValue NewConst = DAG.getConstant(C1.trunc(InSize), newVT);
1424 SDValue NewSetCC = DAG.getSetCC(dl, NewSetCCVT, N0.getOperand(0),
1426 return DAG.getBoolExtOrTrunc(NewSetCC, dl, VT, N0.getValueType());
1443 return DAG.getConstant(Cond == ISD::SETNE, VT);
1451 ZextOp = DAG.getNode(ISD::AND, dl, Op0Ty, N0.getOperand(0),
1452 DAG.getConstant(Imm, Op0Ty));
1457 return DAG.getSetCC(dl, VT, ZextOp,
1458 DAG.getConstant(C1 & APInt::getLowBitsSet(
1470 return DAG.getNode(ISD::TRUNCATE, dl, VT, N0);
1477 return DAG.getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC);
1489 if (DAG.MaskedValueIsZero(N0,
1500 Val = DAG.getNode(ISD::AND, dl, N0.getValueType(),
1505 return DAG.getSetCC(dl, VT, Val, N1,
1521 return DAG.getSetCC(dl, VT, Op0.getOperand(0), Op0.getOperand(1),
1529 Op0 = DAG.getNode(ISD::AND, dl, VT,
1530 DAG.getNode(ISD::TRUNCATE, dl, VT, Op0.getOperand(0)),
1531 DAG.getConstant(1, VT));
1533 Op0 = DAG.getNode(ISD::AND, dl, VT,
1534 DAG.getNode(ISD::ANY_EXTEND, dl, VT, Op0.getOperand(0)),
1535 DAG.getConstant(1, VT));
1537 return DAG.getSetCC(dl, VT, Op0,
1538 DAG.getConstant(0, Op0.getValueType()),
1543 return DAG.getSetCC(dl, VT, Op0,
1544 DAG.getConstant(0, Op0.getValueType()),
1561 if (C1 == MinVal) return DAG.getConstant(1, VT); // X >= MIN --> true
1569 return DAG.getSetCC(dl, VT, N0,
1570 DAG.getConstant(C, N1.getValueType()),
1576 if (C1 == MaxVal) return DAG.getConstant(1, VT); // X <= MAX --> true
1584 return DAG.getSetCC(dl, VT, N0,
1585 DAG.getConstant(C, N1.getValueType()),
1591 return DAG.getConstant(0, VT); // X < MIN --> false
1593 return DAG.getConstant(1, VT); // X >= MIN --> true
1595 return DAG.getConstant(0, VT); // X > MAX --> false
1597 return DAG.getConstant(1, VT); // X <= MAX --> true
1601 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETNE);
1604 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETNE);
1608 return DAG.getSetCC(dl, VT, N0,
1609 DAG.getConstant(MinVal, N0.getValueType()),
1613 return DAG.getSetCC(dl, VT, N0,
1614 DAG.getConstant(MaxVal, N0.getValueType()),
1623 return DAG.getSetCC(dl, VT, N0,
1624 DAG.getConstant(0, N1.getValueType()),
1631 DAG.getConstant(APInt::getAllOnesValue(OperandBitSize),
1633 return DAG.getSetCC(dl, VT, N0, ConstMinusOne, ISD::SETGT);
1648 return DAG.getNode(ISD::TRUNCATE, dl, VT,
1649 DAG.getNode(ISD::SRL, dl, N0.getValueType(), N0,
1650 DAG.getConstant(AndRHS->getAPIntValue().logBase2(), ShiftTy)));
1656 return DAG.getNode(ISD::TRUNCATE, dl, VT,
1657 DAG.getNode(ISD::SRL, dl, N0.getValueType(), N0,
1658 DAG.getConstant(C1.logBase2(), ShiftTy)));
1676 SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0.getOperand(0),
1677 DAG.getConstant(ShiftBits, ShiftTy));
1678 SDValue CmpRHS = DAG.getConstant(C1.lshr(ShiftBits), CmpTy);
1679 return DAG.getSetCC(dl, VT, Shift, CmpRHS, Cond);
1704 SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0,
1705 DAG.getConstant(ShiftBits, ShiftTy));
1706 SDValue CmpRHS = DAG.getConstant(NewC, CmpTy);
1707 return DAG.getSetCC(dl, VT, Shift, CmpRHS, NewCond);
1715 SDValue O = DAG.FoldSetCC(VT, N0, N1, Cond, dl);
1725 return DAG.getConstant(0, VT);
1727 return DAG.getConstant(1, VT);
1729 return DAG.getUNDEF(VT);
1738 return DAG.getSetCC(dl, VT, N0, N0, Cond);
1750 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETOLE);
1753 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETULE);
1756 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETUGT);
1759 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETOGT);
1763 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETOGE);
1766 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETUGE);
1769 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETULT);
1772 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETOLT);
1794 return DAG.getConstant(EqVal, VT);
1798 return DAG.getConstant(EqVal, VT);
1800 return DAG.getConstant(EqVal, VT);
1806 return DAG.getSetCC(dl, VT, N0, N1, NewCond);
1816 return DAG.getSetCC(dl, VT, N0.getOperand(1), N1.getOperand(1), Cond);
1818 return DAG.getSetCC(dl, VT, N0.getOperand(0), N1.getOperand(0), Cond);
1819 if (DAG.isCommutativeBinOp(N0.getOpcode())) {
1822 return DAG.getSetCC(dl, VT, N0.getOperand(1), N1.getOperand(0),
1825 return DAG.getSetCC(dl, VT, N0.getOperand(0), N1.getOperand(1),
1838 return DAG.getSetCC(dl, VT, N0.getOperand(0),
1839 DAG.getConstant(RHSC->getAPIntValue()-
1848 if (DAG.MaskedValueIsZero(N0.getOperand(0), ~LHSR->getAPIntValue()))
1850 DAG.getSetCC(dl, VT, N0.getOperand(0),
1851 DAG.getConstant(LHSR->getAPIntValue() ^
1861 DAG.getSetCC(dl, VT, N0.getOperand(1),
1862 DAG.getConstant(SUBC->getAPIntValue() -
1880 return DAG.getSetCC(dl, VT, N0.getOperand(1),
1881 DAG.getConstant(0, N0.getValueType()), Cond);
1883 if (DAG.isCommutativeBinOp(N0.getOpcode()))
1884 return DAG.getSetCC(dl, VT, N0.getOperand(0),
1885 DAG.getConstant(0, N0.getValueType()), Cond);
1889 SDValue SH = DAG.getNode(ISD::SHL, dl, N1.getValueType(), N1,
1890 DAG.getConstant(1, getShiftAmountTy(N1.getValueType())));
1893 return DAG.getSetCC(dl, VT, N0.getOperand(0), SH, Cond);
1903 return DAG.getSetCC(dl, VT, N1.getOperand(1),
1904 DAG
1906 if (DAG.isCommutativeBinOp(N1.getOpcode()))
1907 return DAG.getSetCC(dl, VT, N1.getOperand(0),
1908 DAG.getConstant(0, N1.getValueType()), Cond);
1912 SDValue SH = DAG.getNode(ISD::SHL, dl, N1.getValueType(), N0,
1913 DAG.getConstant(1, getShiftAmountTy(N0.getValueType())));
1916 return DAG.getSetCC(dl, VT, SH, N1.getOperand(0), Cond);
1927 if (ValueHasExactlyOneBitSet(N1, DAG)) {
1931 SDValue Zero = DAG.getConstant(0, N1.getValueType());
1932 return DAG.getSetCC(dl, VT, N0, Zero, Cond);
1938 if (ValueHasExactlyOneBitSet(N0, DAG)) {
1942 SDValue Zero = DAG.getConstant(0, N0.getValueType());
1943 return DAG.getSetCC(dl, VT, N1, Zero, Cond);
1955 Temp = DAG.getNode(ISD::XOR, dl, MVT::i1, N0, N1);
1956 N0 = DAG.getNOT(dl, Temp, MVT::i1);
1961 N0 = DAG.getNode(ISD::XOR, dl, MVT::i1, N0, N1);
1965 Temp = DAG.getNOT(dl, N0, MVT::i1);
1966 N0 = DAG.getNode(ISD::AND, dl, MVT::i1, N1, Temp);
1972 Temp = DAG.getNOT(dl, N1, MVT::i1);
1973 N0 = DAG.getNode(ISD::AND, dl, MVT::i1, N0, Temp);
1979 Temp = DAG.getNOT(dl, N0, MVT::i1);
1980 N0 = DAG.getNode(ISD::OR, dl, MVT::i1, N1, Temp);
1986 Temp = DAG.getNOT(dl, N1, MVT::i1);
1987 N0 = DAG.getNode(ISD::OR, dl, MVT::i1, N0, Temp);
1994 N0 = DAG.getNode(ISD::ZERO_EXTEND, dl, VT, N0);
2104 SelectionDAG &DAG) const {
2144 Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(),
2156 Ops.push_back(DAG.getTargetConstant(C->getAPIntValue().getSExtValue(),
2533 SDValue Op, SelectionDAG *DAG) {
2553 ResultOps, *DAG);
2584 SelectionDAG *DAG) const {
2592 ChooseConstraint(OpInfo, *this, Op, DAG);
2618 SelectionDAG &DAG) const {
2627 SDValue Amt = DAG.getConstant(ShAmt, getShiftAmountTy(Op1.getValueType()));
2628 Op1 = DAG.getNode(ISD::SRA, dl, Op1.getValueType(), Op1, Amt, false, false,
2638 Op2 = DAG.getConstant(xn, Op1.getValueType());
2639 return DAG.getNode(ISD::MUL, dl, Op1.getValueType(), Op1, Op2);
2643 /// return a DAG expression to select that will generate the same value by
2647 SelectionDAG &DAG, bool IsAfterLegalization,
2664 Q = DAG.getNode(ISD::MULHS, dl, VT, N->getOperand(0),
2665 DAG.getConstant(magics.m, VT));
2668 Q = SDValue(DAG.getNode(ISD::SMUL_LOHI, dl, DAG.getVTList(VT, VT),
2670 DAG.getConstant(magics.m, VT)).getNode(), 1);
2675 Q = DAG.getNode(ISD::ADD, dl, VT, Q, N->getOperand(0));
2681 Q = DAG.getNode(ISD::SUB, dl, VT, Q, N->getOperand(0));
2687 Q = DAG.getNode(ISD::SRA, dl, VT, Q,
2688 DAG.getConstant(magics.s, getShiftAmountTy(Q.getValueType())));
2693 SDValue T = DAG.getNode(ISD::SRL, dl, VT, Q,
2694 DAG.getConstant(VT.getScalarSizeInBits() - 1,
2698 return DAG.getNode(ISD::ADD, dl, VT, Q, T);
2702 /// return a DAG expression to select that will generate the same value by
2706 SelectionDAG &DAG, bool IsAfterLegalization,
2726 Q = DAG.getNode(ISD::SRL, dl, VT, Q,
2727 DAG.getConstant(Shift, getShiftAmountTy(Q.getValueType())));
2740 Q = DAG.getNode(ISD::MULHU, dl, VT, Q, DAG.getConstant(magics.m, VT));
2743 Q = SDValue(DAG.getNode(ISD::UMUL_LOHI, dl, DAG.getVTList(VT, VT), Q,
2744 DAG.getConstant(magics.m, VT)).getNode(), 1);
2753 return DAG.getNode(ISD::SRL, dl, VT, Q,
2754 DAG.getConstant(magics.s, getShiftAmountTy(Q.getValueType())));
2756 SDValue NPQ = DAG.getNode(ISD::SUB, dl, VT, N->getOperand(0), Q);
2759 NPQ = DAG.getNode(ISD::SRL, dl, VT, NPQ,
2760 DAG.getConstant(1, getShiftAmountTy(NPQ.getValueType())));
2763 NPQ = DAG.getNode(ISD::ADD, dl, VT, NPQ, Q);
2766 return DAG.getNode(ISD::SRL, dl, VT, NPQ,
2767 DAG.getConstant(magics.s-1, getShiftAmountTy(NPQ.getValueType())));
2772 verifyReturnAddressArgumentIsConstant(SDValue Op, SelectionDAG &DAG) const {
2774 DAG.getContext()->emitError("argument to '__builtin_return_address' must "
2787 SelectionDAG &DAG, SDValue LL, SDValue LH,
2799 unsigned LHSSB = DAG.ComputeNumSignBits(N->getOperand(0));
2800 unsigned RHSSB = DAG.ComputeNumSignBits(N->getOperand(1));
2808 LL = DAG.getNode(ISD::TRUNCATE, dl, HiLoVT, N->getOperand(0));
2809 RL = DAG.getNode(ISD::TRUNCATE, dl, HiLoVT, N->getOperand(1));
2816 if (DAG.MaskedValueIsZero(N->getOperand(0), HighMask) &&
2817 DAG.MaskedValueIsZero(N->getOperand(1), HighMask)) {
2821 Lo = DAG.getNode(ISD::UMUL_LOHI, dl,
2822 DAG.getVTList(HiLoVT, HiLoVT), LL, RL);
2828 Lo = DAG.getNode(ISD::MUL, dl, HiLoVT, LL, RL);
2829 Hi = DAG.getNode(ISD::MULHU, dl, HiLoVT, LL, RL);
2837 Lo = DAG.getNode(ISD::SMUL_LOHI, dl,
2838 DAG.getVTList(HiLoVT, HiLoVT), LL, RL);
2844 Lo = DAG.getNode(ISD::MUL, dl, HiLoVT, LL, RL);
2845 Hi = DAG.getNode(ISD::MULHS, dl, HiLoVT, LL, RL);
2854 SDValue Shift = DAG.getConstant(ShiftAmt, getShiftAmountTy(VT));
2855 LH = DAG.getNode(ISD::SRL, dl, VT, N->getOperand(0), Shift);
2856 LH = DAG.getNode(ISD::TRUNCATE, dl, HiLoVT, LH);
2857 RH = DAG.getNode(ISD::SRL, dl, VT, N->getOperand(1), Shift);
2858 RH = DAG.getNode(ISD::TRUNCATE, dl, HiLoVT, RH);
2866 SDValue UMulLOHI = DAG.getNode(ISD::UMUL_LOHI, dl,
2867 DAG.getVTList(HiLoVT, HiLoVT), LL, RL);
2870 RH = DAG.getNode(ISD::MUL, dl, HiLoVT, LL, RH);
2871 LH = DAG.getNode(ISD::MUL, dl, HiLoVT, LH, RL);
2872 Hi = DAG.getNode(ISD::ADD, dl, HiLoVT, Hi, RH);
2873 Hi = DAG.getNode(ISD::ADD, dl, HiLoVT, Hi, LH);
2877 Lo = DAG.getNode(ISD::MUL, dl, HiLoVT, LL, RL);
2878 Hi = DAG.getNode(ISD::MULHU, dl, HiLoVT, LL, RL);
2879 RH = DAG.getNode(ISD::MUL, dl, HiLoVT, LL, RH);
2880 LH = DAG.getNode(ISD::MUL, dl, HiLoVT, LH, RL);
2881 Hi = DAG.getNode(ISD::ADD, dl, HiLoVT, Hi, RH);
2882 Hi = DAG.getNode(ISD::ADD, dl, HiLoVT, Hi, LH);