Home | History | Annotate | Download | only in SelectionDAG

Lines Matching refs:VT

259     SDValue SimplifySetCC(EVT VT, SDValue N0, SDValue N1, ISD::CondCode Cond,
263 SDValue CombineConsecutiveLoads(SDNode *N, EVT VT);
333 /// legalization or if the specified VT is legal.
334 bool isTypeLegal(const EVT &VT) {
336 return TLI.isTypeLegal(VT);
578 EVT VT = N0.getValueType();
583 DAG.FoldConstantArithmetic(Opc, VT,
586 return DAG.getNode(Opc, DL, VT, N0.getOperand(0), OpNode);
590 SDValue OpNode = DAG.getNode(Opc, N0.getDebugLoc(), VT,
593 return DAG.getNode(Opc, DL, VT, OpNode, N0.getOperand(1));
601 DAG.FoldConstantArithmetic(Opc, VT,
604 return DAG.getNode(Opc, DL, VT, N1.getOperand(0), OpNode);
608 SDValue OpNode = DAG.getNode(Opc, N0.getDebugLoc(), VT,
611 return DAG.getNode(Opc, DL, VT, OpNode, N1.getOperand(1));
710 EVT VT = Load->getValueType(0);
711 SDValue Trunc = DAG.getNode(ISD::TRUNCATE, dl, VT, SDValue(ExtLoad, 0));
804 EVT VT = Op.getValueType();
805 if (VT.isVector() || !VT.isInteger())
811 if (TLI.isTypeDesirableForOp(Opc, VT))
814 EVT PVT = VT;
818 assert(PVT != VT && "Don't know what type to promote to!");
849 return DAG.getNode(ISD::TRUNCATE, dl, VT,
862 EVT VT = Op.getValueType();
863 if (VT.isVector() || !VT.isInteger())
869 if (TLI.isTypeDesirableForOp(Opc, VT))
872 EVT PVT = VT;
876 assert(PVT != VT && "Don't know what type to promote to!");
896 return DAG.getNode(ISD::TRUNCATE, dl, VT,
906 EVT VT = Op.getValueType();
907 if (VT.isVector() || !VT.isInteger())
913 if (TLI.isTypeDesirableForOp(Opc, VT))
916 EVT PVT = VT;
920 assert(PVT != VT && "Don't know what type to promote to!");
926 return DAG.getNode(Op.getOpcode(), Op.getDebugLoc(), VT, Op.getOperand(0));
935 EVT VT = Op.getValueType();
936 if (VT.isVector() || !VT.isInteger())
942 if (TLI.isTypeDesirableForOp(Opc, VT))
945 EVT PVT = VT;
949 assert(PVT != VT && "Don't know what type to promote to!");
964 SDValue Result = DAG.getNode(ISD::TRUNCATE, dl, VT, NewLD);
1355 EVT VT = N0.getValueType();
1363 N0 = DAG.getNode(ISD::ADD, N0.getDebugLoc(), VT,
1364 DAG.getNode(ISD::SHL, N00.getDebugLoc(), VT,
1366 DAG.getNode(ISD::SHL, N01.getDebugLoc(), VT,
1368 return DAG.getNode(ISD::ADD, DL, VT, N0, N1);
1379 EVT VT = N0.getValueType();
1382 if (VT.isVector()) {
1400 return DAG.FoldConstantArithmetic(ISD::ADD, VT, N0C, N1C);
1403 return DAG.getNode(ISD::ADD, N->getDebugLoc(), VT, N1, N0);
1411 return DAG.getGlobalAddress(GA->getGlobal(), N1C->getDebugLoc(), VT,
1417 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT,
1419 N0C->getAPIntValue(), VT),
1428 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N1, N0.getOperand(1));
1432 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N0, N1.getOperand(1));
1442 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N1.getOperand(0),
1447 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N1.getOperand(0),
1453 return DAG.getNode(N1.getOpcode(), N->getDebugLoc(), VT,
1464 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT,
1465 DAG.getNode(ISD::ADD, N0.getDebugLoc(), VT, N00, N10),
1466 DAG.getNode(ISD::ADD, N1.getDebugLoc(), VT, N01, N11));
1469 if (!VT.isVector() && SimplifyDemandedBits(SDValue(N, 0)))
1473 if (VT.isInteger() && !VT.isVector()) {
1484 return DAG.getNode(ISD::OR, N->getDebugLoc(), VT, N0, N1);
1504 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N0,
1505 DAG.getNode(ISD::SHL, N->getDebugLoc(), VT,
1513 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N1,
1514 DAG.getNode(ISD::SHL, N->getDebugLoc(), VT,
1522 unsigned DestBits = VT.getScalarType().getSizeInBits();
1528 return DAG.getNode(ISD::SUB, DL, VT, N->getOperand(0), AndOp0);
1537 SDValue ZExt = DAG.getNode(ISD::ZERO_EXTEND, DL, VT, N0.getOperand(0));
1538 return DAG.getNode(ISD::SUB, DL, VT, N1, ZExt);
1549 EVT VT = N0.getValueType();
1553 return CombineTo(N, DAG.getNode(ISD::ADD, N->getDebugLoc(), VT, N0, N1),
1577 return CombineTo(N, DAG.getNode(ISD::OR, N->getDebugLoc(), VT, N0, N1),
1606 static SDValue tryFoldToZero(DebugLoc DL, const TargetLowering &TLI, EVT VT,
1608 if (!VT.isVector()) {
1609 return DAG.getConstant(0, VT);
1611 if (!LegalOperations || TLI.isOperationLegal(ISD::BUILD_VECTOR, VT)) {
1613 SDValue El = DAG.getConstant(0, VT.getVectorElementType());
1614 std::vector<SDValue> Ops(VT.getVectorNumElements(), El);
1615 return DAG.getNode(ISD::BUILD_VECTOR, DL, VT,
1628 EVT VT = N0.getValueType();
1631 if (VT.isVector()) {
1643 return tryFoldToZero(N->getDebugLoc(), TLI, VT, DAG, LegalOperations);
1646 return DAG.FoldConstantArithmetic(ISD::SUB, VT, N0C, N1C);
1649 return DAG.getNode(ISD::ADD, N->getDebugLoc(), VT, N0,
1650 DAG.getConstant(-N1C->getAPIntValue(), VT));
1653 return DAG.getNode(ISD::XOR, N->getDebugLoc(), VT, N1, N0);
1666 VT);
1667 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, NewC,
1675 return DAG.getNode(N0.getOperand(1).getOpcode(), N->getDebugLoc(), VT,
1681 return DAG.getNode(ISD::ADD, N->getDebugLoc(), VT,
1687 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT,
1701 return DAG.getGlobalAddress(GA->getGlobal(), N1C->getDebugLoc(), VT,
1708 VT);
1719 EVT VT = N0.getValueType();
1723 return CombineTo(N, DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N0, N1),
1729 return CombineTo(N, DAG.getConstant(0, VT),
1740 return CombineTo(N, DAG.getNode(ISD::XOR, N->getDebugLoc(), VT, N1, N0),
1764 EVT VT = N0.getValueType();
1767 if (VT.isVector()) {
1774 return DAG.getConstant(0, VT);
1777 return DAG.FoldConstantArithmetic(ISD::MUL, VT, N0C, N1C);
1780 return DAG.getNode(ISD::MUL, N->getDebugLoc(), VT, N1, N0);
1786 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT,
1787 DAG.getConstant(0, VT), N0);
1790 return DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0,
1798 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT,
1799 DAG.getConstant(0, VT),
1800 DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0,
1807 SDValue C3 = DAG.getNode(ISD::SHL, N->getDebugLoc(), VT,
1810 return DAG.getNode(ISD::MUL, N->getDebugLoc(), VT,
1829 SDValue Mul = DAG.getNode(ISD::MUL, N->getDebugLoc(), VT,
1831 return DAG.getNode(ISD::SHL, N->getDebugLoc(), VT,
1839 return DAG.getNode(ISD::ADD, N->getDebugLoc(), VT,
1840 DAG.getNode(ISD::MUL, N0.getDebugLoc(), VT,
1842 DAG.getNode(ISD::MUL, N1.getDebugLoc(), VT,
1858 EVT VT = N->getValueType(0);
1861 if (VT.isVector()) {
1868 return DAG.FoldConstantArithmetic(ISD::SDIV, VT, N0C, N1C);
1874 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT,
1875 DAG.getConstant(0, VT), N0);
1878 if (!VT.isVector()) {
1895 SDValue SGN = DAG.getNode(ISD::SRA, N->getDebugLoc(), VT, N0,
1896 DAG.getConstant(VT.getSizeInBits()-1,
1901 SDValue SRL = DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, SGN,
1902 DAG.getConstant(VT.getSizeInBits() - lg2,
1904 SDValue ADD = DAG.getNode(ISD::ADD, N->getDebugLoc(), VT, N0, SRL);
1907 SDValue SRA = DAG.getNode(ISD::SRA, N->getDebugLoc(), VT, ADD,
1916 return DAG.getNode(ISD::SUB, N->getDebugLoc(), VT,
1917 DAG.getConstant(0, VT), SRA);
1929 return DAG.getConstant(0, VT);
1942 EVT VT = N->getValueType(0);
1945 if (VT.isVector()) {
1952 return DAG.FoldConstantArithmetic(ISD::UDIV, VT, N0C, N1C);
1955 return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0,
1969 return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0, Add);
1981 return DAG.getConstant(0, VT);
1994 EVT VT = N->getValueType(0);
1998 return DAG.FoldConstantArithmetic(ISD::SREM, VT, N0C, N1C);
2001 if (!VT.isVector()) {
2003 return DAG.getNode(ISD::UREM, N->getDebugLoc(), VT, N0, N1);
2009 SDValue Div = DAG.getNode(ISD::SDIV, N->getDebugLoc(), VT, N0, N1);
2013 SDValue Mul = DAG.getNode(ISD::MUL, N->getDebugLoc(), VT,
2015 SDValue Sub = DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N0, Mul);
2023 return DAG.getConstant(0, VT);
2036 EVT VT = N->getValueType(0);
2040 return DAG.FoldConstantArithmetic(ISD::UREM, VT, N0C, N1C);
2043 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, N0,
2044 DAG.getConstant(N1C->getAPIntValue()-1,VT));
2050 DAG.getNode(ISD::ADD, N->getDebugLoc(), VT, N1,
2051 DAG.getConstant(APInt::getAllOnesValue(VT.getSizeInBits()),
2052 VT));
2054 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, N0, Add);
2062 SDValue Div = DAG.getNode(ISD::UDIV, N->getDebugLoc(), VT, N0, N1);
2066 SDValue Mul = DAG.getNode(ISD::MUL, N->getDebugLoc(), VT,
2068 SDValue Sub = DAG.getNode(ISD::SUB, N->getDebugLoc(), VT, N0, Mul);
2076 return DAG.getConstant(0, VT);
2088 EVT VT = N->getValueType(0);
2101 return DAG.getConstant(0, VT);
2105 if (VT.isSimple() && !VT.isVector()) {
2106 MVT Simple = VT.getSimpleVT();
2115 return DAG.getNode(ISD::TRUNCATE, DL, VT, N1);
2126 EVT VT = N->getValueType(0);
2137 return DAG.getConstant(0, VT);
2141 if (VT.isSimple() && !VT.isVector()) {
2142 MVT Simple = VT.getSimpleVT();
2151 return DAG.getNode(ISD::TRUNCATE, DL, VT, N1);
2218 EVT VT = N->getValueType(0);
2223 if (VT.isSimple() && !VT.isVector()) {
2224 MVT Simple = VT.getSimpleVT();
2234 Hi = DAG.getNode(ISD::TRUNCATE, DL, VT, Hi);
2236 Lo = DAG.getNode(ISD::TRUNCATE, DL, VT, Lo);
2248 EVT VT = N->getValueType(0);
2253 if (VT.isSimple() && !VT.isVector()) {
2254 MVT Simple = VT.getSimpleVT();
2264 Hi = DAG.getNode(ISD::TRUNCATE, DL, VT, Hi);
2266 Lo = DAG.getNode(ISD::TRUNCATE, DL, VT, Lo);
2312 EVT VT = N0.getValueType();
2333 (!TLI.isZExtFree(VT, Op0VT) ||
2334 !TLI.isTruncateFree(Op0VT, VT)) &&
2336 !VT.isVector() &&
2343 return DAG.getNode(N0.getOpcode(), N->getDebugLoc(), VT, ORNode);
2357 return DAG.getNode(N0.getOpcode(), N->getDebugLoc(), VT,
2380 SDValue BC = DAG.getNode(N0.getOpcode(), DL, VT, Op);
2402 unsigned NumElts = VT.getVectorNumElements();
2417 SDValue Op = DAG.getNode(N->getOpcode(), N->getDebugLoc(), VT,
2420 return DAG.getVectorShuffle(VT, N->getDebugLoc(), Op,
2421 DAG.getUNDEF(VT), &SVN0->getMask()[0]);
2434 EVT VT = N1.getValueType();
2435 unsigned BitWidth = VT.getScalarType().getSizeInBits();
2438 if (VT.isVector()) {
2457 return DAG.getConstant(0, VT);
2460 return DAG.FoldConstantArithmetic(ISD::AND, VT, N0C, N1C);
2463 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, N1, N0);
2470 return DAG.getConstant(0, VT);
2532 EVT VT = Vector->getValueType(0);
2533 unsigned BitWidth = VT.getVectorElementType().getSizeInBits();
2610 return DAG.getSetCC(N->getDebugLoc(), VT, ORNode, LR, Op1);
2617 return DAG.getSetCC(N->getDebugLoc(), VT, ANDNode, LR, Op1);
2624 return DAG.getSetCC(N->getDebugLoc(), VT, ORNode, LR, Op1);
2653 if (!VT.isVector() &&
2668 SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N0.getDebugLoc(), VT,
2690 SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N0.getDebugLoc(), VT,
2721 EVT LoadResultTy = HasAnyExt ? LN0->getValueType(0) : VT;
2758 EVT LoadResultTy = HasAnyExt ? LN0->getValueType(0) : VT;
2774 VT.getSizeInBits() <= 64) {
2783 APInt Mask = APInt::getHighBitsSet(VT.getSizeInBits(),
2789 DAG.getNode(ISD::ADD, N0.getDebugLoc(), VT,
2790 N0.getOperand(0), DAG.getConstant(ADDC, VT));
2810 EVT VT = N->getValueType(0);
2811 if (VT != MVT::i64 && VT != MVT::i32 && VT != MVT::i16)
2813 if (!TLI.isOperationLegal(ISD::BSWAP, VT))
2886 unsigned OpSizeInBits = VT.getSizeInBits();
2892 SDValue Res = DAG.getNode(ISD::BSWAP, N->getDebugLoc(), VT, N00);
2894 Res = DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, Res,
2895 DAG.getConstant(OpSizeInBits-16, getShiftAmountTy(VT)));
2976 EVT VT = N->getValueType(0);
2977 if (VT != MVT::i32)
2979 if (!TLI.isOperationLegal(ISD::BSWAP, VT))
3027 SDValue BSwap = DAG.getNode(ISD::BSWAP, N->getDebugLoc(), VT,
3032 SDValue ShAmt = DAG.getConstant(16, getShiftAmountTy(VT));
3033 if (TLI.isOperationLegalOrCustom(ISD::ROTL, VT))
3034 return DAG.getNode(ISD::ROTL, N->getDebugLoc(), VT, BSwap, ShAmt);
3035 if (TLI.isOperationLegalOrCustom(ISD::ROTR, VT))
3036 return DAG.getNode(ISD::ROTR, N->getDebugLoc(), VT, BSwap, ShAmt);
3037 return DAG.getNode(ISD::OR, N->getDebugLoc(), VT,
3038 DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, BSwap, ShAmt),
3039 DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, BSwap, ShAmt));
3048 EVT VT = N1.getValueType();
3051 if (VT.isVector()) {
3071 EVT EltVT = VT.isVector() ? VT.getVectorElementType() : VT;
3072 return DAG.getConstant(APInt::getAllOnesValue(EltVT.getSizeInBits()), VT);
3076 return DAG.FoldConstantArithmetic(ISD::OR, VT, N0C, N1C);
3079 return DAG.getNode(ISD::OR, N->getDebugLoc(), VT, N1, N0);
3108 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
3109 DAG.getNode(ISD::OR, N0.getDebugLoc(), VT,
3111 DAG.FoldConstantArithmetic(ISD::OR, VT, N1C, C1));
3127 return DAG.getSetCC(N->getDebugLoc(), VT, ORNode, LR, Op1);
3136 return DAG.getSetCC(N->getDebugLoc(), VT, ANDNode, LR, Op1);
3179 SDValue X = DAG.getNode(ISD::OR, N0.getDebugLoc(), VT,
3181 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, X,
3182 DAG.getConstant(LHSMask | RHSMask, VT));
3191 if (!VT.isVector() &&
3222 EVT VT = LHS.getValueType();
3223 if (!TLI.isTypeLegal(VT)) return 0;
3226 bool HasROTL = TLI.isOperationLegalOrCustom(ISD::ROTL, VT);
3227 bool HasROTR = TLI.isOperationLegalOrCustom(ISD::ROTR, VT);
3254 unsigned OpSizeInBits = VT.getSizeInBits();
3268 SDValue Rot = DAG.getNode(HasROTL ? ISD::ROTL : ISD::ROTR, DL, VT,
3284 Rot = DAG.getNode(ISD::AND, DL, VT, Rot, DAG.getConstant(Mask, VT));
3302 return DAG.getNode(HasROTL ? ISD::ROTL : ISD::ROTR, DL, VT, LHSShiftArg,
3315 return DAG.getNode(HasROTR ? ISD::ROTR : ISD::ROTL, DL, VT, LHSShiftArg,
3341 return DAG.getNode(HasROTL ? ISD::ROTL : ISD::ROTR, DL, VT,
3355 return DAG.getNode(HasROTR ? ISD::ROTR : ISD::ROTL, DL, VT,
3372 EVT VT = N0.getValueType();
3375 if (VT
3388 return DAG.getConstant(0, VT);
3396 return DAG.FoldConstantArithmetic(ISD::XOR, VT, N0C, N1C);
3399 return DAG.getNode(ISD::XOR, N->getDebugLoc(), VT, N1, N0);
3420 return DAG.getSetCC(N->getDebugLoc(), VT, LHS, RHS, NotCC);
3436 return DAG.getNode(ISD::ZERO_EXTEND, N->getDebugLoc(), VT, V);
3440 if (N1C && N1C->getAPIntValue() == 1 && VT == MVT::i1 &&
3445 LHS = DAG.getNode(ISD::XOR, LHS.getDebugLoc(), VT, LHS, N1); // LHS = ~LHS
3446 RHS = DAG.getNode(ISD::XOR, RHS.getDebugLoc(), VT, RHS, N1); // RHS = ~RHS
3448 return DAG.getNode(NewOpcode, N->getDebugLoc(), VT, LHS, RHS);
3457 LHS = DAG.getNode(ISD::XOR, LHS.getDebugLoc(), VT, LHS, N1); // LHS = ~LHS
3458 RHS = DAG.getNode(ISD::XOR, RHS.getDebugLoc(), VT, RHS, N1); // RHS = ~RHS
3460 return DAG.getNode(NewOpcode, N->getDebugLoc(), VT, LHS, RHS);
3468 return DAG.getNode(ISD::XOR, N->getDebugLoc(), VT, N0.getOperand(1),
3470 N00C->getAPIntValue(), VT));
3472 return DAG.getNode(ISD::XOR, N->getDebugLoc(), VT, N0.getOperand(0),
3474 N01C->getAPIntValue(), VT));
3478 return tryFoldToZero(N->getDebugLoc(), TLI, VT, DAG, LegalOperations);
3487 if (!VT.isVector() &&
3538 EVT VT = N->getValueType(0);
3558 VT, LHS->getOperand(0), N->getOperand(1));
3561 return DAG.getNode(LHS->getOpcode(), N->getDebugLoc(), VT, NewShift, NewRHS);
3569 EVT VT = N0.getValueType();
3570 unsigned OpSizeInBits = VT.getScalarType().getSizeInBits();
3574 return DAG.FoldConstantArithmetic(ISD::SHL, VT, N0C, N1C);
3580 return DAG.getUNDEF(VT);
3586 return DAG.getConstant(0, VT);
3590 return DAG.getConstant(0, VT);
3601 return DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0,
3619 return DAG.getConstant(0, VT);
3620 return DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0.getOperand(0),
3641 return DAG.getConstant(0, VT);
3642 return DAG.getNode(ISD::SHL, N0->getDebugLoc(), VT,
3643 DAG.getNode(N0.getOpcode(), N0->getDebugLoc(), VT,
3656 if (c1 < VT.getSizeInBits()) {
3658 APInt Mask = APInt::getHighBitsSet(VT.getSizeInBits(),
3659 VT.getSizeInBits() - c1);
3663 Shift = DAG.getNode(ISD::SHL, N->getDebugLoc(), VT, N0.getOperand(0),
3667 Shift = DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0.getOperand(0),
3670 return DAG.getNode(ISD::AND, N0.getDebugLoc(), VT, Shift,
3671 DAG.getConstant(Mask, VT));
3677 DAG.getConstant(APInt::getHighBitsSet(VT.getSizeInBits(),
3678 VT.getSizeInBits() -
3680 VT);
3681 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, N0.getOperand(0),
3699 EVT VT = N0.getValueType();
3700 unsigned OpSizeInBits = VT.getScalarType().getSizeInBits();
3704 return DAG.FoldConstantArithmetic(ISD::SRA, VT, N0C, N1C);
3713 return DAG.getUNDEF(VT);
3722 if (VT.isVector())
3724 ExtVT, VT.getVectorNumElements());
3727 return DAG.getNode(ISD::SIGN_EXTEND_INREG, N->getDebugLoc(), VT,
3736 return DAG.getNode(ISD::SRA, N->getDebugLoc(), VT, N0.getOperand(0),
3763 TLI.isOperationLegalOrCustom(ISD::TRUNCATE, VT) &&
3764 TLI.isTruncateFree(VT, TruncVT)) {
3768 SDValue Shift = DAG.getNode(ISD::SRL, N0.getDebugLoc(), VT,
3788 return DAG.getNode(ISD::SRA, N->getDebugLoc(), VT, N0,
3817 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, SRA);
3828 return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0, N1);
3844 EVT VT = N0.getValueType();
3845 unsigned OpSizeInBits = VT.getScalarType().getSizeInBits();
3849 return DAG.FoldConstantArithmetic(ISD::SRL, VT, N0C, N1C);
3855 return DAG.getUNDEF(VT);
3862 return DAG.getConstant(0, VT);
3870 return DAG.getConstant(0, VT);
3871 return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0.getOperand(0),
3888 return DAG.getConstant(0, VT);
3889 return DAG.getNode(ISD::TRUNCATE, N0->getDebugLoc(), VT,
3900 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, N0.getOperand(0),
3901 DAG.getConstant(~0ULL >> ShAmt, VT));
3910 return DAG.getUNDEF(VT);
3918 return DAG.getNode(ISD::ANY_EXTEND, N->getDebugLoc(), VT, SmallShift);
3924 if (N1C && N1C->getZExtValue() + 1 == VT.getSizeInBits()) {
3926 return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0.getOperand(0), N1);
3931 N1C->getAPIntValue() == Log2_32(VT.getSizeInBits())) {
3937 if (KnownOne.getBoolValue()) return DAG.getConstant(0, VT);
3942 if (UnknownBits == 0) return DAG.getConstant(1, VT);
3954 Op = DAG.getNode(ISD::SRL, N0.getDebugLoc(), VT, Op,
3959 return DAG.getNode(ISD::XOR, N->getDebugLoc(), VT,
3960 Op, DAG.getConstant(1, VT));
3974 return DAG.getNode(ISD::SRL, N->getDebugLoc(), VT, N0,
4034 EVT VT = N->getValueType(0);
4038 return DAG.getNode(ISD::CTLZ, N->getDebugLoc(), VT, N0);
4044 EVT VT = N->getValueType(0);
4048 return DAG.getNode(ISD::CTLZ_ZERO_UNDEF, N->getDebugLoc(), VT, N0);
4054 EVT VT = N->getValueType(0);
4058 return DAG.getNode(ISD::CTTZ, N->getDebugLoc(), VT, N0);
4064 EVT VT = N->getValueType(0);
4068 return DAG.getNode(ISD::CTTZ_ZERO_UNDEF, N->getDebugLoc(), VT, N0);
4074 EVT VT = N->getValueType(0);
4078 return DAG.getNode(ISD::CTPOP, N->getDebugLoc(), VT, N0);
4089 EVT VT = N->getValueType(0);
4102 if (VT == MVT::i1 && N1C && N1C->getAPIntValue() == 1)
4103 return DAG.getNode(ISD::OR, N->getDebugLoc(), VT, N0, N2);
4105 if (VT.isInteger() &&
4112 if (VT == VT0)
4118 if (VT.bitsGT(VT0))
4119 return DAG.getNode(ISD::ZERO_EXTEND, N->getDebugLoc(), VT, XORNode);
4120 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, XORNode);
4123 if (VT == VT0 && VT == MVT::i1 && N1C && N1C->isNullValue()) {
4124 SDValue NOTNode = DAG.getNOT(N0.getDebugLoc(), N0, VT);
4126 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, NOTNode, N2);
4129 if (VT == VT0 && VT == MVT::i1 && N2C && N2C->getAPIntValue() == 1) {
4130 SDValue NOTNode = DAG.getNOT(N0.getDebugLoc(), N0, VT);
4132 return DAG.getNode(ISD::OR, N->getDebugLoc(), VT, NOTNode, N1);
4135 if (VT == MVT::i1 && N2C && N2C->isNullValue())
4136 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, N0, N1);
4139 if (VT == MVT::i1 && (N0 == N1 || (N1C && N1C->getAPIntValue() == 1)))
4140 return DAG.getNode(ISD::OR, N->getDebugLoc(), VT, N0, N2);
4143 if (VT == MVT::i1 && (N0 == N2 || (N2C && N2C->getAPIntValue() == 0)))
4144 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT, N0, N1);
4157 TLI.isOperationLegalOrCustom(ISD::SELECT_CC, VT))
4158 return DAG.getNode(ISD::SELECT_CC, N->getDebugLoc(), VT,
4299 EVT VT = N->getValueType(0);
4303 return DAG.getNode(ISD::SIGN_EXTEND, N->getDebugLoc(), VT, N0);
4308 return DAG.getNode(ISD::SIGN_EXTEND, N->getDebugLoc(), VT,
4330 unsigned DestBits = VT.getScalarType().getSizeInBits();
4342 return DAG.getNode(ISD::SIGN_EXTEND, N->getDebugLoc(), VT, Op);
4347 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, Op);
4354 Op = DAG.getNode(ISD::ANY_EXTEND, N0.getDebugLoc(), VT, Op);
4356 Op = DAG.getNode(ISD::TRUNCATE, N0.getDebugLoc(), VT, Op);
4357 return DAG.getNode(ISD::SIGN_EXTEND_INREG, N->getDebugLoc(), VT, Op,
4366 if (ISD::isNON_EXTLoad(N0.getNode()) && !VT.isVector() &&
4375 SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, N->getDebugLoc(), VT,
4399 SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, N->getDebugLoc(), VT,
4421 (!LegalOperations && TLI.isOperationLegal(N0.getOpcode(), VT))) {
4430 SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, LN0->getDebugLoc(), VT,
4438 Mask = Mask.sext(VT.getSizeInBits());
4439 SDValue And = DAG.getNode(N0.getOpcode(), N->getDebugLoc(), VT,
4440 ExtLoad, DAG.getConstant(Mask, VT));
4456 if (VT.isVector() && !LegalOperations) {
4468 if (VT.getSizeInBits() == SVT.getSizeInBits())
4469 return DAG.getSetCC(N->getDebugLoc(), VT, N0.getOperand(0),
4486 return DAG.getSExtOrTrunc(VsetCC, N->getDebugLoc(), VT);
4491 unsigned ElementWidth = VT.getScalarType().getSizeInBits();
4493 DAG.getConstant(APInt::getAllOnesValue(ElementWidth), VT);
4496 NegOne, DAG.getConstant(0, VT),
4499 if (!VT.isVector() && (!LegalOperations ||
4500 TLI.isOperationLegal(ISD::SETCC, TLI.getSetCCResultType(VT))))
4501 return DAG.getNode(ISD::SELECT, N->getDebugLoc(), VT,
4503 TLI.getSetCCResultType(VT),
4506 NegOne, DAG.getConstant(0, VT));
4510 if ((!LegalOperations || TLI.isOperationLegal(ISD::ZERO_EXTEND, VT)) &&
4512 return DAG.getNode(ISD::ZERO_EXTEND, N->getDebugLoc(), VT, N0);
4557 EVT VT = N->getValueType(0);
4561 return DAG.getNode(ISD::ZERO_EXTEND, N->getDebugLoc(), VT, N0);
4565 VT,
4574 if (!VT.isVector() && isTruncateOf(DAG, N0, Op, KnownZero)) {
4581 VT.getSizeInBits()));
4583 if (VT.bitsGT(Op.getValueType()))
4584 return DAG.getNode(ISD::ZERO_EXTEND, N->getDebugLoc(), VT, Op);
4585 if (VT.bitsLT(Op.getValueType()))
4586 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, Op);
4609 (!LegalOperations || TLI.isOperationLegal(ISD::AND, VT))) {
4625 if (Op.getValueType().bitsLT(VT)) {
4626 Op = DAG.getNode(ISD::ANY_EXTEND, N->getDebugLoc(), VT, Op);
4628 } else if (Op.getValueType().bitsGT(VT)) {
4629 Op = DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, Op);
4643 !TLI.isZExtFree(N0.getValueType(), VT))) {
4645 if (X.getValueType().bitsLT(VT)) {
4646 X = DAG.getNode(ISD::ANY_EXTEND, X.getDebugLoc(), VT, X);
4647 } else if (X.getValueType().bitsGT(VT)) {
4648 X = DAG.getNode(ISD::TRUNCATE, X.getDebugLoc(), VT, X);
4651 Mask = Mask.zext(VT.getSizeInBits());
4652 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
4653 X, DAG.getConstant(Mask, VT));
4660 if (ISD::isNON_EXTLoad(N0.getNode()) && !VT.isVector() &&
4669 SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N->getDebugLoc(), VT,
4693 (!LegalOperations && TLI.isOperationLegal(N0.getOpcode(), VT))) {
4702 SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, LN0->getDebugLoc(), VT,
4710 Mask = Mask.zext(VT.getSizeInBits());
4711 SDValue And = DAG.getNode(N0.getOpcode(), N->getDebugLoc(), VT,
4712 ExtLoad, DAG.getConstant(Mask, VT));
4733 SDValue ExtLoad = DAG.getExtLoad(ISD::ZEXTLOAD, N->getDebugLoc(), VT,
4749 if (!LegalOperations && VT.isVector()) {
4753 EVT EltVT = VT.getVectorElementType();
4754 SmallVector<SDValue,8> OneOps(VT.getVectorNumElements(),
4756 if (VT.getSizeInBits() == N0VT.getSizeInBits())
4762 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
4763 DAG.getSetCC(N->getDebugLoc(), VT, N0.getOperand(0),
4766 DAG.getNode(ISD::BUILD_VECTOR, N->getDebugLoc(), VT,
4782 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
4783 DAG.getSExtOrTrunc(VsetCC, N->getDebugLoc(), VT),
4784 DAG.getNode(ISD::BUILD_VECTOR, N->getDebugLoc(), VT,
4791 DAG.getConstant(1, VT), DAG.getConstant(0, VT),
4816 if (VT.getSizeInBits() >= 256)
4819 return DAG.getNode(N0.getOpcode(), DL, VT,
4820 DAG.getNode(ISD::ZERO_EXTEND, DL, VT, N0.getOperand(0)),
4829 EVT VT = N->getValueType(0);
4833 return DAG.getNode(ISD::ANY_EXTEND, N->getDebugLoc(), VT, N0);
4840 return DAG.getNode(N0.getOpcode(), N->getDebugLoc(), VT, N0.getOperand(0));
4860 if (TruncOp.getValueType() == VT)
4862 if (TruncOp.getValueType().bitsGT(VT))
4863 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, TruncOp);
4864 return DAG.getNode(ISD::ANY_EXTEND, N->getDebugLoc(), VT, TruncOp);
4875 if (X.getValueType().bitsLT(VT)) {
4876 X = DAG.getNode(ISD::ANY_EXTEND, N->getDebugLoc(), VT, X);
4877 } else if (X.getValueType().bitsGT(VT)) {
4878 X = DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, X);
4881 Mask = Mask.zext(VT.getSizeInBits());
4882 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
4883 X, DAG.getConstant(Mask, VT));
4890 if (ISD::isNON_EXTLoad(N0.getNode()) && !VT.isVector() &&
4899 SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, N->getDebugLoc(), VT,
4924 VT, LN0->getChain(), LN0->getBasePtr(),
4939 if (VT.isVector() && !LegalOperations) {
4946 if (VT.getSizeInBits() == N0VT.getSizeInBits())
4947 return DAG.getSetCC(N->getDebugLoc(), VT, N0.getOperand(0),
4964 return DAG.getSExtOrTrunc(VsetCC, N->getDebugLoc(), VT);
4971 DAG.getConstant(1, VT), DAG.getConstant(0, VT),
5034 EVT VT = N->getValueType(0);
5035 EVT ExtVT = VT;
5038 if (VT.isVector())
5042 // extended to VT.
5053 VT.getSizeInBits() - N01->getZExtValue());
5069 // Is the shift amount a multiple of size of VT?
5072 // Is the load width a multiple of size of VT?
5098 ExtVT == VT && TLI.isNarrowingProfitable(N0.getValueType(), VT)) {
5150 Load = DAG.getLoad(VT, N0.getDebugLoc(), LN0->getChain(), NewPtr,
5155 Load = DAG.getExtLoad(ExtType, N0.getDebugLoc(), VT, LN0->getChain(),NewPtr,
5169 ShImmTy = VT;
5174 if (ShLeftAmt >= VT.getSizeInBits())
5175 Result = DAG.getConstant(0, VT);
5177 Result = DAG.getNode(ISD::SHL, N0.getDebugLoc(), VT,
5188 EVT VT = N->getValueType(0);
5190 unsigned VTBits = VT.getScalarType().getSizeInBits();
5195 return DAG.getNode(ISD::SIGN_EXTEND_INREG, N->getDebugLoc(), VT, N0, N1);
5204 return DAG.getNode(ISD::SIGN_EXTEND_INREG, N->getDebugLoc(), VT,
5214 (!LegalOperations || TLI.isOperationLegal(ISD::SIGN_EXTEND, VT)))
5215 return DAG.getNode(ISD::SIGN_EXTEND, N->getDebugLoc(), VT, N00, N1);
5243 return DAG.getNode(ISD::SRA, N->getDebugLoc(), VT,
5255 SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, N->getDebugLoc(), VT,
5273 SDValue ExtLoad = DAG.getExtLoad(ISD::SEXTLOAD, N->getDebugLoc(), VT,
5289 return DAG.getNode(ISD::SIGN_EXTEND_INREG, N->getDebugLoc(), VT,
5298 EVT VT = N->getValueType(0);
5306 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, N0);
5309 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, N0.getOperand(0));
5314 if (N0.getOperand(0).getValueType().bitsLT(VT))
5316 return DAG.getNode(N0.getOpcode(), N->getDebugLoc(), VT,
5318 if (N0.getOperand(0).getValueType().bitsGT(VT))
5320 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, N0.getOperand(0));
5368 if (Level == AfterLegalizeVectorOps && VT.isVector() &&
5375 EVT TruncVecEltTy = VT.getVectorElementType();
5381 unsigned TruncVecNumElts = VT.getVectorNumElements();
5391 return DAG.getNode(ISD::BUILD_VECTOR, N->getDebugLoc(), VT, &Opnds[0],
5401 if (!VT.isVector()) {
5404 VT.getSizeInBits()));
5406 return DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, Shorter);
5410 if (!LegalTypes || TLI.isTypeDesirableForOp(N0.getOpcode(), VT)) {
5434 VT.getVectorElementType(),
5439 return DAG.getUNDEF(VT);
5453 return DAG.getNode(ISD::CONCAT_VECTORS, N->getDebugLoc(), VT,
5459 if (!VT.isVector() &&
5475 SDValue DAGCombiner::CombineConsecutiveLoads(SDNode *N, EVT VT) {
5495 getABITypeAlignment(VT.getTypeForEVT(*DAG.getContext()));
5498 (!LegalOperations || TLI.isOperationLegal(ISD::LOAD, VT)))
5499 return DAG.getLoad(VT, N->getDebugLoc(), LD1->getChain(),
5509 EVT VT = N->getValueType(0);
5517 VT.isVector()) {
5536 SDValue Res = DAG.getNode(ISD::BITCAST, N->getDebugLoc(), VT, N0);
5539 TLI.isOperationLegal(Res.getNode()->getOpcode(), VT))
5553 return DAG.getNode(ISD::BITCAST, N->getDebugLoc(), VT,
5561 (!LegalOperations || TLI.isOperationLegal(ISD::LOAD, VT))) {
5564 getABITypeAlignment(VT.getTypeForEVT(*DAG.getContext()));
5568 SDValue Load = DAG.getLoad(VT, N->getDebugLoc(), LN0->getChain(),
5584 if (((N0.getOpcode() == ISD::FNEG && !TLI.isFNegFree(VT)) ||
5585 (N0.getOpcode() == ISD::FABS && !TLI.isFAbsFree(VT))) &&
5586 N0.getNode()->hasOneUse() && VT.isInteger() &&
5587 !VT.isVector() && !N0.getValueType().isVector()) {
5588 SDValue NewConv = DAG.getNode(ISD::BITCAST, N0.getDebugLoc(), VT,
5592 APInt SignBit = APInt::getSignBit(VT.getSizeInBits());
5594 return DAG.getNode(ISD::XOR, N->getDebugLoc(), VT,
5595 NewConv, DAG.getConstant(SignBit, VT));
5597 return DAG.getNode(ISD::AND, N->getDebugLoc(), VT,
5598 NewConv, DAG.getConstant(~SignBit, VT));
5607 VT.isInteger() && !VT.isVector()) {
5616 unsigned VTWidth = VT.getSizeInBits();
5618 X = DAG.getNode(ISD::SIGN_EXTEND, N->getDebugLoc(), VT, X);
5627 X = DAG.getNode(ISD::TRUNCATE, X.getDebugLoc(), VT, X);
5631 APInt SignBit = APInt::getSignBit(VT.getSizeInBits());
5632 X = DAG.getNode(ISD::AND, X.getDebugLoc(), VT,
5633 X, DAG.getConstant(SignBit, VT));
5637 VT, N0.getOperand(0));
5638 Cst = DAG.getNode(ISD::AND, Cst.getDebugLoc(), VT,
5639 Cst, DAG.getConstant(~SignBit, VT));
5642 return DAG.getNode(ISD::OR, N->getDebugLoc(), VT, X, Cst);
5648 SDValue CombineLD = CombineConsecutiveLoads(N0.getNode(), VT);
5657 EVT VT = N->getValueType(0);
5658 return CombineConsecutiveLoads(N, VT);
5677 EVT VT = EVT::getVectorVT(*DAG.getContext(), DstEltVT,
5683 return DAG.getNode(ISD::SCALAR_TO_VECTOR, BV->getDebugLoc(), VT,
5698 return DAG.getNode(ISD::BUILD_VECTOR, BV->getDebugLoc(), VT,
5708 assert((SrcEltVT == MVT::f32 || SrcEltVT == MVT::f64) && "Unknown FP VT!");
5717 assert((DstEltVT == MVT::f32 || DstEltVT == MVT::f64) && "Unknown FP VT!");
5754 EVT VT = EVT::getVectorVT(*DAG.getContext(), DstEltVT, Ops.size());
5755 return DAG.getNode(ISD::BUILD_VECTOR, BV->getDebugLoc(), VT,
5763 EVT VT = EVT::getVectorVT(*DAG.getContext(), DstEltVT,
5782 return DAG.getNode(ISD::SCALAR_TO_VECTOR, BV->getDebugLoc(), VT,
5792 return DAG.getNode(ISD::BUILD_VECTOR, BV->getDebugLoc(), VT,
5801 EVT VT = N->getValueType(0);
5804 if (VT.isVector()) {
5811 return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N0, N1);
5814 return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N1, N0);
5820 if ((!LegalOperations || TLI.isOperationLegalOrCustom(ISD::FSUB, VT)) &&
5822 return DAG.getNode(ISD::FSUB, N->getDebugLoc(), VT, N0,
5825 if ((!LegalOperations || TLI.isOperationLegalOrCustom(ISD::FSUB, VT)) &&
5827 return DAG.getNode(ISD::FSUB, N->getDebugLoc(), VT, N1,
5834 return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N0.getOperand(0),
5835 DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5841 return DAG.getConstantFP(0.0, VT);
5847 return DAG.getConstantFP(0.0, VT);
5854 TLI.isOperationLegalOrCustom(ISD::FMUL, VT) &&
5862 SDValue NewCFP = DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5864 DAG.getConstantFP(1.0, VT));
5865 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5871 SDValue NewCFP = DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5873 DAG.getConstantFP(1.0, VT));
5874 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5882 SDValue NewCFP = DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5884 DAG.getConstantFP(2.0, VT));
5885 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5893 SDValue NewCFP = DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5895 DAG.getConstantFP(2.0, VT));
5896 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5907 SDValue NewCFP = DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5909 DAG.getConstantFP(1.0, VT));
5910 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5916 SDValue NewCFP = DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5918 DAG.getConstantFP(1.0, VT));
5919 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5928 SDValue NewCFP = DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5930 DAG.getConstantFP(2.0, VT));
5931 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5939 SDValue NewCFP = DAG.getNode(ISD::FADD, N->getDebugLoc(), VT,
5941 DAG.getConstantFP(2.0, VT));
5942 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5952 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5953 N1, DAG.getConstantFP(3.0, VT));
5962 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5963 N0, DAG.getConstantFP(3.0, VT));
5972 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
5974 DAG.getConstantFP(4.0, VT));
5981 DAG.getTarget().getTargetLowering()->isFMAFasterThanMulAndAdd(VT) &&
5982 TLI.isOperationLegalOrCustom(ISD::FMA, VT)) {
5986 return DAG.getNode(ISD::FMA, N->getDebugLoc(), VT,
5993 return DAG.getNode(ISD::FMA, N->getDebugLoc(), VT,
6006 EVT VT = N->getValueType(0);
6010 if (VT.isVector()) {
6017 return DAG.getNode(ISD::FSUB, N->getDebugLoc(), VT, N0, N1);
6027 if (!LegalOperations || TLI.isOperationLegal(ISD::FNEG, VT))
6028 return DAG.getNode(ISD::FNEG, dl, VT, N1);
6032 return DAG.getNode(ISD::FADD, dl, VT, N0,
6041 return DAG.getConstantFP(0.0f, VT);
6059 DAG.getTarget().getTargetLowering()->isFMAFasterThanMulAndAdd(VT) &&
6060 TLI.isOperationLegalOrCustom(ISD::FMA, VT)) {
6064 return DAG.getNode(ISD::FMA, dl, VT,
6066 DAG.getNode(ISD::FNEG, dl, VT, N1));
6072 return DAG.getNode(ISD::FMA, dl, VT,
6073 DAG.getNode(ISD::FNEG, dl, VT,
6084 return DAG.getNode(ISD::FMA, dl, VT,
6085 DAG.getNode(ISD::FNEG, dl, VT, N00), N01,
6086 DAG.getNode(ISD::FNEG, dl, VT, N1));
6098 EVT VT = N->getValueType(0);
6102 if (VT.isVector()) {
6109 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT, N0, N1);
6112 VT, N1, N0);
6126 return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N0, N0);
6129 if (!LegalOperations || TLI.isOperationLegal(ISD::FNEG, VT))
6130 return DAG.getNode(ISD::FNEG, N->getDebugLoc(), VT, N0);
6140 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
6150 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT, N0.getOperand(0),
6151 DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
6163 EVT VT = N->getValueType(0);
6173 return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N1, N2);
6175 return DAG.getNode(ISD::FADD, N->getDebugLoc(), VT, N0, N2);
6179 return DAG.getNode(ISD::FMA, N->getDebugLoc(), VT, N1, N0, N2);
6186 return DAG.getNode(ISD::FMUL, dl, VT, N0,
6187 DAG.getNode(ISD::FADD, dl, VT, N1, N2.getOperand(1)));
6195 return DAG.getNode(ISD::FMA, dl, VT,
6197 DAG.getNode(ISD::FMUL, dl, VT, N1, N0.getOperand(1)),
6205 return DAG.getNode(ISD::FADD, dl, VT, N0, N2);
6208 (!LegalOperations || TLI.isOperationLegal(ISD::FNEG, VT))) {
6209 SDValue RHSNeg = DAG.getNode(ISD::FNEG, dl, VT, N0);
6211 return DAG.getNode(ISD::FADD, dl, VT, N2, RHSNeg);
6217 return DAG.getNode(ISD::FMUL, dl, VT,
6219 DAG.getNode(ISD::FADD, dl, VT,
6220 N1, DAG.getConstantFP(1.0, VT)));
6226 return DAG.getNode(ISD::FMUL, dl, VT,
6228 DAG.getNode(ISD::FADD, dl, VT,
6229 N1, DAG.getConstantFP(-1.0, VT)));
6241 EVT VT = N->getValueType(0);
6245 if (VT.isVector()) {
6252 return DAG.getNode(ISD::FDIV, N->getDebugLoc(), VT, N0, N1);
6266 // TLI.isOperationLegalOrCustom(llvm::ISD::ConstantFP, VT) ||
6267 TLI.isOperationLegal(llvm::ISD::ConstantFP, VT) ||
6268 TLI.isFPImmLegal(Recip, VT)))
6269 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT, N0,
6270 DAG.getConstantFP(Recip, VT));
6281 return DAG.getNode(ISD::FDIV, N->getDebugLoc(), VT,
6295 EVT VT = N->getValueType(0);
6299 return DAG.getNode(ISD::FREM, N->getDebugLoc(), VT, N0, N1);
6309 EVT VT = N->getValueType(0);
6312 return DAG.getNode(ISD::FCOPYSIGN, N->getDebugLoc(), VT, N0, N1);
6319 if (!LegalOperations || TLI.isOperationLegal(ISD::FABS, VT))
6320 return DAG.getNode(ISD::FABS, N->getDebugLoc(), VT, N0);
6322 if (!LegalOperations || TLI.isOperationLegal(ISD::FNEG, VT))
6323 return DAG.getNode(ISD::FNEG, N->getDebugLoc(), VT,
6324 DAG.getNode(ISD::FABS, N0.getDebugLoc(), VT, N0));
6333 return DAG.getNode(ISD::FCOPYSIGN, N->getDebugLoc(), VT,
6338 return DAG.getNode(ISD::FABS, N->getDebugLoc(), VT, N0);
6342 return DAG.getNode(ISD::FCOPYSIGN, N->getDebugLoc(), VT,
6348 return DAG.getNode(ISD::FCOPYSIGN, N->getDebugLoc(), VT,
6357 EVT VT = N->getValueType(0);
6364 TLI.isOperationLegalOrCustom(llvm::ISD::ConstantFP, VT)))
6365 return DAG.getNode(ISD::SINT_TO_FP, N->getDebugLoc(), VT, N0);
6373 return DAG.getNode(ISD::UINT_TO_FP, N->getDebugLoc(), VT, N0);
6384 !VT.isVector() &&
6386 TLI.isOperationLegalOrCustom(llvm::ISD::ConstantFP, VT))) {
6389 DAG.getConstantFP(-1.0, VT) , DAG.getConstantFP(0.0, VT),
6391 return DAG.getNode(ISD::SELECT_CC, N->getDebugLoc(), VT, Ops, 5);
6397 N0.getOperand(0).getOpcode() == ISD::SETCC &&!VT.isVector() &&
6399 TLI.isOperationLegalOrCustom(llvm::ISD::ConstantFP, VT))) {
6402 DAG.getConstantFP(1.0, VT) , DAG.getConstantFP(0.0, VT),
6404 return DAG.getNode(ISD::SELECT_CC, N->getDebugLoc(), VT, Ops, 5);
6414 EVT VT = N->getValueType(0);
6421 TLI.isOperationLegalOrCustom(llvm::ISD::ConstantFP, VT)))
6422 return DAG.getNode(ISD::UINT_TO_FP, N->getDebugLoc(), VT, N0);
6430 return DAG.getNode(ISD::SINT_TO_FP, N->getDebugLoc(), VT, N0);
6441 if (N0.getOpcode() == ISD::SETCC && !VT.isVector() &&
6443 TLI.isOperationLegalOrCustom(llvm::ISD::ConstantFP, VT))) {
6446 DAG.getConstantFP(1.0, VT), DAG.getConstantFP(0.0, VT),
6448 return DAG.getNode(ISD::SELECT_CC, N->getDebugLoc(), VT, Ops, 5);
6458 EVT VT = N->getValueType(0);
6462 return DAG.getNode(ISD::FP_TO_SINT, N->getDebugLoc(), VT, N0);
6470 EVT VT = N->getValueType(0);
6474 return DAG.getNode(ISD::FP_TO_UINT, N->getDebugLoc(), VT, N0);
6483 EVT VT = N->getValueType(0);
6487 return DAG.getNode(ISD::FP_ROUND, N->getDebugLoc(), VT, N0, N1);
6490 if (N0.getOpcode() == ISD::FP_EXTEND && VT == N0.getOperand(0).getValueType())
6498 return DAG.getNode(ISD::FP_ROUND, N->getDebugLoc(), VT, N0.getOperand(0),
6504 SDValue Tmp = DAG.getNode(ISD::FP_ROUND, N0.getDebugLoc(), VT,
6507 return DAG.getNode(ISD::FCOPYSIGN, N->getDebugLoc(), VT,
6516 EVT VT = N->getValueType(0);
6523 return DAG.getNode(ISD::FP_EXTEND, N->getDebugLoc(), VT, Round);
6532 EVT VT = N->getValueType(0);
6541 return DAG.getNode(ISD::FP_EXTEND, N->getDebugLoc(), VT, N0);
6548 if (In.getValueType() == VT) return In;
6549 if (VT.bitsLT(In.getValueType()))
6550 return DAG.getNode(ISD::FP_ROUND, N->getDebugLoc(), VT,
6552 return DAG.getNode(ISD::FP_EXTEND, N->getDebugLoc(), VT, In);
6560 SDValue ExtLoad = DAG.getExtLoad(ISD::EXTLOAD, N->getDebugLoc(), VT,
6579 EVT VT = N->getValueType(0);
6581 if (VT.isVector()) {
6592 if (!TLI.isFNegFree(VT) && N0.getOpcode() == ISD::BITCAST &&
6593 !VT.isVector() &&
6603 VT, Int);
6611 return DAG.getNode(ISD::FMUL, N->getDebugLoc(), VT,
6613 DAG.getNode(ISD::FNEG, N->getDebugLoc(), VT,
6624 EVT VT = N->getValueType(0);
6628 return DAG.getNode(ISD::FCEIL, N->getDebugLoc(), VT, N0);
6636 EVT VT = N->getValueType(0);
6640 return DAG.getNode(ISD::FTRUNC, N->getDebugLoc(), VT, N0);
6648 EVT VT = N->getValueType(0);
6652 return DAG.getNode(ISD::FFLOOR, N->getDebugLoc(), VT, N0);
6660 EVT VT = N->getValueType(0);
6662 if (VT.isVector()) {
6669 return DAG.getNode(ISD::FABS, N->getDebugLoc(), VT, N0);
6676 return DAG.getNode(ISD::FABS, N->getDebugLoc(), VT, N0.getOperand(0));
6680 if (!TLI.isFAbsFree(VT) &&
6883 EVT VT;
6887 VT = Use->getValueType(0);
6891 VT = ST->getValue().getValueType();
6915 return TLI.isLegalAddressingMode(AM, VT.getTypeForEVT(*DAG.getContext()));
6930 EVT VT;
6934 VT = LD->getMemoryVT();
6935 if (!TLI.isIndexedLoadLegal(ISD::PRE_INC, VT) &&
6936 !TLI.isIndexedLoadLegal(ISD::PRE_DEC, VT))
6942 VT = ST->getMemoryVT();
6943 if (!TLI.isIndexedStoreLegal(ISD::PRE_INC, VT) &&
6944 !TLI.isIndexedStoreLegal(ISD::PRE_DEC, VT))
7146 EVT VT;
7150 VT = LD->getMemoryVT();
7151 if (!TLI.isIndexedLoadLegal(ISD::POST_INC, VT) &&
7152 !TLI.isIndexedLoadLegal(ISD::POST_DEC, VT))
7158 VT = ST->getMemoryVT();
7159 if (!TLI.isIndexedStoreLegal(ISD::POST_INC, VT) &&
7160 !TLI.isIndexedStoreLegal(ISD::POST_DEC, VT))
7484 // VT we're shrinking to (i8/i16/i32) is legal or we're still before type
7486 MVT VT = MVT::getIntegerVT(NumBytes*8);
7487 if (!DC->isTypeLegal(VT))
7514 IVal = DAG.getNode(ISD::TRUNCATE, IVal->getDebugLoc(), VT, IVal);
7535 EVT VT = Value.getValueType();
7537 if (ST->isTruncatingStore() || VT.isVector() || !Value.hasOneUse())
7590 TLI.isNarrowingProfitable(VT, NewVT))) {
7658 EVT VT = LD->getMemoryVT();
7659 if (!VT.isFloatingPoint() ||
7660 VT != ST->getMemoryVT() ||
7667 EVT IntVT = EVT::getIntegerVT(*DAG.getContext(), VT.getSizeInBits());
7670 !TLI.isDesirableToTransformToIntegerOp(ISD::LOAD, VT) ||
7671 !TLI.isDesirableToTransformToIntegerOp(ISD::STORE, VT))
8405 EVT VT = InVec.getValueType();
8408 if (LegalOperations && !TLI.isOperationLegal(ISD::BUILD_VECTOR, VT))
8424 unsigned NElts = VT.getVectorNumElements();
8444 VT, &Ops[0], Ops.size());
8450 EVT VT = InVec.getValueType();
8476 int NumElem = VT.getVectorNumElements();
8510 EVT ExtVT = VT.getVectorElementType();
8526 if (VT.getVectorNumElements() != BCVT.getVectorNumElements())
8560 unsigned NumElems = VT.getVectorNumElements();
8607 PtrOff = VT.getSizeInBits() / 8 - PtrOff;
8669 EVT VT = N->getValueType(0);
8713 EVT OutScalarTy = VT.getScalarType();
8729 unsigned NewBVElems = ElemRatio * VT.getVectorNumElements();
8752 assert(VecVT.getSizeInBits() == VT.getSizeInBits() &&
8763 return DAG.getNode(ISD::BITCAST, dl, VT, BV);
8767 EVT VT = N->getValueType(0);
8830 return DAG.getNode(Opcode, dl, VT, BV);
8836 EVT VT = N->getValueType(0);
8840 return DAG.getUNDEF(VT);
8856 !TLI.isOperationLegalOrCustom(ISD::VECTOR_SHUFFLE, VT))
8902 if (ExtIndex > VT.getVectorNumElements())
8916 if ((VT != VecIn1.getValueType())) {
8923 if (VecIn1.getValueType().getSizeInBits()*2 != VT.getSizeInBits())
8929 VT.getVectorElementType())
8933 VecIn1 = DAG.getNode(ISD::CONCAT_VECTORS, dl, VT,
8938 VecIn2 = VecIn2.getNode() ? VecIn2 : DAG.getUNDEF(VT);
8943 VecIn1.getValueType() != VT)
8947 if (!isTypeLegal(VT))
8954 return DAG.getVectorShuffle(VT, dl, Ops[0], Ops[1], &Mask[0]);
9027 EVT VT = N->getValueType(0);
9028 unsigned NumElts = VT.getVectorNumElements();
9033 assert(N0.getValueType() == VT && "Vector shuffle must be normalized in DAG");
9037 return DAG.getUNDEF(VT);
9049 return DAG.getVectorShuffle(VT, N->getDebugLoc(), N0, DAG.getUNDEF(VT),
9066 return DAG.getVectorShuffle(VT, N->getDebugLoc(), N1, DAG.getUNDEF(VT),
9083 return DAG.getVectorShuffle(VT, N->getDebugLoc(), N0, N1, &NewMask[0]);
9141 assert(OtherSV->getOperand(0).getValueType() == VT &&
9221 EVT VT = N->getValueType(0);
9257 return DAG.getNode(ISD::BITCAST, dl, VT, Shuf);
9301 EVT VT = LHSOp.getValueType();
9303 if (RVT != VT) {
9308 if (RVT.getSizeInBits() > VT.getSizeInBits()) {
9309 RHSOp = DAG.getNode(ISD::TRUNCATE, N->getDebugLoc(), VT, RHSOp);
9312 VT = RVT;
9315 SDValue FoldOp = DAG.getNode(N->getOpcode(), LHS.getDebugLoc(), VT,
9424 // If this is an EXTLOAD, the VT's must match.
9517 EVT VT = N2.getValueType();
9543 return DAG.getNode(ISD::FABS, DL, VT, N0);
9549 return DAG.getNode(ISD::FABS, DL, VT, N3);
9654 N0->getValueType(0) == VT &&
9665 SDValue Shl = DAG.getNode(ISD::SHL, N0.getDebugLoc(), VT, AndLHS, ShlAmt);
9672 SDValue Shr = DAG.getNode(ISD::SRA, N0.getDebugLoc(), VT, Shl, ShrAmt);
9674 return DAG.getNode(ISD::AND, DL, VT, Shr, N3);
9731 if (Res.getValueType() != VT)
9732 Res = DAG.getNode(ISD::ZERO_EXTEND, DL, VT, Res);
9799 SDValue DAGCombiner::SimplifySetCC(EVT VT, SDValue N0,
9804 return TLI.SimplifySetCC(VT, N0, N1, Cond, foldBooleans, DagCombineInfo, DL);