diff options
Diffstat (limited to 'contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index 441437351852..195c0e6a836f 100644 --- a/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/contrib/llvm-project/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -2529,8 +2529,7 @@ bool SelectionDAG::MaskedValueIsZero(SDValue V, const APInt &Mask, /// DemandedElts. We use this predicate to simplify operations downstream. bool SelectionDAG::MaskedVectorIsZero(SDValue V, const APInt &DemandedElts, unsigned Depth /* = 0 */) const { - APInt Mask = APInt::getAllOnes(V.getScalarValueSizeInBits()); - return Mask.isSubsetOf(computeKnownBits(V, DemandedElts, Depth).Zero); + return computeKnownBits(V, DemandedElts, Depth).isZero(); } /// MaskedValueIsAllOnes - Return true if '(Op & Mask) == Mask'. @@ -9089,6 +9088,15 @@ SDValue SelectionDAG::getNode(unsigned Opcode, const SDLoc &DL, SDVTList VTList, } break; } + case ISD::SMUL_LOHI: + case ISD::UMUL_LOHI: { + assert(VTList.NumVTs == 2 && Ops.size() == 2 && "Invalid mul lo/hi op!"); + assert(VTList.VTs[0].isInteger() && VTList.VTs[0] == VTList.VTs[1] && + VTList.VTs[0] == Ops[0].getValueType() && + VTList.VTs[0] == Ops[1].getValueType() && + "Binary operator types must match!"); + break; + } case ISD::STRICT_FP_EXTEND: assert(VTList.NumVTs == 2 && Ops.size() == 2 && "Invalid STRICT_FP_EXTEND!"); @@ -11682,6 +11690,35 @@ bool BuildVectorSDNode::isConstant() const { return true; } +Optional<std::pair<APInt, APInt>> +BuildVectorSDNode::isConstantSequence() const { + unsigned NumOps = getNumOperands(); + if (NumOps < 2) + return None; + + if (!isa<ConstantSDNode>(getOperand(0)) || + !isa<ConstantSDNode>(getOperand(1))) + return None; + + unsigned EltSize = getValueType(0).getScalarSizeInBits(); + APInt Start = getConstantOperandAPInt(0).trunc(EltSize); + APInt Stride = getConstantOperandAPInt(1).trunc(EltSize) - Start; + + if (Stride.isZero()) + return None; + + for (unsigned i = 2; i < NumOps; ++i) { + if (!isa<ConstantSDNode>(getOperand(i))) + return None; + + APInt Val = getConstantOperandAPInt(i).trunc(EltSize); + if (Val != (Start + (Stride * i))) + return None; + } + + return std::make_pair(Start, Stride); +} + bool ShuffleVectorSDNode::isSplatMask(const int *Mask, EVT VT) { // Find the first non-undef value in the shuffle mask. unsigned i, e; |