Home | History | Annotate | Download | only in SelectionDAG

Lines Matching defs:DAG

47 bool TargetLowering::isInTailCallPosition(SelectionDAG &DAG, SDNode *Node,
49 const Function *F = DAG.getMachineFunction().getFunction();
70 SDValue TargetLowering::makeLibCall(SelectionDAG &DAG,
80 Entry.Ty = Entry.Node.getValueType().getTypeForEVT(*DAG.getContext());
85 SDValue Callee = DAG.getExternalSymbol(getLibcallName(LC), getPointerTy());
87 Type *RetTy = RetVT.getTypeForEVT(*DAG.getContext());
89 CallLoweringInfo CLI(DAG.getEntryNode(), RetTy, isSigned, !isSigned, false,
93 Callee, Args, DAG, dl);
102 void TargetLowering::softenSetCCOperands(SelectionDAG &DAG, EVT VT,
186 NewLHS = makeLibCall(DAG, LC1, RetVT, Ops, 2, false/*sign irrelevant*/, dl);
187 NewRHS = DAG.getConstant(0, RetVT);
190 SDValue Tmp = DAG.getNode(ISD::SETCC, dl, getSetCCResultType(RetVT),
191 NewLHS, NewRHS, DAG.getCondCode(CCCode));
192 NewLHS = makeLibCall(DAG, LC2, RetVT, Ops, 2, false/*sign irrelevant*/, dl);
193 NewLHS = DAG.getNode(ISD::SETCC, dl, getSetCCResultType(RetVT), NewLHS,
194 NewRHS, DAG.getCondCode(getCmpLibcallCC(LC2)));
195 NewLHS = DAG.getNode(ISD::OR, dl, Tmp.getValueType(), Tmp, NewLHS);
217 SelectionDAG &DAG) const {
223 return DAG.getGLOBAL_OFFSET_TABLE(getPointerTy(0));
283 SDValue New = DAG.getNode(Op.getOpcode(), dl, VT, Op.getOperand(0),
284 DAG.getConstant(Demanded &
318 const TargetLowering &TLI = DAG.getTargetLoweringInfo();
324 EVT SmallVT = EVT::getIntegerVT(*DAG.getContext(), SmallVTBits);
328 SDValue X = DAG.getNode(Op.getOpcode(), dl, SmallVT,
329 DAG.getNode(ISD::TRUNCATE, dl, SmallVT,
331 DAG.getNode(ISD::TRUNCATE, dl, SmallVT,
334 SDValue Z = DAG.getNode(NeedZext ? ISD::ZERO_EXTEND : ISD::ANY_EXTEND,
344 /// use this information to simplify Op, create a new simplified DAG node and
369 TLO.DAG.ComputeMaskedBits(Op, KnownZero, KnownOne, Depth);
378 return TLO.CombineTo(Op, TLO.DAG.getUNDEF(Op.getValueType()));
399 TLO.DAG.ComputeMaskedBits(Op.getOperand(0), LHSZero, LHSOne, Depth);
426 return TLO.CombineTo(Op, TLO.DAG.getConstant(0, Op.getValueType()));
497 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, dl, Op.getValueType(),
514 SDValue ANDC = TLO.DAG.getConstant(~KnownOne & NewMask, VT);
515 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::AND, dl, VT,
529 SDValue New = TLO.DAG.getNode(Op.getOpcode(), dl,VT, Op.getOperand(0),
530 TLO.DAG.getConstant(Expanded, VT));
603 TLO.DAG.getConstant(Diff, Op.getOperand(1).getValueType());
605 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT,
626 TLO.DAG.getNode(ISD::SHL, dl, InnerVT, InnerOp,
627 TLO.DAG.getConstant(ShAmt, ShTy));
630 TLO.DAG.getNode(ISD::ANY_EXTEND, dl, Op.getValueType(),
667 TLO.DAG.getConstant(Diff, Op.getOperand(1).getValueType());
668 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT,
692 TLO.DAG.getNode(ISD::SRL, dl, Op.getValueType(),
724 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl, VT,
747 SDValue ShiftAmt = TLO.DAG.getConstant(BitWidth - ShAmt, ShiftAmtTy);
748 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl,
784 TLO.DAG.getZeroExtendInReg(Op.getOperand(0),dl,ExVT));
804 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::ANY_EXTEND, dl,
826 return TLO.CombineTo(Op,TLO.DAG.getNode(ISD::ANY_EXTEND, dl,
844 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::ZERO_EXTEND, dl,
903 TLO.DAG.getConstant(ShVal, getShiftAmountTy(Op.getValueType()));
913 SDValue NewTrunc = TLO.DAG.getNode(ISD::TRUNCATE, dl,
916 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl,
956 SDValue Sign = TLO.DAG.getNode(ISD::FGETSIGN, dl, Ty, Op.getOperand(0));
959 Sign = TLO.DAG.getNode(ISD::ZERO_EXTEND, dl, Op.getValueType(), Sign);
961 SDValue ShAmt = TLO.DAG.getConstant(ShVal, Op.getValueType());
962 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl,
988 TLO.DAG.ComputeMaskedBits(Op, KnownZero, KnownOne, Depth);
995 return TLO.CombineTo(Op, TLO.DAG.getConstant(KnownOne, Op.getValueType()));
1006 const SelectionDAG &DAG,
1019 /// DAG Combiner.
1035 static bool ValueHasExactlyOneBitSet(SDValue Val, const SelectionDAG &DAG) {
1059 DAG.ComputeMaskedBits(Val, KnownZero, KnownOne);
1070 SelectionDAG &DAG = DCI.DAG;
1076 case ISD::SETFALSE2: return DAG.getConstant(0, VT);
1078 case ISD::SETTRUE2: return DAG.getConstant(1, VT);
1084 return DAG.getSetCC(dl, VT, N1, N0, ISD::getSetCCSwappedOperands(Cond));
1108 SDValue Zero = DAG.getConstant(0, N0.getValueType());
1109 return DAG.getSetCC(dl, VT, N0.getOperand(0).getOperand(0),
1128 SDValue Sub = DAG.getNode(ISD::SUB, dl, CTVT, CTOp,
1129 DAG.getConstant(1, CTVT));
1130 SDValue And = DAG.getNode(ISD::AND, dl, CTVT, CTOp, Sub);
1132 return DAG.getSetCC(dl, VT, And, DAG.getConstant(0, CTVT), CC);
1164 EVT MinVT = EVT::getIntegerVT(*DAG.getContext(), MinBits);
1167 SDValue Trunc = DAG.getNode(ISD::TRUNCATE, dl, MinVT, PreZExt);
1168 SDValue C = DAG.getConstant(C1.trunc(MinBits), MinVT);
1169 return DAG.getSetCC(dl, VT, Trunc, C, Cond);
1212 EVT newVT = EVT::getIntegerVT(*DAG.getContext(), bestWidth);
1217 Ptr = DAG.getNode(ISD::ADD, dl, PtrType, Lod->getBasePtr(),
1218 DAG.getConstant(bestOffset, PtrType));
1220 SDValue NewLoad = DAG.getLoad(newVT, dl, Lod->getChain(), Ptr,
1223 return DAG.getSetCC(dl, VT,
1224 DAG.getNode(ISD::AND, dl, newVT, NewLoad,
1225 DAG.getConstant(bestMask.trunc(bestWidth),
1227 DAG.getConstant(0LL, newVT), Cond);
1243 case ISD::SETEQ: return DAG.getConstant(0, VT);
1246 case ISD::SETNE: return DAG.getConstant(1, VT);
1250 return DAG.getConstant(C1.isNegative(), VT);
1254 return DAG.getConstant(C1.isNonNegative(), VT);
1272 return DAG.getSetCC(dl, VT, N0.getOperand(0),
1273 DAG.getConstant(C1.trunc(InSize), newVT),
1290 return DAG.getConstant(Cond == ISD::SETNE, VT);
1298 ZextOp = DAG.getNode(ISD::AND, dl, Op0Ty, N0.getOperand(0),
1299 DAG.getConstant(Imm, Op0Ty));
1304 return DAG.getSetCC(dl, VT, ZextOp,
1305 DAG.getConstant(C1 & APInt::getLowBitsSet(
1317 return DAG.getNode(ISD::TRUNCATE, dl, VT, N0);
1322 return DAG.getSetCC(dl, VT, N0.getOperand(0), N0.getOperand(1), CC);
1334 if (DAG.MaskedValueIsZero(N0,
1345 Val = DAG.getNode(ISD::AND, dl, N0.getValueType(),
1350 return DAG.getSetCC(dl, VT, Val, N1,
1365 return DAG.getSetCC(dl, VT, Op0.getOperand(0), Op0.getOperand(1),
1373 Op0 = DAG.getNode(ISD::AND, dl, VT,
1374 DAG.getNode(ISD::TRUNCATE, dl, VT, Op0.getOperand(0)),
1375 DAG.getConstant(1, VT));
1377 Op0 = DAG.getNode(ISD::AND, dl, VT,
1378 DAG.getNode(ISD::ANY_EXTEND, dl, VT, Op0.getOperand(0)),
1379 DAG.getConstant(1, VT));
1381 return DAG.getSetCC(dl, VT, Op0,
1382 DAG.getConstant(0, Op0.getValueType()),
1387 return DAG.getSetCC(dl, VT, Op0,
1388 DAG.getConstant(0, Op0.getValueType()),
1405 if (C1 == MinVal) return DAG.getConstant(1, VT); // X >= MIN --> true
1407 return DAG.getSetCC(dl, VT, N0,
1408 DAG.getConstant(C1-1, N1.getValueType()),
1413 if (C1 == MaxVal) return DAG.getConstant(1, VT); // X <= MAX --> true
1415 return DAG.getSetCC(dl, VT, N0,
1416 DAG.getConstant(C1+1, N1.getValueType()),
1421 return DAG.getConstant(0, VT); // X < MIN --> false
1423 return DAG.getConstant(1, VT); // X >= MIN --> true
1425 return DAG.getConstant(0, VT); // X > MAX --> false
1427 return DAG.getConstant(1, VT); // X <= MAX --> true
1431 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETNE);
1434 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETNE);
1438 return DAG.getSetCC(dl, VT, N0,
1439 DAG.getConstant(MinVal, N0.getValueType()),
1443 return DAG.getSetCC(dl, VT, N0,
1444 DAG.getConstant(MaxVal, N0.getValueType()),
1453 return DAG.getSetCC(dl, VT, N0,
1454 DAG.getConstant(0, N1.getValueType()),
1461 DAG.getConstant(APInt::getAllOnesValue(OperandBitSize),
1463 return DAG.getSetCC(dl, VT, N0, ConstMinusOne, ISD::SETGT);
1478 return DAG.getNode(ISD::TRUNCATE, dl, VT,
1479 DAG.getNode(ISD::SRL, dl, N0.getValueType(), N0,
1480 DAG.getConstant(AndRHS->getAPIntValue().logBase2(), ShiftTy)));
1486 return DAG.getNode(ISD::TRUNCATE, dl, VT,
1487 DAG.getNode(ISD::SRL, dl, N0.getValueType(), N0,
1488 DAG.getConstant(C1.logBase2(), ShiftTy)));
1506 SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0.getOperand(0),
1507 DAG.getConstant(ShiftBits, ShiftTy));
1508 SDValue CmpRHS = DAG.getConstant(C1.lshr(ShiftBits), CmpTy);
1509 return DAG.getSetCC(dl, VT, Shift, CmpRHS, Cond);
1534 SDValue Shift = DAG.getNode(ISD::SRL, dl, CmpTy, N0,
1535 DAG.getConstant(ShiftBits, ShiftTy));
1536 SDValue CmpRHS = DAG.getConstant(NewC, CmpTy);
1537 return DAG.getSetCC(dl, VT, Shift, CmpRHS, NewCond);
1545 SDValue O = DAG.FoldSetCC(VT, N0, N1, Cond, dl);
1555 return DAG.getConstant(0, VT);
1557 return DAG.getConstant(1, VT);
1559 return DAG.getUNDEF(VT);
1568 return DAG.getSetCC(dl, VT, N0, N0, Cond);
1580 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETOLE);
1583 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETULE);
1586 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETUGT);
1589 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETOGT);
1593 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETOGE);
1596 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETUGE);
1599 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETULT);
1602 return DAG.getSetCC(dl, VT, N0, N1, ISD::SETOLT);
1624 return DAG.getConstant(EqVal, VT);
1628 return DAG.getConstant(EqVal, VT);
1630 return DAG.getConstant(EqVal, VT);
1636 return DAG.getSetCC(dl, VT, N0, N1, NewCond);
1646 return DAG.getSetCC(dl, VT, N0.getOperand(1), N1.getOperand(1), Cond);
1648 return DAG.getSetCC(dl, VT, N0.getOperand(0), N1.getOperand(0), Cond);
1649 if (DAG.isCommutativeBinOp(N0.getOpcode())) {
1652 return DAG.getSetCC(dl, VT, N0.getOperand(1), N1.getOperand(0),
1655 return DAG.getSetCC(dl, VT, N0.getOperand(0), N1.getOperand(1),
1668 return DAG.getSetCC(dl, VT, N0.getOperand(0),
1669 DAG.getConstant(RHSC->getAPIntValue()-
1678 if (DAG.MaskedValueIsZero(N0.getOperand(0), ~LHSR->getAPIntValue()))
1680 DAG.getSetCC(dl, VT, N0.getOperand(0),
1681 DAG.getConstant(LHSR->getAPIntValue() ^
1691 DAG.getSetCC(dl, VT, N0.getOperand(1),
1692 DAG.getConstant(SUBC->getAPIntValue() -
1710 return DAG.getSetCC(dl, VT, N0.getOperand(1),
1711 DAG.getConstant(0, N0.getValueType()), Cond);
1713 if (DAG.isCommutativeBinOp(N0.getOpcode()))
1714 return DAG.getSetCC(dl, VT, N0.getOperand(0),
1715 DAG.getConstant(0, N0.getValueType()), Cond);
1719 SDValue SH = DAG.getNode(ISD::SHL, dl, N1.getValueType(), N1,
1720 DAG.getConstant(1, getShiftAmountTy(N1.getValueType())));
1723 return DAG.getSetCC(dl, VT, N0.getOperand(0), SH, Cond);
1733 return DAG.getSetCC(dl, VT, N1.getOperand(1),
1734 DAG.getConstant(0, N1.getValueType()), Cond);
1736 if (DAG.isCommutativeBinOp(N1.getOpcode()))
1737 return DAG.getSetCC(dl, VT, N1.getOperand(0),
1738 DAG.getConstant(0, N1.getValueType()), Cond);
1742 SDValue SH = DAG.getNode(ISD::SHL, dl, N1.getValueType(), N0,
1743 DAG.getConstant(1, getShiftAmountTy(N0.getValueType())));
1746 return DAG.getSetCC(dl, VT, SH, N1.getOperand(0), Cond);
1757 if (ValueHasExactlyOneBitSet(N1, DAG)) {
1759 SDValue Zero = DAG.getConstant(0, N1.getValueType());
1760 return DAG.getSetCC(dl, VT, N0, Zero, Cond);
1765 if (ValueHasExactlyOneBitSet(N0, DAG)) {
1767 SDValue Zero = DAG.getConstant(0, N0.getValueType());
1768 return DAG.getSetCC(dl, VT, N1, Zero, Cond);
1779 Temp = DAG.getNode(ISD::XOR, dl, MVT::i1, N0, N1);
1780 N0 = DAG.getNOT(dl, Temp, MVT::i1);
1785 N0 = DAG.getNode(ISD::XOR, dl, MVT::i1, N0, N1);
1789 Temp = DAG.getNOT(dl, N0, MVT::i1);
1790 N0 = DAG.getNode(ISD::AND, dl, MVT::i1, N1, Temp);
1796 Temp = DAG.getNOT(dl, N1, MVT::i1);
1797 N0 = DAG.getNode(ISD::AND, dl, MVT::i1, N0, Temp);
1803 Temp = DAG.getNOT(dl, N0, MVT::i1);
1804 N0 = DAG.getNode(ISD::OR, dl, MVT::i1, N1, Temp);
1810 Temp = DAG.getNOT(dl, N1, MVT::i1);
1811 N0 = DAG.getNode(ISD::OR, dl, MVT::i1, N0, Temp);
1818 N0 = DAG.getNode(ISD::ZERO_EXTEND, dl, VT, N0);
1928 SelectionDAG &DAG) const {
1968 Ops.push_back(DAG.getTargetGlobalAddress(GA->getGlobal(),
1980 Ops.push_back(DAG.getTargetConstant(C->getAPIntValue().getSExtValue(),
2356 SDValue Op, SelectionDAG *DAG) {
2376 ResultOps, *DAG);
2407 SelectionDAG *DAG) const {
2415 ChooseConstraint(OpInfo, *this, Op, DAG);
2441 SelectionDAG &DAG) const {
2450 SDValue Amt = DAG.getConstant(ShAmt, getShiftAmountTy(Op1.getValueType()));
2451 Op1 = DAG.getNode(ISD::SRA, dl, Op1.getValueType(), Op1, Amt);
2460 Op2 = DAG.getConstant(xn, Op1.getValueType());
2461 return DAG.getNode(ISD::MUL, dl, Op1.getValueType(), Op1, Op2);
2465 /// return a DAG expression to select that will generate the same value by
2469 BuildSDIV(SDNode *N, SelectionDAG &DAG, bool IsAfterLegalization,
2487 Q = DAG.getNode(ISD::MULHS, dl, VT, N->getOperand(0),
2488 DAG.getConstant(magics.m, VT));
2491 Q = SDValue(DAG.getNode(ISD::SMUL_LOHI, dl, DAG.getVTList(VT, VT),
2493 DAG.getConstant(magics.m, VT)).getNode(), 1);
2498 Q = DAG.getNode(ISD::ADD, dl, VT, Q, N->getOperand(0));
2504 Q = DAG.getNode(ISD::SUB, dl, VT, Q, N->getOperand(0));
2510 Q = DAG.getNode(ISD::SRA, dl, VT, Q,
2511 DAG.getConstant(magics.s, getShiftAmountTy(Q.getValueType())));
2517 DAG.getNode(ISD::SRL, dl, VT, Q, DAG.getConstant(VT.getSizeInBits()-1,
2521 return DAG.getNode(ISD::ADD, dl, VT, Q, T);
2525 /// return a DAG expression to select that will generate the same value by
2529 BuildUDIV(SDNode *N, SelectionDAG &DAG, bool IsAfterLegalization,
2550 Q = DAG.getNode(ISD::SRL, dl, VT, Q,
2551 DAG.getConstant(Shift, getShiftAmountTy(Q.getValueType())));
2564 Q = DAG.getNode(ISD::MULHU, dl, VT, Q, DAG.getConstant(magics.m, VT));
2567 Q = SDValue(DAG.getNode(ISD::UMUL_LOHI, dl, DAG.getVTList(VT, VT), Q,
2568 DAG.getConstant(magics.m, VT)).getNode(), 1);
2577 return DAG.getNode(ISD::SRL, dl, VT, Q,
2578 DAG.getConstant(magics.s, getShiftAmountTy(Q.getValueType())));
2580 SDValue NPQ = DAG.getNode(ISD::SUB, dl, VT, N->getOperand(0), Q);
2583 NPQ = DAG.getNode(ISD::SRL, dl, VT, NPQ,
2584 DAG.getConstant(1, getShiftAmountTy(NPQ.getValueType())));
2587 NPQ = DAG.getNode(ISD::ADD, dl, VT, NPQ, Q);
2590 return DAG.getNode(ISD::SRL, dl, VT, NPQ,
2591 DAG.getConstant(magics.s-1, getShiftAmountTy(NPQ.getValueType())));