Lines Matching defs:N1

2078 /// Swaps the values of N1 and N2. Swaps all indices in the shuffle mask M that
2079 /// point at N1 to point at N2 and indices that point at N2 to point at N1.
2080 static void commuteShuffle(SDValue &N1, SDValue &N2, MutableArrayRef<int> M) {
2081 std::swap(N1, N2);
2085 SDValue SelectionDAG::getVectorShuffle(EVT VT, const SDLoc &dl, SDValue N1,
2089 assert(VT == N1.getValueType() && VT == N2.getValueType() &&
2093 if (N1.isUndef() && N2.isUndef())
2107 if (N1 == N2) {
2114 if (N1.isUndef())
2115 commuteShuffle(N1, N2, MaskVec);
2141 if (auto *N1BV = dyn_cast<BuildVectorSDNode>(N1))
2166 N1 = getUNDEF(VT);
2167 commuteShuffle(N1, N2, MaskVec);
2172 if (N1.isUndef() && N2Undef)
2182 return N1;
2186 SDValue V = N1;
2210 return N1;
2230 SDValue Ops[2] = { N1, N2 };
2527 SDValue SelectionDAG::FoldSetCC(EVT VT, SDValue N1, SDValue N2,
2529 EVT OpVT = N1.getValueType();
2568 if ((N1.isUndef() || N2.isUndef()) &&
2574 if (N1.isUndef() && N2.isUndef())
2579 if (N1.isUndef() || N2.isUndef() || N1 == N2)
2585 if (ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1)) {
2593 auto *N1CFP = dyn_cast<ConstantFPSDNode>(N1);
2657 return getSetCC(dl, VT, N2, N1, SwappedCond);
2659 (OpVT.isFloatingPoint() && (N1.isUndef() || N2.isUndef()))) {
4235 SelectionDAG::computeOverflowForSignedAdd(SDValue N0, SDValue N1) const {
4237 if (isNullConstant(N1))
4242 if (ComputeNumSignBits(N0) > 1 && ComputeNumSignBits(N1) > 1)
4250 SelectionDAG::computeOverflowForUnsignedAdd(SDValue N0, SDValue N1) const {
4252 if (isNullConstant(N1))
4256 KnownBits N1Known = computeKnownBits(N1);
4262 if (N1.getOpcode() == ISD::UMUL_LOHI && N1.getResNo() == 1 &&
4273 SelectionDAG::computeOverflowForSignedSub(SDValue N0, SDValue N1) const {
4275 if (isNullConstant(N1))
4280 if (ComputeNumSignBits(N0) > 1 && ComputeNumSignBits(N1) > 1)
4284 KnownBits N1Known = computeKnownBits(N1);
4291 SelectionDAG::computeOverflowForUnsignedSub(SDValue N0, SDValue N1) const {
4293 if (isNullConstant(N1))
4297 KnownBits N1Known = computeKnownBits(N1);
4304 SelectionDAG::computeOverflowForUnsignedMul(SDValue N0, SDValue N1) const {
4306 if (isNullConstant(N1) || isOneConstant(N1))
4310 KnownBits N1Known = computeKnownBits(N1);
4317 SelectionDAG::computeOverflowForSignedMul(SDValue N0, SDValue N1) const {
4319 if (isNullConstant(N1) || isOneConstant(N1))
4326 unsigned SignBits = ComputeNumSignBits(N0) + ComputeNumSignBits(N1);
4336 KnownBits N1Known = computeKnownBits(N1);
5899 SDValue N1) {
5903 return getNode(Opcode, DL, VT, N1, Flags);
5907 SDValue N1, const SDNodeFlags Flags) {
5908 assert(N1.getOpcode() != ISD::DELETED_NODE && "Operand is DELETED_NODE!");
5944 SDValue Ops = {N1};
5950 unsigned OpOpcode = N1.getNode()->getOpcode();
5956 VT.getVectorElementType() == N1.getValueType() &&
5960 assert(VT == N1.getValueType() && "Unexpected VT!");
5961 if (isGuaranteedNotToBeUndefOrPoison(N1, /*PoisonOnly*/ false,
5963 return N1;
5968 return N1; // Factor, merge or concat of one node? No need.
5971 SDValue Ops[] = {N1};
5978 assert(VT.isFloatingPoint() && N1.getValueType().isFloatingPoint() &&
5980 if (N1.getValueType() == VT) return N1; // noop conversion.
5982 N1.getValueType().getVectorElementCount()) &&
5984 assert(N1.getValueType().bitsLT(VT) && "Invalid fpext node, dst < src!");
5985 if (N1.isUndef())
5990 if (N1.isUndef())
5996 if (N1.isUndef())
6000 assert(VT.isInteger() && N1.getValueType().isInteger() &&
6002 assert(VT.isVector() == N1.getValueType().isVector() &&
6005 if (N1.getValueType() == VT) return N1; // noop extension
6007 N1.getValueType().getVectorElementCount()) &&
6009 assert(N1.getValueType().bitsLT(VT) && "Invalid sext node, dst < src!");
6013 Flags.setNonNeg(N1->getFlags().hasNonNeg());
6014 return getNode(OpOpcode, DL, VT, N1.getOperand(0), Flags);
6021 assert(VT.isInteger() && N1.getValueType().isInteger() &&
6023 assert(VT.isVector() == N1.getValueType().isVector() &&
6026 if (N1.getValueType() == VT) return N1; // noop extension
6028 N1.getValueType().getVectorElementCount()) &&
6030 assert(N1.getValueType().bitsLT(VT) && "Invalid zext node, dst < src!");
6033 Flags.setNonNeg(N1->getFlags().hasNonNeg());
6034 return getNode(ISD::ZERO_EXTEND, DL, VT, N1.getOperand(0), Flags);
6045 SDValue OpOp = N1.getOperand(0);
6049 N1.getScalarValueSizeInBits());
6051 transferDbgValues(N1, OpOp);
6059 assert(VT.isInteger() && N1.getValueType().isInteger() &&
6061 assert(VT.isVector() == N1.getValueType().isVector() &&
6064 if (N1.getValueType() == VT) return N1; // noop extension
6066 N1.getValueType().getVectorElementCount()) &&
6068 assert(N1.getValueType().bitsLT(VT) && "Invalid anyext node, dst < src!");
6074 Flags.setNonNeg(N1->getFlags().hasNonNeg());
6076 return getNode(OpOpcode, DL, VT, N1.getOperand(0), Flags);
6083 SDValue OpOp = N1.getOperand(0);
6085 transferDbgValues(N1, OpOp);
6091 assert(VT.isInteger() && N1.getValueType().isInteger() &&
6093 assert(VT.isVector() == N1.getValueType().isVector() &&
6096 if (N1.getValueType() == VT) return N1; // noop truncate
6098 N1.getValueType().getVectorElementCount()) &&
6100 assert(N1.getValueType().bitsGT(VT) && "Invalid truncate node, src < dst!");
6102 return getNode(ISD::TRUNCATE, DL, VT, N1.getOperand(0));
6106 if (N1.getOperand(0).getValueType().getScalarType().bitsLT(
6108 return getNode(OpOpcode, DL, VT, N1.getOperand(0));
6109 if (N1.getOperand(0).getValueType().bitsGT(VT))
6110 return getNode(ISD::TRUNCATE, DL, VT, N1.getOperand(0));
6111 return N1.getOperand(0);
6117 N1.getConstantOperandAPInt(0).trunc(VT.getSizeInBits()));
6123 assert(N1.getValueType().bitsLE(VT) &&
6126 N1.getValueType().getVectorMinNumElements() &&
6130 assert(VT.isInteger() && VT == N1.getValueType() && "Invalid ABS!");
6135 assert(VT.isInteger() && VT == N1.getValueType() && "Invalid BSWAP!");
6142 return N1.getOperand(0);
6145 assert(VT.isInteger() && VT == N1.getValueType() && "Invalid BITREVERSE!");
6150 assert(VT.getSizeInBits() == N1.getValueSizeInBits() &&
6152 if (VT == N1.getValueType()) return N1; // noop conversion.
6154 return getNode(ISD::BITCAST, DL, VT, N1.getOperand(0));
6159 assert(VT.isVector() && !N1.getValueType().isVector() &&
6160 (VT.getVectorElementType() == N1.getValueType() ||
6162 N1.getValueType().isInteger() &&
6163 VT.getVectorElementType().bitsLE(N1.getValueType()))) &&
6169 isa<ConstantSDNode>(N1.getOperand(1)) &&
6170 N1.getConstantOperandVal(1) == 0 &&
6171 N1.getOperand(0).getValueType() == VT)
6172 return N1.getOperand(0);
6180 return N1.getOperand(0);
6184 return getNode(ISD::FABS, DL, VT, N1.getOperand(0));
6187 assert(VT == N1.getValueType() && "Unexpected VT!");
6190 if (N1.getValueType().getScalarType() == MVT::i1)
6191 return N1;
6195 if (N1.getValueType().getScalarType() == MVT::i1)
6196 return getNOT(DL, N1, N1.getValueType());
6199 if (N1.getValueType().getScalarType() == MVT::i1)
6200 return getNode(ISD::VECREDUCE_XOR, DL, VT, N1);
6204 if (N1.getValueType().getScalarType() == MVT::i1)
6205 return getNode(ISD::VECREDUCE_OR, DL, VT, N1);
6209 if (N1.getValueType().getScalarType() == MVT::i1)
6210 return getNode(ISD::VECREDUCE_AND, DL, VT, N1);
6216 assert((VT.getVectorElementType() == N1.getValueType() ||
6217 (VT.isFloatingPoint() && N1.getValueType() == MVT::i32) ||
6219 N1.getValueType().isInteger() &&
6220 VT.getVectorElementType().bitsLE(N1.getValueType()))) &&
6227 SDValue Ops[] = {N1};
6393 SDValue N1 = Ops[0];
6400 if (auto *C = dyn_cast<ConstantSDNode>(N1)) {
6415 if (TLI->isSExtCheaperThanZExt(N1.getValueType(), VT))
6462 if (SDValue V = FoldSTEP_VECTOR(DL, VT, N1, *this))
6479 if (auto *C = dyn_cast<ConstantFPSDNode>(N1)) {
6597 SDValue N1 = peekThroughBitcasts(Ops[0]);
6599 auto *BV1 = dyn_cast<BuildVectorSDNode>(N1);
6601 if (BV1 && BV2 && N1.getValueType().isInteger() &&
6621 if (N1.getValueType() == VT) {
6622 BVVT = N1.getValueType();
6767 SDValue N1 = Ops[0];
6769 ConstantFPSDNode *N1CFP = isConstOrConstSplatFP(N1, /*AllowUndefs*/ false);
6817 if (ConstantFPSDNode *N1C = isConstOrConstSplatFP(N1, /*AllowUndefs*/ true))
6828 if (N1.isUndef() && N2.isUndef())
6830 if (N1.isUndef() || N2.isUndef())
6866 SDValue N1, SDValue N2) {
6870 return getNode(Opcode, DL, VT, N1, N2, Flags);
6873 void SelectionDAG::canonicalizeCommutativeBinop(unsigned Opcode, SDValue &N1,
6880 SDNode *N1C = isConstantIntBuildVectorOrConstantInt(N1);
6882 SDNode *N1CFP = isConstantFPBuildVectorOrConstantFP(N1);
6885 std::swap(N1, N2);
6889 else if (N1.getOpcode() == ISD::SPLAT_VECTOR &&
6891 std::swap(N1, N2);
6895 SDValue N1, SDValue N2, const SDNodeFlags Flags) {
6896 assert(N1.getOpcode() != ISD::DELETED_NODE &&
6900 canonicalizeCommutativeBinop(Opcode, N1, N2);
6902 auto *N1C = dyn_cast<ConstantSDNode>(N1);
6913 assert(VT == MVT::Other && N1.getValueType() == MVT::Other &&
6916 if (N1.getOpcode() == ISD::EntryToken) return N2;
6917 if (N2.getOpcode() == ISD::EntryToken) return N1;
6918 if (N1 == N2) return N1;
6922 SDValue Ops[] = {N1, N2};
6928 SDValue Ops[] = {N1, N2};
6935 assert(N1.getValueType() == N2.getValueType() &&
6936 N1.getValueType() == VT && "Binary operator types must match!");
6942 return N1;
6949 assert(N1.getValueType() == N2.getValueType() &&
6950 N1.getValueType() == VT && "Binary operator types must match!");
6954 return N1;
6957 return getNode(ISD::XOR, DL, VT, N1, N2);
6961 assert(N1.getValueType() == N2.getValueType() &&
6962 N1.getValueType() == VT && "Binary operator types must match!");
6964 return getNode(ISD::AND, DL, VT, N1, N2);
6965 if (N2C && (N1.getOpcode() == ISD::VSCALE) && Flags.hasNoSignedWrap()) {
6966 const APInt &MulImm = N1->getConstantOperandAPInt(0);
6982 assert(N1.getValueType() == N2.getValueType() &&
6983 N1.getValueType() == VT && "Binary operator types must match!");
6987 return getNode(ISD::OR, DL, VT, N1, N2);
6990 return getNode(ISD::AND, DL, VT, N1, getNOT(DL, N2, VT));
6995 assert(N1.getValueType() == N2.getValueType() &&
6997 assert(N1.getValueType().isVector() == VT.isVector() &&
7001 N1.getValueType().getVectorElementCount() &&
7009 assert(N1.getValueType() == N2.getValueType() &&
7010 N1.getValueType() == VT && "Binary operator types must match!");
7015 assert(N1.getValueType() == N2.getValueType() &&
7016 N1.getValueType() == VT && "Binary operator types must match!");
7021 assert(N1.getValueType() == N2.getValueType() &&
7022 N1.getValueType() == VT && "Binary operator types must match!");
7024 return getNode(ISD::OR, DL, VT, N1, N2);
7029 assert(N1.getValueType() == N2.getValueType() &&
7030 N1.getValueType() == VT && "Binary operator types must match!");
7032 return getNode(ISD::AND, DL, VT, N1, N2);
7040 assert(N1.getValueType() == N2.getValueType() &&
7041 N1.getValueType() == VT && "Binary operator types must match!");
7042 if (SDValue V = simplifyFPBinop(Opcode, N1, N2, Flags))
7045 case ISD::FCOPYSIGN: // N1 and result must match. N1/N2 need not match.
7046 assert(N1.getValueType() == VT &&
7047 N1.getValueType().isFloatingPoint() &&
7052 if (N2C && (N1.getOpcode() == ISD::VSCALE) && Flags.hasNoSignedWrap()) {
7053 const APInt &MulImm = N1->getConstantOperandAPInt(0);
7060 if (SDValue V = simplifyShift(N1, N2))
7065 assert(VT == N1.getValueType() &&
7083 return N1;
7085 return N1;
7089 N1.getValueType().isFloatingPoint() &&
7090 VT.bitsLE(N1.getValueType()) &&
7093 if (N1.getValueType() == VT) return N1; // noop conversion.
7098 assert(VT == N1.getValueType() && "Not an inreg extend!");
7105 if (VT.getScalarType() == EVT) return N1; // noop assertion.
7110 assert(VT == N1.getValueType() && "Not an inreg extend!");
7120 if (EVT == VT) return N1; // Not actually extending
7134 if (ISD::isBuildVectorOfConstantSDNodes(N1.getNode())) {
7136 llvm::EVT OpVT = N1.getOperand(0).getValueType();
7138 SDValue Op = N1.getOperand(i);
7150 if (N1.getOpcode() == ISD::SPLAT_VECTOR &&
7151 isa<ConstantSDNode>(N1.getOperand(0)))
7154 SignExtendInReg(N1.getConstantOperandAPInt(0),
7155 N1.getOperand(0).getValueType()));
7161 N1.getValueType().isFloatingPoint() && "Invalid FP_TO_*INT_SAT");
7162 assert(N1.getValueType().isVector() == VT.isVector() &&
7166 N1.getValueType().getVectorElementCount()) &&
7175 assert(VT.getSizeInBits() >= N1.getValueType().getScalarSizeInBits() &&
7180 if (N1.isUndef() || N2.isUndef())
7186 if (N2C && N1.getValueType().isFixedLengthVector() &&
7187 N2C->getAPIntValue().uge(N1.getValueType().getVectorNumElements()))
7194 if (N2C && N1.getOpcode() == ISD::CONCAT_VECTORS &&
7195 N1.getOperand(0).getValueType().isFixedLengthVector()) {
7197 N1.getOperand(0).getValueType().getVectorNumElements();
7199 N1.getOperand(N2C->getZExtValue() / Factor),
7205 if (N2C && (N1.getOpcode() == ISD::BUILD_VECTOR ||
7206 N1.getOpcode() == ISD::SPLAT_VECTOR)) {
7207 assert((N1.getOpcode() != ISD::BUILD_VECTOR ||
7208 N1.getValueType().isFixedLengthVector()) &&
7211 N1.getOpcode() == ISD::BUILD_VECTOR ? N2C->getZExtValue() : 0;
7212 SDValue Elt = N1.getOperand(Index);
7225 if (N1.getOpcode() == ISD::INSERT_VECTOR_ELT) {
7229 SDValue N1Op2 = N1.getOperand(2);
7234 if (VT == N1.getOperand(1).getValueType())
7235 return N1.getOperand(1);
7237 assert(VT.getSizeInBits() > N1.getOperand(1).getValueType().getSizeInBits());
7238 return getFPExtendOrRound(N1.getOperand(1), DL, VT);
7240 return getSExtOrTrunc(N1.getOperand(1), DL, VT);
7242 return getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, N1.getOperand(0), N2);
7254 if (N1.getOpcode() == ISD::EXTRACT_SUBVECTOR &&
7255 N1.getValueType().isFixedLengthVector() &&
7256 N1.getValueType().getVectorNumElements() == 1) {
7257 return getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, N1.getOperand(0),
7258 N1.getOperand(1));
7263 assert(!N1.getValueType().isVector() && !VT.isVector() &&
7264 (N1.getValueType().isInteger() == VT.isInteger()) &&
7265 N1.getValueType() != VT &&
7271 if (N1.getOpcode() == ISD::BUILD_PAIR)
7272 return N1.getOperand(N2C->getZExtValue());
7283 EVT N1VT = N1.getValueType();
7304 return N1;
7307 if (N1.isUndef())
7312 if (N1.getOpcode() == ISD::CONCAT_VECTORS &&
7313 VT == N1.getOperand(0).getValueType()) {
7315 return N1.getOperand(N2C->getZExtValue() / Factor);
7320 if (N1.getOpcode() == ISD::INSERT_SUBVECTOR && N2 == N1.getOperand(2) &&
7321 VT == N1.getOperand(1).getValueType())
7322 return N1.getOperand(1);
7328 if (SDValue SV = FoldConstantArithmetic(Opcode, DL, VT, {N1, N2}, Flags))
7332 if (N1.isUndef()) {
7334 std::swap(N1, N2);
7355 if (N1.isUndef())
7382 SDValue Ops[] = {N1, N2};
7408 SDValue N1, SDValue N2, SDValue N3) {
7412 return getNode(Opcode, DL, VT, N1, N2, N3, Flags);
7416 SDValue N1, SDValue N2, SDValue N3,
7418 assert(N1.getOpcode() != ISD::DELETED_NODE &&
7427 assert(N1.getValueType() == VT && N2.getValueType() == VT &&
7429 ConstantFPSDNode *N1CFP = dyn_cast<ConstantFPSDNode>(N1);
7447 SDValue Ops[] = {N1, N2, N3};
7453 SDValue Ops[] = {N1, N2, N3};
7460 assert(N1.getValueType() == N2.getValueType() &&
7462 assert(VT.isVector() == N1.getValueType().isVector() &&
7465 N1.getValueType().getVectorElementCount()) &&
7468 if (SDValue V = FoldSetCC(VT, N1, N2, cast<CondCodeSDNode>(N3)->get(), DL))
7471 SDValue Ops[] = {N1, N2, N3};
7480 if (SDValue V = simplifySelect(N1, N2, N3))
7487 return N1;
7495 if (N3C && N1.getValueType().isFixedLengthVector() &&
7496 N3C->getZExtValue() >= N1.getValueType().getVectorNumElements())
7505 return N1;
7511 if (N1.isUndef() && N2.isUndef())
7515 assert(VT == N1.getValueType() &&
7542 if (N1.isUndef() && N2.getOpcode() == ISD::EXTRACT_SUBVECTOR &&
7549 if (N1.getValueType() == VT)
7550 return N1;
7556 if (N1.getValueType() == VT)
7557 return N1;
7560 [[maybe_unused]] EVT VecVT = N1.getValueType();
7570 if (N1.isUndef() || N2.isUndef())
7580 SDValue Ops[] = {N1, N2, N3};
7606 SDValue N1, SDValue N2, SDValue N3, SDValue N4) {
7607 SDValue Ops[] = { N1, N2, N3, N4 };
7612 SDValue N1, SDValue N2, SDValue N3, SDValue N4,
7614 SDValue Ops[] = { N1, N2, N3, N4, N5 };
10184 SDValue N1 = Ops[0], N2 = Ops[1];
10185 canonicalizeCommutativeBinop(Opcode, N1, N2);
10192 return getNode(ISD::MERGE_VALUES, DL, VTList, {N1, ZeroOverFlow}, Flags);
10198 SDValue F1 = getFreeze(N1);
10317 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
10324 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
10360 SDValue N1) {
10361 SDValue Ops[] = { N1 };
10366 SDValue N1, SDValue N2) {
10367 SDValue Ops[] = { N1, N2 };
10372 SDValue N1, SDValue N2, SDValue N3) {
10373 SDValue Ops[] = { N1, N2, N3 };
10378 SDValue N1, SDValue N2, SDValue N3, SDValue N4) {
10379 SDValue Ops[] = { N1, N2, N3, N4 };
10384 SDValue N1, SDValue N2, SDValue N3, SDValue N4,
10386 SDValue Ops[] = { N1, N2, N3, N4, N5 };
11174 SDValue N1 = N.getOperand(1);
11176 bool RHSConstant = isa<ConstantSDNode>(N1);
11216 SDDbgOperand::fromNode(N1.getNode(), N1.getResNo());