Lines Matching refs:TLO
516 TargetLoweringOpt &TLO) const { in ShrinkDemandedConstant()
526 if (targetShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO)) in ShrinkDemandedConstant()
527 return TLO.New.getNode(); in ShrinkDemandedConstant()
547 SDValue NewC = TLO.DAG.getConstant(DemandedBits & C, DL, VT); in ShrinkDemandedConstant()
548 SDValue NewOp = TLO.DAG.getNode(Opcode, DL, VT, Op.getOperand(0), NewC, in ShrinkDemandedConstant()
550 return TLO.CombineTo(Op, NewOp); in ShrinkDemandedConstant()
562 TargetLoweringOpt &TLO) const { in ShrinkDemandedConstant()
567 return ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO); in ShrinkDemandedConstant()
576 TargetLoweringOpt &TLO) const { in ShrinkDemandedOp()
583 SelectionDAG &DAG = TLO.DAG; in ShrinkDemandedOp()
614 return TLO.CombineTo(Op, Z); in ShrinkDemandedOp()
623 TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(), in SimplifyDemandedBits() local
627 bool Simplified = SimplifyDemandedBits(Op, DemandedBits, Known, TLO); in SimplifyDemandedBits()
630 DCI.CommitTargetLoweringOpt(TLO); in SimplifyDemandedBits()
639 TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(), in SimplifyDemandedBits() local
644 SimplifyDemandedBits(Op, DemandedBits, DemandedElts, Known, TLO); in SimplifyDemandedBits()
647 DCI.CommitTargetLoweringOpt(TLO); in SimplifyDemandedBits()
654 TargetLoweringOpt &TLO, in SimplifyDemandedBits() argument
665 return SimplifyDemandedBits(Op, DemandedBits, DemandedElts, Known, TLO, Depth, in SimplifyDemandedBits()
955 TargetLowering::TargetLoweringOpt &TLO, in combineShiftToAVG() argument
1009 SelectionDAG &DAG = TLO.DAG; in combineShiftToAVG()
1067 if (TLO.LegalTypes() && !TLI.isOperationLegal(AVGOpc, NVT)) { in combineShiftToAVG()
1070 if (TLO.LegalOperations() && !TLI.isOperationLegal(AVGOpc, VT)) in combineShiftToAVG()
1103 const APInt &OriginalDemandedElts, KnownBits &Known, TargetLoweringOpt &TLO, in SimplifyDemandedBits() argument
1113 bool IsLE = TLO.DAG.getDataLayout().isLittleEndian(); in SimplifyDemandedBits()
1156 return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT)); in SimplifyDemandedBits()
1168 return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT)); in SimplifyDemandedBits()
1174 if (SimplifyDemandedBits(Src, SrcDemandedBits, SrcKnown, TLO, Depth + 1)) in SimplifyDemandedBits()
1186 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth); in SimplifyDemandedBits()
1192 if (SimplifyDemandedBits(Scl, DemandedSclBits, KnownScl, TLO, Depth + 1)) in SimplifyDemandedBits()
1203 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth); in SimplifyDemandedBits()
1232 return TLO.CombineTo(Op, Vec); in SimplifyDemandedBits()
1238 if (SimplifyDemandedBits(Scl, DemandedSclBits, KnownScl, TLO, Depth + 1)) in SimplifyDemandedBits()
1244 if (SimplifyDemandedBits(Vec, DemandedBits, DemandedVecElts, KnownVec, TLO, in SimplifyDemandedBits()
1267 if (SimplifyDemandedBits(Sub, DemandedBits, DemandedSubElts, KnownSub, TLO, in SimplifyDemandedBits()
1270 if (SimplifyDemandedBits(Src, DemandedBits, DemandedSrcElts, KnownSrc, TLO, in SimplifyDemandedBits()
1285 Sub, DemandedBits, DemandedSubElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1287 Src, DemandedBits, DemandedSrcElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1291 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), dl, VT, NewSrc, NewSub, in SimplifyDemandedBits()
1293 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
1309 if (SimplifyDemandedBits(Src, DemandedBits, DemandedSrcElts, Known, TLO, in SimplifyDemandedBits()
1316 Src, DemandedBits, DemandedSrcElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1318 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), dl, VT, DemandedSrc, in SimplifyDemandedBits()
1320 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
1337 Known2, TLO, Depth + 1)) in SimplifyDemandedBits()
1362 if (SimplifyDemandedBits(Op0, DemandedBits, DemandedLHS, Known2, TLO, in SimplifyDemandedBits()
1368 if (SimplifyDemandedBits(Op1, DemandedBits, DemandedRHS, Known2, TLO, in SimplifyDemandedBits()
1376 Op0, DemandedBits, DemandedLHS, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1378 Op1, DemandedBits, DemandedRHS, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1382 SDValue NewOp = TLO.DAG.getVectorShuffle(VT, dl, Op0, Op1, ShuffleMask); in SimplifyDemandedBits()
1383 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
1398 KnownBits LHSKnown = TLO.DAG.computeKnownBits(Op0, DemandedElts, Depth); in SimplifyDemandedBits()
1402 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
1407 DemandedElts, TLO)) in SimplifyDemandedBits()
1417 SDValue Xor = TLO.DAG.getNode(ISD::XOR, dl, VT, Op0.getOperand(0), Op1); in SimplifyDemandedBits()
1418 return TLO.CombineTo(Op, Xor); in SimplifyDemandedBits()
1434 TLO.DAG.computeKnownBits(Op1, DemandedSub & DemandedElts, Depth + 1); in SimplifyDemandedBits()
1437 TLO.DAG.getNode(ISD::AND, dl, VT, Op0.getOperand(0), Op1); in SimplifyDemandedBits()
1439 TLO.DAG.getNode(ISD::INSERT_SUBVECTOR, dl, VT, NewAnd, in SimplifyDemandedBits()
1441 return TLO.CombineTo(Op, NewInsert); in SimplifyDemandedBits()
1445 if (SimplifyDemandedBits(Op1, DemandedBits, DemandedElts, Known, TLO, in SimplifyDemandedBits()
1449 Known2, TLO, Depth + 1)) in SimplifyDemandedBits()
1455 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
1457 return TLO.CombineTo(Op, Op1); in SimplifyDemandedBits()
1460 return TLO.CombineTo(Op, TLO.DAG.getConstant(0, dl, VT)); in SimplifyDemandedBits()
1463 TLO)) in SimplifyDemandedBits()
1466 if (ShrinkDemandedOp(Op, BitWidth, DemandedBits, TLO)) in SimplifyDemandedBits()
1472 Op0, DemandedBits, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1474 Op1, DemandedBits, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1478 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), dl, VT, Op0, Op1); in SimplifyDemandedBits()
1479 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
1490 if (SimplifyDemandedBits(Op1, DemandedBits, DemandedElts, Known, TLO, in SimplifyDemandedBits()
1500 Known2, TLO, Depth + 1)) { in SimplifyDemandedBits()
1511 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
1513 return TLO.CombineTo(Op, Op1); in SimplifyDemandedBits()
1515 if (ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO)) in SimplifyDemandedBits()
1518 if (ShrinkDemandedOp(Op, BitWidth, DemandedBits, TLO)) in SimplifyDemandedBits()
1524 Op0, DemandedBits, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1526 Op1, DemandedBits, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1530 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), dl, VT, Op0, Op1); in SimplifyDemandedBits()
1531 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
1549 if (SDValue C12 = TLO.DAG.FoldConstantArithmetic(ISD::OR, dl, VT, in SimplifyDemandedBits()
1551 SDValue MaskX = TLO.DAG.getNode(ISD::AND, dl, VT, X, C12); in SimplifyDemandedBits()
1552 SDValue MaskY = TLO.DAG.getNode(ISD::AND, dl, VT, Y, C2); in SimplifyDemandedBits()
1553 return TLO.CombineTo( in SimplifyDemandedBits()
1554 Op, TLO.DAG.getNode(ISD::OR, dl, VT, MaskX, MaskY)); in SimplifyDemandedBits()
1569 if (SimplifyDemandedBits(Op1, DemandedBits, DemandedElts, Known, TLO, in SimplifyDemandedBits()
1572 if (SimplifyDemandedBits(Op0, DemandedBits, DemandedElts, Known2, TLO, in SimplifyDemandedBits()
1579 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
1581 return TLO.CombineTo(Op, Op1); in SimplifyDemandedBits()
1583 if (ShrinkDemandedOp(Op, BitWidth, DemandedBits, TLO)) in SimplifyDemandedBits()
1590 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::OR, dl, VT, Op0, Op1)); in SimplifyDemandedBits()
1601 TLO.DAG.getConstant(~C->getAPIntValue() & DemandedBits, dl, VT); in SimplifyDemandedBits()
1602 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::AND, dl, VT, Op0, ANDC)); in SimplifyDemandedBits()
1610 SDValue New = TLO.DAG.getNOT(dl, Op0, VT); in SimplifyDemandedBits()
1611 return TLO.CombineTo(Op, New); in SimplifyDemandedBits()
1625 const TargetLowering &TLI = TLO.DAG.getTargetLoweringInfo(); in SimplifyDemandedBits()
1632 SDValue Not = TLO.DAG.getNOT(dl, Op0.getOperand(0), VT); in SimplifyDemandedBits()
1633 return TLO.CombineTo(Op, TLO.DAG.getNode(Op0Opcode, dl, VT, Not, in SimplifyDemandedBits()
1643 if (ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO)) in SimplifyDemandedBits()
1649 Op0, DemandedBits, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1651 Op1, DemandedBits, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1655 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), dl, VT, Op0, Op1); in SimplifyDemandedBits()
1656 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
1665 Known, TLO, Depth + 1)) in SimplifyDemandedBits()
1668 Known2, TLO, Depth + 1)) in SimplifyDemandedBits()
1672 if (ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO)) in SimplifyDemandedBits()
1680 Known, TLO, Depth + 1)) in SimplifyDemandedBits()
1683 Known2, TLO, Depth + 1)) in SimplifyDemandedBits()
1691 Known, TLO, Depth + 1)) in SimplifyDemandedBits()
1694 Known2, TLO, Depth + 1)) in SimplifyDemandedBits()
1698 if (ShrinkDemandedConstant(Op, DemandedBits, DemandedElts, TLO)) in SimplifyDemandedBits()
1721 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
1738 TLO.DAG.getValidShiftAmount(Op, DemandedElts, Depth + 1)) { in SimplifyDemandedBits()
1741 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
1750 TLO.DAG.getValidShiftAmount(Op0, DemandedElts, Depth + 2)) { in SimplifyDemandedBits()
1758 SDValue NewSA = TLO.DAG.getConstant(Diff, dl, ShiftVT); in SimplifyDemandedBits()
1759 return TLO.CombineTo( in SimplifyDemandedBits()
1760 Op, TLO.DAG.getNode(Opc, dl, VT, Op0.getOperand(0), NewSA)); in SimplifyDemandedBits()
1774 SDValue NarrowShl = TLO.DAG.getNode( in SimplifyDemandedBits()
1776 TLO.DAG.getShiftAmountConstant(ShAmt, InnerVT, dl)); in SimplifyDemandedBits()
1777 return TLO.CombineTo( in SimplifyDemandedBits()
1778 Op, TLO.DAG.getNode(ISD::ANY_EXTEND, dl, VT, NarrowShl)); in SimplifyDemandedBits()
1789 if (std::optional<uint64_t> SA2 = TLO.DAG.getValidShiftAmount( in SimplifyDemandedBits()
1797 TLO.DAG.getConstant(ShAmt - InnerShAmt, dl, ShiftVT); in SimplifyDemandedBits()
1798 SDValue NewExt = TLO.DAG.getNode(ISD::ANY_EXTEND, dl, VT, in SimplifyDemandedBits()
1800 return TLO.CombineTo( in SimplifyDemandedBits()
1801 Op, TLO.DAG.getNode(ISD::SHL, dl, VT, NewExt, NewSA)); in SimplifyDemandedBits()
1808 if (SimplifyDemandedBits(Op0, InDemandedMask, DemandedElts, Known, TLO, in SimplifyDemandedBits()
1828 Op0, InDemandedMask, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
1830 SDValue NewOp = TLO.DAG.getNode(ISD::SHL, dl, VT, DemandedOp0, Op1); in SimplifyDemandedBits()
1831 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
1845 EVT SmallVT = EVT::getIntegerVT(*TLO.DAG.getContext(), SmallVTBits); in SimplifyDemandedBits()
1849 (!TLO.LegalOperations() || isOperationLegal(ISD::SHL, SmallVT))) { in SimplifyDemandedBits()
1853 SDValue NarrowShl = TLO.DAG.getNode( in SimplifyDemandedBits()
1855 TLO.DAG.getNode(ISD::TRUNCATE, dl, SmallVT, Op.getOperand(0)), in SimplifyDemandedBits()
1856 TLO.DAG.getShiftAmountConstant(ShAmt, SmallVT, dl)); in SimplifyDemandedBits()
1857 return TLO.CombineTo( in SimplifyDemandedBits()
1858 Op, TLO.DAG.getNode(ISD::ANY_EXTEND, dl, VT, NarrowShl)); in SimplifyDemandedBits()
1869 EVT HalfVT = EVT::getIntegerVT(*TLO.DAG.getContext(), HalfWidth); in SimplifyDemandedBits()
1873 (!TLO.LegalOperations() || isOperationLegal(ISD::SHL, HalfVT))) { in SimplifyDemandedBits()
1882 SDValue NewOp = TLO.DAG.getNode(ISD::TRUNCATE, dl, HalfVT, Op0); in SimplifyDemandedBits()
1884 TLO.DAG.getShiftAmountConstant(ShAmt, HalfVT, dl); in SimplifyDemandedBits()
1885 SDValue NewShift = TLO.DAG.getNode(ISD::SHL, dl, HalfVT, NewOp, in SimplifyDemandedBits()
1888 TLO.DAG.getNode(ISD::ZERO_EXTEND, dl, VT, NewShift); in SimplifyDemandedBits()
1889 return TLO.CombineTo(Op, NewExt); in SimplifyDemandedBits()
1899 if (SimplifyDemandedBits(Op0, DemandedFromOp, DemandedElts, Known, TLO, in SimplifyDemandedBits()
1918 TLO.DAG.getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1)) { in SimplifyDemandedBits()
1921 TLO.DAG.ComputeNumSignBits(Op0, DemandedElts, Depth + 1); in SimplifyDemandedBits()
1924 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
1934 TLO.DAG.getValidShiftAmount(Op, DemandedElts, Depth + 1)) { in SimplifyDemandedBits()
1937 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
1946 TLO.DAG.getValidShiftAmount(Op0, DemandedElts, Depth + 2)) { in SimplifyDemandedBits()
1954 SDValue NewSA = TLO.DAG.getConstant(Diff, dl, ShiftVT); in SimplifyDemandedBits()
1955 return TLO.CombineTo( in SimplifyDemandedBits()
1956 Op, TLO.DAG.getNode(Opc, dl, VT, Op0.getOperand(0), NewSA)); in SimplifyDemandedBits()
1972 EVT HalfVT = EVT::getIntegerVT(*TLO.DAG.getContext(), BitWidth / 2); in SimplifyDemandedBits()
1976 (!TLO.LegalOperations() || isOperationLegal(ISD::SRL, HalfVT)) && in SimplifyDemandedBits()
1978 TLO.DAG.MaskedValueIsZero(Op0, HiBits))) { in SimplifyDemandedBits()
1979 SDValue NewOp = TLO.DAG.getNode(ISD::TRUNCATE, dl, HalfVT, Op0); in SimplifyDemandedBits()
1981 TLO.DAG.getShiftAmountConstant(ShAmt, HalfVT, dl); in SimplifyDemandedBits()
1983 TLO.DAG.getNode(ISD::SRL, dl, HalfVT, NewOp, NewShiftAmt); in SimplifyDemandedBits()
1984 return TLO.CombineTo( in SimplifyDemandedBits()
1985 Op, TLO.DAG.getNode(ISD::ZERO_EXTEND, dl, VT, NewShift)); in SimplifyDemandedBits()
1990 if (SimplifyDemandedBits(Op0, InDemandedMask, DemandedElts, Known, TLO, in SimplifyDemandedBits()
2001 Op0, InDemandedMask, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
2003 SDValue NewOp = TLO.DAG.getNode(ISD::SRL, dl, VT, DemandedOp0, Op1); in SimplifyDemandedBits()
2004 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
2010 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth); in SimplifyDemandedBits()
2014 if (SDValue AVG = combineShiftToAVG(Op, TLO, *this, DemandedBits, in SimplifyDemandedBits()
2016 return TLO.CombineTo(Op, AVG); in SimplifyDemandedBits()
2028 if (TLO.DAG.ComputeNumSignBits(Op0, DemandedElts, Depth + 1) >= in SimplifyDemandedBits()
2030 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
2037 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl, VT, Op0, Op1)); in SimplifyDemandedBits()
2040 TLO.DAG.getValidShiftAmount(Op, DemandedElts, Depth + 1)) { in SimplifyDemandedBits()
2043 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
2049 TLO.DAG.getValidShiftAmount(Op0, DemandedElts, Depth + 2)) { in SimplifyDemandedBits()
2051 EVT ExtVT = EVT::getIntegerVT(*TLO.DAG.getContext(), LowBits); in SimplifyDemandedBits()
2053 ExtVT = EVT::getVectorVT(*TLO.DAG.getContext(), ExtVT, in SimplifyDemandedBits()
2057 if (!TLO.LegalOperations() || in SimplifyDemandedBits()
2059 return TLO.CombineTo( in SimplifyDemandedBits()
2060 Op, TLO.DAG.getNode(ISD::SIGN_EXTEND_INREG, dl, VT, in SimplifyDemandedBits()
2062 TLO.DAG.getValueType(ExtVT))); in SimplifyDemandedBits()
2067 TLO.DAG.ComputeNumSignBits(Op0.getOperand(0), DemandedElts); in SimplifyDemandedBits()
2069 return TLO.CombineTo(Op, Op0.getOperand(0)); in SimplifyDemandedBits()
2086 if (SimplifyDemandedBits(Op0, InDemandedMask, DemandedElts, Known, TLO, in SimplifyDemandedBits()
2098 return TLO.CombineTo( in SimplifyDemandedBits()
2099 Op, TLO.DAG.getNode(ISD::SRL, dl, VT, Op0, Op1, Flags)); in SimplifyDemandedBits()
2105 SDValue NewSA = TLO.DAG.getConstant(BitWidth - 1 - Log2, dl, ShiftVT); in SimplifyDemandedBits()
2106 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl, VT, Op0, NewSA)); in SimplifyDemandedBits()
2116 Op0, InDemandedMask, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
2118 SDValue NewOp = TLO.DAG.getNode(ISD::SRA, dl, VT, DemandedOp0, Op1); in SimplifyDemandedBits()
2119 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
2125 if (SDValue AVG = combineShiftToAVG(Op, TLO, *this, DemandedBits, in SimplifyDemandedBits()
2127 return TLO.CombineTo(Op, AVG); in SimplifyDemandedBits()
2145 Known, TLO, Depth + 1)) in SimplifyDemandedBits()
2154 if (SimplifyDemandedBits(Op0, Demanded0, DemandedElts, Known2, TLO, in SimplifyDemandedBits()
2157 if (SimplifyDemandedBits(Op1, Demanded1, DemandedElts, Known, TLO, in SimplifyDemandedBits()
2171 Op0, Demanded0, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
2173 Op1, Demanded1, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
2177 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), dl, VT, DemandedOp0, in SimplifyDemandedBits()
2179 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
2188 Known2, TLO, Depth + 1)) in SimplifyDemandedBits()
2200 if (BitWidth == TLO.DAG.ComputeNumSignBits(Op0, DemandedElts, Depth + 1)) in SimplifyDemandedBits()
2201 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
2210 if (SimplifyDemandedBits(Op0, Demanded0, DemandedElts, Known2, TLO, in SimplifyDemandedBits()
2216 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
2219 if ((!TLO.LegalOperations() || isOperationLegal(ISD::SHL, VT)) && in SimplifyDemandedBits()
2221 Op1 = TLO.DAG.getConstant(IsROTL ? Amt : RevAmt, dl, Op1.getValueType()); in SimplifyDemandedBits()
2222 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SHL, dl, VT, Op0, Op1)); in SimplifyDemandedBits()
2224 if ((!TLO.LegalOperations() || isOperationLegal(ISD::SRL, VT)) && in SimplifyDemandedBits()
2226 Op1 = TLO.DAG.getConstant(IsROTL ? RevAmt : Amt, dl, Op1.getValueType()); in SimplifyDemandedBits()
2227 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::SRL, dl, VT, Op0, Op1)); in SimplifyDemandedBits()
2234 if (SimplifyDemandedBits(Op1, DemandedAmtBits, DemandedElts, Known2, TLO, in SimplifyDemandedBits()
2252 std::min(TLO.DAG.ComputeNumSignBits(Op0, DemandedElts, Depth + 1), in SimplifyDemandedBits()
2253 TLO.DAG.ComputeNumSignBits(Op1, DemandedElts, Depth + 1)); in SimplifyDemandedBits()
2256 return TLO.CombineTo(Op, TLO.DAG.getNode(BitOp, SDLoc(Op), VT, Op0, Op1)); in SimplifyDemandedBits()
2259 KnownBits Known0 = TLO.DAG.computeKnownBits(Op0, DemandedElts, Depth + 1); in SimplifyDemandedBits()
2260 KnownBits Known1 = TLO.DAG.computeKnownBits(Op1, DemandedElts, Depth + 1); in SimplifyDemandedBits()
2264 return TLO.CombineTo(Op, *IsSLE ? Op0 : Op1); in SimplifyDemandedBits()
2266 return TLO.CombineTo(Op, *IsSLT ? Op0 : Op1); in SimplifyDemandedBits()
2271 return TLO.CombineTo(Op, *IsSGE ? Op0 : Op1); in SimplifyDemandedBits()
2273 return TLO.CombineTo(Op, *IsSGT ? Op0 : Op1); in SimplifyDemandedBits()
2278 return TLO.CombineTo(Op, *IsULE ? Op0 : Op1); in SimplifyDemandedBits()
2280 return TLO.CombineTo(Op, *IsULT ? Op0 : Op1); in SimplifyDemandedBits()
2285 return TLO.CombineTo(Op, *IsUGE ? Op0 : Op1); in SimplifyDemandedBits()
2287 return TLO.CombineTo(Op, *IsUGT ? Op0 : Op1); in SimplifyDemandedBits()
2296 if (SimplifyDemandedBits(Src, DemandedSrcBits, DemandedElts, Known2, TLO, in SimplifyDemandedBits()
2321 if (!TLO.LegalOperations() || isOperationLegal(ShiftOpcode, VT)) { in SimplifyDemandedBits()
2323 SDValue ShAmt = TLO.DAG.getShiftAmountConstant(ShiftAmount, VT, dl); in SimplifyDemandedBits()
2324 SDValue NewOp = TLO.DAG.getNode(ShiftOpcode, dl, VT, Src, ShAmt); in SimplifyDemandedBits()
2325 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
2330 if (SimplifyDemandedBits(Src, DemandedSrcBits, DemandedElts, Known2, TLO, in SimplifyDemandedBits()
2341 if (DemandedBits.isOne() && !TLO.LegalOps && !VT.isVector()) in SimplifyDemandedBits()
2342 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::PARITY, dl, VT, in SimplifyDemandedBits()
2345 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth); in SimplifyDemandedBits()
2356 TLO.DAG.ComputeMaxSignificantBits(Op0, DemandedElts, Depth + 1); in SimplifyDemandedBits()
2364 TLO.DAG.getShiftAmountConstant(BitWidth - ExVTBits, VT, dl); in SimplifyDemandedBits()
2365 return TLO.CombineTo(Op, in SimplifyDemandedBits()
2366 TLO.DAG.getNode(ISD::SHL, dl, VT, Op0, ShiftAmt)); in SimplifyDemandedBits()
2372 return TLO.CombineTo(Op, Op0); in SimplifyDemandedBits()
2380 if (SimplifyDemandedBits(Op0, InputDemandedBits, DemandedElts, Known, TLO, in SimplifyDemandedBits()
2389 return TLO.CombineTo(Op, TLO.DAG.getZeroExtendInReg(Op0, dl, ExVT)); in SimplifyDemandedBits()
2410 if (SimplifyDemandedBits(Op.getOperand(0), MaskLo, KnownLo, TLO, Depth + 1)) in SimplifyDemandedBits()
2413 if (SimplifyDemandedBits(Op.getOperand(1), MaskHi, KnownHi, TLO, Depth + 1)) in SimplifyDemandedBits()
2436 return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Src)); in SimplifyDemandedBits()
2440 if (!TLO.LegalOperations() || isOperationLegal(Opc, VT)) in SimplifyDemandedBits()
2441 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT, Src)); in SimplifyDemandedBits()
2447 if (SimplifyDemandedBits(Src, InDemandedBits, InDemandedElts, Known, TLO, in SimplifyDemandedBits()
2460 Src, InDemandedBits, InDemandedElts, TLO.DAG, Depth + 1)) in SimplifyDemandedBits()
2461 return TLO.CombineTo(Op, TLO.DAG.getNode(Op.getOpcode(), dl, VT, NewSrc)); in SimplifyDemandedBits()
2488 return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Src)); in SimplifyDemandedBits()
2492 TLO.DAG.ComputeNumSignBits(Src, InDemandedElts, Depth + 1) != in SimplifyDemandedBits()
2496 if (!TLO.LegalOperations() || isOperationLegal(Opc, VT)) in SimplifyDemandedBits()
2497 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT, Src)); in SimplifyDemandedBits()
2501 if (SimplifyDemandedBits(Src, InDemandedBits, InDemandedElts, Known, TLO, in SimplifyDemandedBits()
2513 if (!TLO.LegalOperations() || isOperationLegal(Opc, VT)) { in SimplifyDemandedBits()
2517 return TLO.CombineTo(Op, TLO.DAG.getNode(Opc, dl, VT, Src, Flags)); in SimplifyDemandedBits()
2523 Src, InDemandedBits, InDemandedElts, TLO.DAG, Depth + 1)) in SimplifyDemandedBits()
2524 return TLO.CombineTo(Op, TLO.DAG.getNode(Op.getOpcode(), dl, VT, NewSrc)); in SimplifyDemandedBits()
2542 return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Src)); in SimplifyDemandedBits()
2546 if (SimplifyDemandedBits(Src, InDemandedBits, InDemandedElts, Known, TLO, in SimplifyDemandedBits()
2554 Src, InDemandedBits, InDemandedElts, TLO.DAG, Depth + 1)) in SimplifyDemandedBits()
2555 return TLO.CombineTo(Op, TLO.DAG.getNode(Op.getOpcode(), dl, VT, NewSrc)); in SimplifyDemandedBits()
2565 if (SimplifyDemandedBits(Src, TruncMask, DemandedElts, Known, TLO, in SimplifyDemandedBits()
2572 Src, TruncMask, DemandedElts, TLO.DAG, Depth + 1)) in SimplifyDemandedBits()
2573 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::TRUNCATE, dl, VT, NewSrc)); in SimplifyDemandedBits()
2583 if (TLO.LegalTypes() && !isTypeDesirableForOp(ISD::SRL, VT)) in SimplifyDemandedBits()
2601 TLO.DAG.getValidShiftAmount(Src, DemandedElts, Depth + 2); in SimplifyDemandedBits()
2613 SDValue NewShAmt = TLO.DAG.getShiftAmountConstant(ShVal, VT, dl); in SimplifyDemandedBits()
2615 TLO.DAG.getNode(ISD::TRUNCATE, dl, VT, Src.getOperand(0)); in SimplifyDemandedBits()
2616 return TLO.CombineTo( in SimplifyDemandedBits()
2617 Op, TLO.DAG.getNode(ISD::SRL, dl, VT, NewTrunc, NewShAmt)); in SimplifyDemandedBits()
2631 TLO, Depth + 1)) in SimplifyDemandedBits()
2660 if (SimplifyDemandedBits(Src, DemandedSrcBits, DemandedSrcElts, Known2, TLO, in SimplifyDemandedBits()
2667 Src, DemandedSrcBits, DemandedSrcElts, TLO.DAG, Depth + 1)) { in SimplifyDemandedBits()
2669 TLO.DAG.getNode(Op.getOpcode(), dl, VT, DemandedSrc, Idx); in SimplifyDemandedBits()
2670 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
2688 if (!TLO.LegalOperations() && !VT.isVector() && !SrcVT.isVector() && in SimplifyDemandedBits()
2699 SDValue Sign = TLO.DAG.getNode(ISD::FGETSIGN, dl, Ty, Src); in SimplifyDemandedBits()
2702 Sign = TLO.DAG.getNode(ISD::ZERO_EXTEND, dl, VT, Sign); in SimplifyDemandedBits()
2704 SDValue ShAmt = TLO.DAG.getConstant(ShVal, dl, VT); in SimplifyDemandedBits()
2705 return TLO.CombineTo(Op, in SimplifyDemandedBits()
2706 TLO.DAG.getNode(ISD::SHL, dl, VT, Sign, ShAmt)); in SimplifyDemandedBits()
2731 KnownSrcZero, TLO, Depth + 1)) in SimplifyDemandedBits()
2736 KnownSrcBits, TLO, Depth + 1)) in SimplifyDemandedBits()
2754 KnownSrcZero, TLO, Depth + 1)) in SimplifyDemandedBits()
2760 KnownSrcBits, TLO, Depth + 1)) in SimplifyDemandedBits()
2766 Src, DemandedSrcBits, DemandedSrcElts, TLO.DAG, Depth + 1)) { in SimplifyDemandedBits()
2767 SDValue NewOp = TLO.DAG.getBitcast(VT, DemandedSrc); in SimplifyDemandedBits()
2768 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
2776 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth); in SimplifyDemandedBits()
2789 SDValue AmtC = TLO.DAG.getShiftAmountConstant(CTZ, VT, dl); in SimplifyDemandedBits()
2790 SDValue Shl = TLO.DAG.getNode(ISD::SHL, dl, VT, Op.getOperand(0), AmtC); in SimplifyDemandedBits()
2791 return TLO.CombineTo(Op, Shl); in SimplifyDemandedBits()
2798 SDValue One = TLO.DAG.getConstant(1, dl, VT); in SimplifyDemandedBits()
2799 SDValue And1 = TLO.DAG.getNode(ISD::AND, dl, VT, Op.getOperand(0), One); in SimplifyDemandedBits()
2800 return TLO.CombineTo(Op, And1); in SimplifyDemandedBits()
2818 if (SimplifyDemandedBits(Op1, LoMask, DemandedElts, KnownOp1, TLO, in SimplifyDemandedBits()
2821 DemandedElts, KnownOp0, TLO, Depth + 1) || in SimplifyDemandedBits()
2823 ShrinkDemandedOp(Op, BitWidth, DemandedBits, TLO)) { in SimplifyDemandedBits()
2837 return TLO.CombineTo(Op, Op1); in SimplifyDemandedBits()
2842 Op0, LoMask, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
2844 Op1, LoMask, DemandedElts, TLO.DAG, Depth + 1); in SimplifyDemandedBits()
2851 TLO.DAG.getNode(Op.getOpcode(), dl, VT, Op0, Op1, Flags); in SimplifyDemandedBits()
2852 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
2865 SDValue Neg1 = TLO.DAG.getAllOnesConstant(dl, VT); in SimplifyDemandedBits()
2870 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), dl, VT, Op0, Neg1, Flags); in SimplifyDemandedBits()
2871 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedBits()
2895 SDValue ShlAmtC = TLO.DAG.getShiftAmountConstant(ShlAmt, VT, dl); in SimplifyDemandedBits()
2896 SDValue Shl = TLO.DAG.getNode(ISD::SHL, dl, VT, X, ShlAmtC); in SimplifyDemandedBits()
2897 SDValue Res = TLO.DAG.getNode(NT, dl, VT, Y, Shl); in SimplifyDemandedBits()
2898 return TLO.CombineTo(Op, Res); in SimplifyDemandedBits()
2935 Known, TLO, Depth)) in SimplifyDemandedBits()
2941 Known = TLO.DAG.computeKnownBits(Op, DemandedElts, Depth); in SimplifyDemandedBits()
2958 return TLO.CombineTo(Op, TLO.DAG.getConstant(Known.One, dl, VT)); in SimplifyDemandedBits()
2960 return TLO.CombineTo( in SimplifyDemandedBits()
2962 TLO.DAG.getConstantFP( in SimplifyDemandedBits()
2963 APFloat(TLO.DAG.EVTToAPFloatSemantics(VT), Known.One), dl, VT)); in SimplifyDemandedBits()
2970 Known = TLO.DAG.computeKnownBits(Op, OriginalDemandedElts, Depth); in SimplifyDemandedBits()
2979 TargetLoweringOpt TLO(DAG, !DCI.isBeforeLegalize(), in SimplifyDemandedVectorElts() local
2984 SimplifyDemandedVectorElts(Op, DemandedElts, KnownUndef, KnownZero, TLO); in SimplifyDemandedVectorElts()
2987 DCI.CommitTargetLoweringOpt(TLO); in SimplifyDemandedVectorElts()
3043 APInt &KnownZero, TargetLoweringOpt &TLO, unsigned Depth, in SimplifyDemandedVectorElts() argument
3053 const TargetLowering &TLI = TLO.DAG.getTargetLoweringInfo(); in SimplifyDemandedVectorElts()
3054 if (!TLI.shouldSimplifyDemandedVectorElts(Op, TLO)) in SimplifyDemandedVectorElts()
3077 return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT)); in SimplifyDemandedVectorElts()
3086 bool IsLE = TLO.DAG.getDataLayout().isLittleEndian(); in SimplifyDemandedVectorElts()
3092 TLO.DAG, Depth + 1); in SimplifyDemandedVectorElts()
3094 TLO.DAG, Depth + 1); in SimplifyDemandedVectorElts()
3097 TLO.DAG.getNode(Opcode, SDLoc(Op), VT, NewOp0 ? NewOp0 : Op0, in SimplifyDemandedVectorElts()
3099 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedVectorElts()
3108 return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT)); in SimplifyDemandedVectorElts()
3127 TLO, Depth + 1)) in SimplifyDemandedVectorElts()
3147 KnownZero, TLO, Depth + 1); in SimplifyDemandedVectorElts()
3157 TLO, Depth + 1)) in SimplifyDemandedVectorElts()
3174 TLO, Depth + 1)) in SimplifyDemandedVectorElts()
3212 TLO, Depth + 1)) in SimplifyDemandedVectorElts()
3230 if (TLO.DAG.isGuaranteedNotToBeUndefOrPoison(N0, DemandedElts, in SimplifyDemandedVectorElts()
3232 return TLO.CombineTo(Op, N0); in SimplifyDemandedVectorElts()
3237 return TLO.CombineTo( in SimplifyDemandedVectorElts()
3238 Op, TLO.DAG.getNode(ISD::SCALAR_TO_VECTOR, DL, VT, in SimplifyDemandedVectorElts()
3239 TLO.DAG.getFreeze(N0.getOperand(0)))); in SimplifyDemandedVectorElts()
3252 Ops[i] = TLO.DAG.getUNDEF(Ops[0].getValueType()); in SimplifyDemandedVectorElts()
3258 return TLO.CombineTo(Op, TLO.DAG.getBuildVector(VT, DL, Ops)); in SimplifyDemandedVectorElts()
3280 if (SimplifyDemandedVectorElts(SubOp, SubElts, SubUndef, SubZero, TLO, in SimplifyDemandedVectorElts()
3295 SubOp, SubElts, TLO.DAG, Depth + 1); in SimplifyDemandedVectorElts()
3301 TLO.DAG.getNode(Op.getOpcode(), SDLoc(Op), VT, DemandedSubOps); in SimplifyDemandedVectorElts()
3302 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedVectorElts()
3319 if (SimplifyDemandedVectorElts(Sub, DemandedSubElts, SubUndef, SubZero, TLO, in SimplifyDemandedVectorElts()
3325 return TLO.CombineTo(Op, TLO.DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, in SimplifyDemandedVectorElts()
3326 TLO.DAG.getUNDEF(VT), Sub, in SimplifyDemandedVectorElts()
3330 TLO, Depth + 1)) in SimplifyDemandedVectorElts()
3338 Src, DemandedSrcElts, TLO.DAG, Depth + 1); in SimplifyDemandedVectorElts()
3340 Sub, DemandedSubElts, TLO.DAG, Depth + 1); in SimplifyDemandedVectorElts()
3344 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), SDLoc(Op), VT, NewSrc, in SimplifyDemandedVectorElts()
3346 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedVectorElts()
3361 if (SimplifyDemandedVectorElts(Src, DemandedSrcElts, SrcUndef, SrcZero, TLO, in SimplifyDemandedVectorElts()
3370 Src, DemandedSrcElts, TLO.DAG, Depth + 1); in SimplifyDemandedVectorElts()
3372 SDValue NewOp = TLO.DAG.getNode(Op.getOpcode(), SDLoc(Op), VT, NewSrc, in SimplifyDemandedVectorElts()
3374 return TLO.CombineTo(Op, NewOp); in SimplifyDemandedVectorElts()
3389 return TLO.CombineTo(Op, Vec); in SimplifyDemandedVectorElts()
3394 KnownZero, TLO, Depth + 1)) in SimplifyDemandedVectorElts()
3404 if (SimplifyDemandedVectorElts(Vec, DemandedElts, VecUndef, VecZero, TLO, in SimplifyDemandedVectorElts()
3418 if (SimplifyDemandedVectorElts(Sel, DemandedElts, UndefSel, ZeroSel, TLO, in SimplifyDemandedVectorElts()
3427 if (SimplifyDemandedVectorElts(LHS, DemandedLHS, UndefLHS, ZeroLHS, TLO, in SimplifyDemandedVectorElts()
3430 if (SimplifyDemandedVectorElts(RHS, DemandedRHS, UndefRHS, ZeroRHS, TLO, in SimplifyDemandedVectorElts()
3441 if (SimplifyDemandedVectorElts(Sel, DemandedSel, UndefSel, ZeroSel, TLO, in SimplifyDemandedVectorElts()
3469 if (SimplifyDemandedVectorElts(LHS, DemandedLHS, UndefLHS, ZeroLHS, TLO, in SimplifyDemandedVectorElts()
3472 if (SimplifyDemandedVectorElts(RHS, DemandedRHS, UndefRHS, ZeroRHS, TLO, in SimplifyDemandedVectorElts()
3495 if (Updated && !IdentityLHS && !IdentityRHS && !TLO.LegalOps) { in SimplifyDemandedVectorElts()
3497 buildLegalVectorShuffle(VT, DL, LHS, RHS, NewMask, TLO.DAG); in SimplifyDemandedVectorElts()
3499 return TLO.CombineTo(Op, LegalShuffle); in SimplifyDemandedVectorElts()
3528 if (SimplifyDemandedVectorElts(Src, DemandedSrcElts, SrcUndef, SrcZero, TLO, in SimplifyDemandedVectorElts()
3538 return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Src)); in SimplifyDemandedVectorElts()
3544 return TLO.CombineTo(Op, TLO.DAG.getConstant(0, SDLoc(Op), VT)); in SimplifyDemandedVectorElts()
3556 MaskElts.push_back(TLO.DAG.getAllOnesConstant(DL, SrcSVT)); in SimplifyDemandedVectorElts()
3557 MaskElts.append(NumSrcElts - 1, TLO.DAG.getConstant(0, DL, SrcSVT)); in SimplifyDemandedVectorElts()
3558 SDValue Mask = TLO.DAG.getBuildVector(SrcVT, DL, MaskElts); in SimplifyDemandedVectorElts()
3559 if (SDValue Fold = TLO.DAG.FoldConstantArithmetic( in SimplifyDemandedVectorElts()
3561 Fold = TLO.DAG.getNode(ISD::AND, DL, SrcVT, Src.getOperand(0), Fold); in SimplifyDemandedVectorElts()
3562 return TLO.CombineTo(Op, TLO.DAG.getBitcast(VT, Fold)); in SimplifyDemandedVectorElts()
3576 if (SimplifyDemandedVectorElts(Op0, DemandedElts, UndefLHS, ZeroLHS, TLO, in SimplifyDemandedVectorElts()
3598 if (SimplifyDemandedVectorElts(Op1, DemandedElts, UndefRHS, ZeroRHS, TLO, in SimplifyDemandedVectorElts()
3602 if (SimplifyDemandedVectorElts(Op0, DemandedElts, UndefLHS, ZeroLHS, TLO, in SimplifyDemandedVectorElts()
3607 KnownUndef = getKnownUndefForVectorBinop(Op, TLO.DAG, UndefLHS, UndefRHS); in SimplifyDemandedVectorElts()
3625 if (SimplifyDemandedVectorElts(Op1, DemandedElts, UndefRHS, ZeroRHS, TLO, in SimplifyDemandedVectorElts()
3629 if (SimplifyDemandedVectorElts(Op0, DemandedElts, UndefLHS, ZeroLHS, TLO, in SimplifyDemandedVectorElts()
3651 if (SimplifyDemandedVectorElts(Op1, DemandedElts, SrcUndef, SrcZero, TLO, in SimplifyDemandedVectorElts()
3658 TLO, Depth + 1)) in SimplifyDemandedVectorElts()
3668 return TLO.CombineTo(Op, TLO.DAG.getConstant(0, SDLoc(Op), VT)); in SimplifyDemandedVectorElts()
3688 KnownZero, TLO, Depth + 1)) in SimplifyDemandedVectorElts()
3694 return TLO.CombineTo(Op, TLO.DAG.getConstant(0, SDLoc(Op), VT)); in SimplifyDemandedVectorElts()
3701 KnownZero, TLO, Depth)) in SimplifyDemandedVectorElts()
3707 TLO, Depth, AssumeSingleUse)) in SimplifyDemandedVectorElts()
3718 return TLO.CombineTo(Op, TLO.DAG.getUNDEF(VT)); in SimplifyDemandedVectorElts()
3781 TargetLoweringOpt &TLO, unsigned Depth) const { in SimplifyDemandedVectorEltsForTargetNode() argument
3793 KnownBits &Known, TargetLoweringOpt &TLO, unsigned Depth) const { in SimplifyDemandedBitsForTargetNode() argument
3800 computeKnownBitsForTargetNode(Op, Known, DemandedElts, TLO.DAG, Depth); in SimplifyDemandedBitsForTargetNode()