Lines Matching refs:VT

62 static const fltSemantics *EVTToAPFloatSemantics(EVT VT) {
63 switch (VT.getSimpleVT().SimpleTy) {
88 bool ConstantFPSDNode::isValueValidForType(EVT VT,
90 assert(VT.isFloatingPoint() && "Can only convert between FP types");
93 if (VT == MVT::ppcf128 ||
100 (void) Val2.convert(*EVTToAPFloatSemantics(VT), APFloat::rmNearestTiesToEven,
651 EVT VT = cast<VTSDNode>(N)->getVT();
652 if (VT.isExtended()) {
653 Erased = ExtendedValueTypeNodes.erase(VT);
655 Erased = ValueTypeNodes[VT.getSimpleVT().SimpleTy] != 0;
656 ValueTypeNodes[VT.getSimpleVT().SimpleTy] = 0;
773 EVT VT = N->getValueType(0);
775 assert(!VT.isVector() && (VT.isInteger() || VT.isFloatingPoint()) &&
780 assert(N->getOperand(0).getValueType().isInteger() == VT.isInteger() &&
782 assert(VT.getSizeInBits() == 2 * N->getOperand(0).getValueSizeInBits() &&
846 unsigned SelectionDAG::getEVTAlignment(EVT VT) const {
847 Type *Ty = VT == MVT::iPTR ?
849 VT.getTypeForEVT(*getContext());
902 SDValue SelectionDAG::getAnyExtOrTrunc(SDValue Op, DebugLoc DL, EVT VT) {
903 return VT.bitsGT(Op.getValueType()) ?
904 getNode(ISD::ANY_EXTEND, DL, VT, Op) :
905 getNode(ISD::TRUNCATE, DL, VT, Op);
908 SDValue SelectionDAG::getSExtOrTrunc(SDValue Op, DebugLoc DL, EVT VT) {
909 return VT.bitsGT(Op.getValueType()) ?
910 getNode(ISD::SIGN_EXTEND, DL, VT, Op) :
911 getNode(ISD::TRUNCATE, DL, VT, Op);
914 SDValue SelectionDAG::getZExtOrTrunc(SDValue Op, DebugLoc DL, EVT VT) {
915 return VT.bitsGT(Op.getValueType()) ?
916 getNode(ISD::ZERO_EXTEND, DL, VT, Op) :
917 getNode(ISD::TRUNCATE, DL, VT, Op);
920 SDValue SelectionDAG::getZeroExtendInReg(SDValue Op, DebugLoc DL, EVT VT) {
921 assert(!VT.isVector() &&
924 if (Op.getValueType() == VT) return Op;
927 VT.getSizeInBits());
934 SDValue SelectionDAG::getNOT(DebugLoc DL, SDValue Val, EVT VT) {
935 EVT EltVT = VT.getScalarType();
937 getConstant(APInt::getAllOnesValue(EltVT.getSizeInBits()), VT);
938 return getNode(ISD::XOR, DL, VT, Val, NegOne);
941 SDValue SelectionDAG::getConstant(uint64_t Val, EVT VT, bool isT) {
942 EVT EltVT = VT.getScalarType();
946 return getConstant(APInt(EltVT.getSizeInBits(), Val), VT, isT);
949 SDValue SelectionDAG::getConstant(const APInt &Val, EVT VT, bool isT) {
950 return getConstant(*ConstantInt::get(*Context, Val), VT, isT);
953 SDValue SelectionDAG::getConstant(const ConstantInt &Val, EVT VT, bool isT) {
954 assert(VT.isInteger() && "Cannot create FP integer constant!");
956 EVT EltVT = VT.getScalarType();
963 if (VT.isVector() && TLI.getTypeAction(*getContext(), EltVT) ==
979 if (!VT.isVector())
989 if (VT.isVector()) {
991 Ops.assign(VT.getVectorNumElements(), Result);
992 Result = getNode(ISD::BUILD_VECTOR, DebugLoc(), VT, &Ops[0], Ops.size());
1002 SDValue SelectionDAG::getConstantFP(const APFloat& V, EVT VT, bool isTarget) {
1003 return getConstantFP(*ConstantFP::get(*getContext(), V), VT, isTarget);
1006 SDValue SelectionDAG::getConstantFP(const ConstantFP& V, EVT VT, bool isTarget){
1007 assert(VT.isFloatingPoint() && "Cannot create integer FP constant!");
1009 EVT EltVT = VT.getScalarType();
1021 if (!VT.isVector())
1031 if (VT.isVector()) {
1033 Ops.assign(VT.getVectorNumElements(), Result);
1035 Result = getNode(ISD::BUILD_VECTOR, DebugLoc(), VT, &Ops[0], Ops.size());
1040 SDValue SelectionDAG::getConstantFP(double Val, EVT VT, bool isTarget) {
1041 EVT EltVT = VT.getScalarType();
1043 return getConstantFP(APFloat((float)Val), VT, isTarget);
1045 return getConstantFP(APFloat(Val), VT, isTarget);
1051 return getConstantFP(apf, VT, isTarget);
1057 EVT VT, int64_t Offset,
1083 AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
1091 SDNode *N = new (NodeAllocator) GlobalAddressSDNode(Opc, DL, GV, VT,
1098 SDValue SelectionDAG::getFrameIndex(int FI, EVT VT, bool isTarget) {
1101 AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
1107 SDNode *N = new (NodeAllocator) FrameIndexSDNode(FI, VT, isTarget);
1113 SDValue SelectionDAG::getJumpTable(int JTI, EVT VT, bool isTarget,
1119 AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
1126 SDNode *N = new (NodeAllocator) JumpTableSDNode(JTI, VT, isTarget,
1133 SDValue SelectionDAG::getConstantPool(const Constant *C, EVT VT,
1143 AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
1152 SDNode *N = new (NodeAllocator) ConstantPoolSDNode(isTarget, C, VT, Offset,
1160 SDValue SelectionDAG::getConstantPool(MachineConstantPoolValue *C, EVT VT,
1170 AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
1179 SDNode *N = new (NodeAllocator) ConstantPoolSDNode(isTarget, C, VT, Offset,
1200 SDValue SelectionDAG::getValueType(EVT VT) {
1201 if (VT.isSimple() && (unsigned)VT.getSimpleVT().SimpleTy >=
1203 ValueTypeNodes.resize(VT.getSimpleVT().SimpleTy+1);
1205 SDNode *&N = VT.isExtended() ?
1206 ExtendedValueTypeNodes[VT] : ValueTypeNodes[VT.getSimpleVT().SimpleTy];
1209 N = new (NodeAllocator) VTSDNode(VT);
1214 SDValue SelectionDAG::getExternalSymbol(const char *Sym, EVT VT) {
1217 N = new (NodeAllocator) ExternalSymbolSDNode(false, Sym, 0, VT);
1222 SDValue SelectionDAG::getTargetExternalSymbol(const char *Sym, EVT VT,
1228 N = new (NodeAllocator) ExternalSymbolSDNode(true, Sym, TargetFlags, VT);
1260 SDValue SelectionDAG::getVectorShuffle(EVT VT, DebugLoc dl, SDValue N1,
1263 assert(VT.isVector() && N1.getValueType().isVector() &&
1265 assert(VT.getVectorElementType() == N1.getValueType().getVectorElementType()
1270 return getUNDEF(VT);
1274 unsigned NElts = VT.getVectorNumElements();
1283 N2 = getUNDEF(VT);
1307 return getUNDEF(VT);
1309 N2 = getUNDEF(VT);
1311 N1 = getUNDEF(VT);
1325 return getUNDEF(VT);
1329 AddNodeIDNode(ID, ISD::VECTOR_SHUFFLE, getVTList(VT), Ops, 2);
1344 new (NodeAllocator) ShuffleVectorSDNode(VT, dl, N1, N2, MaskAlloc);
1350 SDValue SelectionDAG::getConvertRndSat(EVT VT, DebugLoc dl,
1362 AddNodeIDNode(ID, ISD::CONVERT_RNDSAT, getVTList(VT), &Ops[0], 5);
1367 CvtRndSatSDNode *N = new (NodeAllocator) CvtRndSatSDNode(VT, dl, Ops, 5,
1374 SDValue SelectionDAG::getRegister(unsigned RegNo, EVT VT) {
1376 AddNodeIDNode(ID, ISD::Register, getVTList(VT), 0, 0);
1382 SDNode *N = new (NodeAllocator) RegisterSDNode(RegNo, VT);
1418 SDValue SelectionDAG::getBlockAddress(const BlockAddress *BA, EVT VT,
1424 AddNodeIDNode(ID, Opc, getVTList(VT), 0, 0);
1431 SDNode *N = new (NodeAllocator) BlockAddressSDNode(Opc, VT, BA, TargetFlags);
1485 SDValue SelectionDAG::CreateStackTemporary(EVT VT, unsigned minAlign) {
1487 unsigned ByteSize = VT.getStoreSize();
1488 Type *Ty = VT.getTypeForEVT(*getContext());
1512 SDValue SelectionDAG::FoldSetCC(EVT VT, SDValue N1,
1518 case ISD::SETFALSE2: return getConstant(0, VT);
1520 case ISD::SETTRUE2: return getConstant(1, VT);
1543 case ISD::SETEQ: return getConstant(C1 == C2, VT);
1544 case ISD::SETNE: return getConstant(C1 != C2, VT);
1545 case ISD::SETULT: return getConstant(C1.ult(C2), VT);
1546 case ISD::SETUGT: return getConstant(C1.ugt(C2), VT);
1547 case ISD::SETULE: return getConstant(C1.ule(C2), VT);
1548 case ISD::SETUGE: return getConstant(C1.uge(C2), VT);
1549 case ISD::SETLT: return getConstant(C1.slt(C2), VT);
1550 case ISD::SETGT: return getConstant(C1.sgt(C2), VT);
1551 case ISD::SETLE: return getConstant(C1.sle(C2), VT);
1552 case ISD::SETGE: return getConstant(C1.sge(C2), VT);
1566 return getUNDEF(VT);
1568 case ISD::SETOEQ: return getConstant(R==APFloat::cmpEqual, VT);
1570 return getUNDEF(VT);
1573 R==APFloat::cmpLessThan, VT);
1575 return getUNDEF(VT);
1577 case ISD::SETOLT: return getConstant(R==APFloat::cmpLessThan, VT);
1579 return getUNDEF(VT);
1581 case ISD::SETOGT: return getConstant(R==APFloat::cmpGreaterThan, VT);
1583 return getUNDEF(VT);
1586 R==APFloat::cmpEqual, VT);
1588 return getUNDEF(VT);
1591 R==APFloat::cmpEqual, VT);
1592 case ISD::SETO: return getConstant(R!=APFloat::cmpUnordered, VT);
1593 case ISD::SETUO: return getConstant(R==APFloat::cmpUnordered, VT);
1595 R==APFloat::cmpEqual, VT);
1596 case ISD::SETUNE: return getConstant(R!=APFloat::cmpEqual, VT);
1598 R==APFloat::cmpLessThan, VT);
1600 R==APFloat::cmpUnordered, VT);
1601 case ISD::SETULE: return getConstant(R!=APFloat::cmpGreaterThan, VT);
1602 case ISD::SETUGE: return getConstant(R!=APFloat::cmpLessThan, VT);
1606 return getSetCC(dl, VT, N2, N1, ISD::getSetCCSwappedOperands(Cond));
1880 EVT VT = LD->getMemoryVT();
1881 unsigned MemBits = VT.getScalarType().getSizeInBits();
1948 EVT VT = cast<VTSDNode>(Op.getOperand(1))->getVT();
1949 APInt InMask = APInt::getLowBitsSet(BitWidth, VT.getSizeInBits());
2085 EVT VT = Op.getValueType();
2086 assert(VT.isInteger() && "Invalid VT!");
2087 unsigned VTBits = VT.getScalarType().getSizeInBits();
2361 SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT) {
2363 AddNodeIDNode(ID, Opcode, getVTList(VT), 0, 0);
2368 SDNode *N = new (NodeAllocator) SDNode(Opcode, DL, getVTList(VT));
2379 EVT VT, SDValue Operand) {
2386 return getConstant(Val.sextOrTrunc(VT.getSizeInBits()), VT);
2390 return getConstant(Val.zextOrTrunc(VT.getSizeInBits()), VT);
2394 if (VT == MVT::ppcf128) break;
2395 APFloat apf(APInt::getNullValue(VT.getSizeInBits()));
2399 return getConstantFP(apf, VT);
2402 if (VT == MVT::f32 && C->getValueType(0) == MVT::i32)
2403 return getConstantFP(Val.bitsToFloat(), VT);
2404 else if (VT == MVT::f64 && C->getValueType(0) == MVT::i64)
2405 return getConstantFP(Val.bitsToDouble(), VT);
2408 return getConstant(Val.byteSwap(), VT);
2410 return getConstant(Val.countPopulation(), VT);
2413 return getConstant(Val.countLeadingZeros(), VT);
2416 return getConstant(Val.countTrailingZeros(), VT);
2423 if (VT != MVT::ppcf128 && Operand.getValueType() != MVT::ppcf128) {
2427 return getConstantFP(V, VT);
2430 return getConstantFP(V, VT);
2435 (void)V.convert(*EVTToAPFloatSemantics(VT),
2437 return getConstantFP(V, VT);
2445 APFloat::opStatus s = V.convertToInteger(x, VT.getSizeInBits(),
2450 APInt api(VT.getSizeInBits(), x);
2451 return getConstant(api, VT);
2454 if (VT == MVT::i32 && C->getValueType(0) == MVT::f32)
2455 return getConstant((uint32_t)V.bitcastToAPInt().getZExtValue(), VT);
2456 else if (VT == MVT::i64 && C->getValueType(0) == MVT::f64)
2457 return getConstant(V.bitcastToAPInt().getZExtValue(), VT);
2471 assert(VT.isFloatingPoint() &&
2473 if (Operand.getValueType() == VT) return Operand; // noop conversion.
2474 assert((!VT.isVector() ||
2475 VT.getVectorNumElements() ==
2479 return getUNDEF(VT);
2482 assert(VT.isInteger() && Operand.getValueType().isInteger() &&
2484 if (Operand.getValueType() == VT) return Operand; // noop extension
2485 assert(Operand.getValueType().getScalarType().bitsLT(VT.getScalarType()) &&
2487 assert((!VT.isVector() ||
2488 VT.getVectorNumElements() ==
2492 return getNode(OpOpcode, DL, VT, Operand.getNode()->getOperand(0));
2495 return getConstant(0, VT);
2498 assert(VT.isInteger() && Operand.getValueType().isInteger() &&
2500 if (Operand.getValueType() == VT) return Operand; // noop extension
2501 assert(Operand.getValueType().getScalarType().bitsLT(VT.getScalarType()) &&
2503 assert((!VT.isVector() ||
2504 VT.getVectorNumElements() ==
2508 return getNode(ISD::ZERO_EXTEND, DL, VT,
2512 return getConstant(0, VT);
2515 assert(VT.isInteger() && Operand.getValueType().isInteger() &&
2517 if (Operand.getValueType() == VT) return Operand; // noop extension
2518 assert(Operand.getValueType().getScalarType().bitsLT(VT.getScalarType()) &&
2520 assert((!VT.isVector() ||
2521 VT.getVectorNumElements() ==
2528 return getNode(OpOpcode, DL, VT, Operand.getNode()->getOperand(0));
2530 return getUNDEF(VT);
2535 if (OpOp.getValueType() == VT)
2540 assert(VT.isInteger() && Operand.getValueType().isInteger() &&
2542 if (Operand.getValueType() == VT) return Operand; // noop truncate
2543 assert(Operand.getValueType().getScalarType().bitsGT(VT.getScalarType()) &&
2545 assert((!VT.isVector() ||
2546 VT.getVectorNumElements() ==
2550 return getNode(ISD::TRUNCATE, DL, VT, Operand.getNode()->getOperand(0));
2555 .bitsLT(VT.getScalarType()))
2556 return getNode(OpOpcode, DL, VT, Operand.getNode()->getOperand(0));
2557 if (Operand.getNode()->getOperand(0).getValueType().bitsGT(VT))
2558 return getNode(ISD::TRUNCATE, DL, VT, Operand.getNode()->getOperand(0));
2562 return getUNDEF(VT);
2566 assert(VT.getSizeInBits() == Operand.getValueType().getSizeInBits()
2568 if (VT == Operand.getValueType()) return Operand; // noop conversion.
2570 return getNode(ISD::BITCAST, DL, VT, Operand.getOperand(0));
2572 return getUNDEF(VT);
2575 assert(VT.isVector() && !Operand.getValueType().isVector() &&
2576 (VT.getVectorElementType() == Operand.getValueType() ||
2577 (VT.getVectorElementType().isInteger() &&
2579 VT.getVectorElementType().bitsLE(Operand.getValueType()))) &&
2582 return getUNDEF(VT);
2587 Operand.getOperand(0).getValueType() == VT)
2593 return getNode(ISD::FSUB, DL, VT, Operand.getNode()->getOperand(1),
2600 return getNode(ISD::FABS, DL, VT, Operand.getNode()->getOperand(0));
2605 SDVTList VTs = getVTList(VT);
2606 if (VT != MVT::Glue) { // Don't CSE flag producing nodes
2628 EVT VT,
2634 case ISD::ADD: return getConstant(C1 + C2, VT);
2635 case ISD::SUB: return getConstant(C1 - C2, VT);
2636 case ISD::MUL: return getConstant(C1 * C2, VT);
2638 if (C2.getBoolValue()) return getConstant(C1.udiv(C2), VT);
2641 if (C2.getBoolValue()) return getConstant(C1.urem(C2), VT);
2644 if (C2.getBoolValue()) return getConstant(C1.sdiv(C2), VT);
2647 if (C2.getBoolValue()) return getConstant(C1.srem(C2), VT);
2649 case ISD::AND: return getConstant(C1 & C2, VT);
2650 case ISD::OR: return getConstant(C1 | C2, VT);
2651 case ISD::XOR: return getConstant(C1 ^ C2, VT);
2652 case ISD::SHL: return getConstant(C1 << C2, VT);
2653 case ISD::SRL: return getConstant(C1.lshr(C2), VT);
2654 case ISD::SRA: return getConstant(C1.ashr(C2), VT);
2655 case ISD::ROTL: return getConstant(C1.rotl(C2), VT);
2656 case ISD::ROTR: return getConstant(C1.rotr(C2), VT);
2663 SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
2670 assert(VT == MVT::Other && N1.getValueType() == MVT::Other &&
2685 return getNode(ISD::BUILD_VECTOR, DL, VT, &Elts[0], Elts.size());
2689 assert(VT.isInteger() && "This operator does not apply to FP types!");
2691 N1.getValueType() == VT && "Binary operator types must match!");
2703 assert(VT.isInteger() && "This operator does not apply to FP types!");
2705 N1.getValueType() == VT && "Binary operator types must match!");
2718 assert(VT.isInteger() && "This operator does not apply to FP types!");
2720 N1.getValueType() == VT && "Binary operator types must match!");
2744 assert(VT.isFloatingPoint() && "This operator only applies to FP types!");
2746 N1.getValueType() == VT && "Binary operator types must match!");
2749 assert(N1.getValueType() == VT &&
2759 assert(VT == N1.getValueType() &&
2761 assert(VT.isInteger() && N2.getValueType().isInteger() &&
2763 // Verify that the shift amount VT is bit enough to hold valid shift
2774 if (VT == MVT::i1)
2781 assert(VT == N1.getValueType() && "Not an inreg round!");
2782 assert(VT.isFloatingPoint() && EVT.isFloatingPoint() &&
2784 assert(EVT.isVector() == VT.isVector() &&
2788 EVT.getVectorNumElements() == VT.getVectorNumElements()) &&
2790 assert(EVT.bitsLE(VT) && "Not rounding down!");
2792 if (cast<VTSDNode>(N2)->getVT() == VT) return N1; // Not actually rounding.
2796 assert(VT.isFloatingPoint() &&
2798 VT.bitsLE(N1.getValueType()) &&
2800 if (N1.getValueType() == VT) return N1; // noop conversion.
2805 assert(VT == N1.getValueType() && "Not an inreg extend!");
2806 assert(VT.isInteger() && EVT.isInteger() &&
2811 assert(EVT.bitsLE(VT) && "Not extending!");
2812 if (VT == EVT) return N1; // noop assertion.
2817 assert(VT == N1.getValueType() && "Not an inreg extend!");
2818 assert(VT.isInteger() && EVT.isInteger() &&
2820 assert(EVT.isVector() == VT.isVector() &&
2824 EVT.getVectorNumElements() == VT.getVectorNumElements()) &&
2826 assert(EVT.bitsLE(VT) && "Not extending!");
2827 if (EVT == VT) return N1; // Not actually extending
2834 return getConstant(Val, VT);
2841 return getUNDEF(VT);
2850 return getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT,
2866 if (VT != VEltTy) {
2869 Elt = getNode(ISD::ANY_EXTEND, DL, VT, Elt);
2885 if (VT == N1.getOperand(1).getValueType())
2888 return getSExtOrTrunc(N1.getOperand(1), DL, VT);
2891 return getNode(ISD::EXTRACT_VECTOR_ELT, DL, VT, N1.getOperand(0), N2);
2897 assert(!N1.getValueType().isVector() && !VT.isVector() &&
2898 (N1.getValueType().isInteger() == VT.isInteger()) &&
2899 N1.getValueType() != VT &&
2910 unsigned ElementSize = VT.getSizeInBits();
2913 return getConstant(ShiftedVal.trunc(ElementSize), VT);
2918 if (VT.isSimple() && N1.getValueType().isSimple()) {
2919 assert(VT.isVector() && N1.getValueType().isVector() &&
2921 assert(VT.getVectorElementType() == N1.getValueType().getVectorElementType() &&
2923 assert(VT.getSimpleVT() <= N1.getValueType().getSimpleVT() &&
2927 assert((VT.getVectorNumElements() +
2934 if (VT.getSimpleVT() == N1.getValueType().getSimpleVT())
2943 SDValue SV = FoldConstantArithmetic(Opcode, VT, N1C, N2C);
2961 } else if (N2CFP && VT != MVT::ppcf128) {
2968 return getConstantFP(V1, VT);
2973 return getConstantFP(V1, VT);
2978 return getConstantFP(V1, VT);
2983 return getConstantFP(V1, VT);
2988 return getConstantFP(V1, VT);
2992 return getConstantFP(V1, VT);
3002 (void)V.convert(*EVTToAPFloatSemantics(VT),
3004 return getConstantFP(V, VT);
3028 if (!VT.isVector())
3029 return getConstant(0, VT); // fold op(undef, arg2) -> 0
3044 return getConstant(0, VT);
3067 if (!VT.isVector())
3068 return getConstant(0, VT); // fold op(arg1, undef) -> 0
3073 if (!VT.isVector())
3074 return getConstant(APInt::getAllOnesValue(VT.getSizeInBits()), VT);
3085 SDVTList VTs = getVTList(VT);
3086 if (VT != MVT::Glue) {
3107 SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
3122 return getNode(ISD::BUILD_VECTOR, DL, VT, &Elts[0], Elts.size());
3127 SDValue Simp = FoldSetCC(VT, N1, N2, cast<CondCodeSDNode>(N3)->get(), DL);
3144 if (VT.isSimple() && N1.getValueType().isSimple()
3146 assert(VT.isVector() && N1.getValueType().isVector() &&
3149 assert(VT == N1.getValueType() &&
3156 <= VT.getVectorNumElements())
3161 if (VT.getSimpleVT() == N2.getValueType().getSimpleVT())
3168 if (N1.getValueType() == VT)
3175 SDVTList VTs = getVTList(VT);
3176 if (VT != MVT::Glue) {
3197 SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
3201 return getNode(Opcode, DL, VT, Ops, 4);
3204 SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
3208 return getNode(Opcode, DL, VT, Ops, 5);
3247 static SDValue getMemsetValue(SDValue Value, EVT VT, SelectionDAG &DAG,
3251 unsigned NumBits = VT.getScalarType().getSizeInBits();
3254 if (VT.isInteger())
3255 return DAG.getConstant(Val, VT);
3256 return DAG.getConstantFP(APFloat(Val), VT);
3259 Value = DAG.getNode(ISD::ZERO_EXTEND, dl, VT, Value);
3264 Value = DAG.getNode(ISD::MUL, dl, VT, Value, DAG.getConstant(Magic, VT));
3273 static SDValue getMemsetStringVal(EVT VT, DebugLoc dl, SelectionDAG &DAG,
3277 if (VT.isInteger())
3278 return DAG.getConstant(0, VT);
3279 else if (VT == MVT::f32 || VT == MVT::f64)
3280 return DAG.getConstantFP(0.0, VT);
3281 else if (VT.isVector()) {
3282 unsigned NumElts = VT.getVectorNumElements();
3283 MVT EltVT = (VT.getVectorElementType() == MVT::f32) ? MVT::i32 : MVT::i64;
3284 return DAG.getNode(ISD::BITCAST, dl, VT,
3291 assert(!VT.isVector() && "Can't handle vector type here!");
3292 unsigned NumVTBytes = VT.getSizeInBits() / 8;
3304 return DAG.getConstant(Val, VT);
3311 EVT VT = Base.getValueType();
3313 VT, Base, DAG.getConstant(Offset, VT));
3355 EVT VT = TLI.getOptimalMemOpType(Size, DstAlign, SrcAlign,
3359 if (VT == MVT::Other) {
3361 TLI.allowsUnalignedMemoryAccesses(VT)) {
3362 VT = TLI.getPointerTy();
3365 case 0: VT = MVT::i64; break;
3366 case 4: VT = MVT::i32; break;
3367 case 2: VT = MVT::i16; break;
3368 default: VT = MVT::i8; break;
3377 if (VT.bitsGT(LVT))
3378 VT = LVT;
3383 unsigned VTSize = VT.getSizeInBits() / 8;
3386 if (VT.isVector() || VT.isFloatingPoint()) {
3387 VT = MVT::i64;
3388 while (!TLI.isTypeLegal(VT))
3389 VT = (MVT::SimpleValueType)(VT.getSimpleVT().SimpleTy - 1);
3390 VTSize = VT.getSizeInBits() / 8;
3394 VT = (MVT::SimpleValueType)(VT.getSimpleVT().SimpleTy - 1);
3401 MemOps.push_back(VT);
3461 EVT VT = MemOps[i];
3462 unsigned VTSize = VT.getSizeInBits() / 8;
3466 (isZeroStr || (VT.isInteger() && !VT.isVector()))) {
3472 Value = getMemsetStringVal(VT, dl, DAG, TLI, Str.substr(SrcOff));
3481 // to Load/Store if NVT==VT.
3483 EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
3484 assert(NVT.bitsGE(VT));
3487 SrcPtrInfo.getWithOffset(SrcOff), VT, isVol, false,
3491 DstPtrInfo.getWithOffset(DstOff), VT, isVol,
3552 EVT VT = MemOps[i];
3553 unsigned VTSize = VT.getSizeInBits() / 8;
3556 Value = DAG.getLoad(VT, dl, Chain,
3568 EVT VT = MemOps[i];
3569 unsigned VTSize = VT.getSizeInBits() / 8;
3633 EVT VT = MemOps[i];
3638 if (VT.bitsLT(LargestVT)) {
3639 if (!LargestVT.isVector() && !VT.isVector() &&
3640 TLI.isTruncateFree(LargestVT, VT))
3641 Value = DAG.getNode(ISD::TRUNCATE, dl, VT, MemSetValue);
3643 Value = getMemsetValue(Src, VT, DAG, dl);
3645 assert(Value.getValueType() == VT && "Value with wrong type.");
3651 DstOff += VT.getSizeInBits() / 8;
3870 EVT VT = Cmp.getValueType();
3872 SDVTList VTs = getVTList(VT, MVT::Other);
3941 EVT VT = Val.getValueType();
3944 getVTList(VT, MVT::Other);
3963 EVT VT, SDValue Chain,
3988 return getAtomic(Opcode, dl, MemVT, VT, Chain, Ptr, MMO,
3993 EVT VT, SDValue Chain,
4000 SDVTList VTs = getVTList(VT, MVT::Other);
4135 EVT VT, DebugLoc dl, SDValue Chain,
4144 Alignment = getEVTAlignment(VT);
4163 return getLoad(AM, ExtType, VT, dl, Chain, Ptr, Offset, MemVT, MMO);
4168 EVT VT, DebugLoc dl, SDValue Chain,
4171 if (VT == MemVT) {
4174 assert(VT == MemVT && "Non-extending load from different memory type!");
4177 assert(MemVT.getScalarType().bitsLT(VT.getScalarType()) &&
4179 assert(VT.isInteger() == MemVT.isInteger() &&
4181 assert(VT.isVector() == MemVT.isVector() &&
4183 assert((!VT.isVector() ||
4184 VT.getVectorNumElements() == MemVT.getVectorNumElements()) &&
4193 getVTList(VT, Ptr.getValueType(), MVT::Other) : getVTList(VT, MVT::Other);
4213 SDValue SelectionDAG::getLoad(EVT VT, DebugLoc dl,
4221 return getLoad(ISD::UNINDEXED, ISD::NON_EXTLOAD, VT, dl, Chain, Ptr, Undef,
4222 PtrInfo, VT, isVolatile, isNonTemporal, isInvariant, Alignment,
4226 SDValue SelectionDAG::getExtLoad(ISD::LoadExtType ExtType, DebugLoc dl, EVT VT,
4232 return getLoad(ISD::UNINDEXED, ExtType, VT, dl, Chain, Ptr, Undef,
4281 EVT VT = Val.getValueType();
4287 ID.AddInteger(VT.getRawBits());
4296 false, VT, MMO);
4332 EVT VT = Val.getValueType();
4336 if (VT == SVT)
4339 assert(SVT.getScalarType().bitsLT(VT.getScalarType()) &&
4341 assert(VT.isInteger() == SVT.isInteger() &&
4343 assert(VT.isVector() == SVT.isVector() &&
4345 assert((!VT.isVector() ||
4346 VT.getVectorNumElements() == SVT.getVectorNumElements()) &&
4394 SDValue SelectionDAG::getVAArg(EVT VT, DebugLoc dl,
4399 return getNode(ISD::VAARG, dl, getVTList(VT, MVT::Other), Ops, 4);
4402 SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
4405 case 0: return getNode(Opcode, DL, VT);
4406 case 1: return getNode(Opcode, DL, VT, Ops[0]);
4407 case 2: return getNode(Opcode, DL, VT, Ops[0], Ops[1]);
4408 case 3: return getNode(Opcode, DL, VT, Ops[0], Ops[1], Ops[2]);
4415 return getNode(Opcode, DL, VT, &NewOps[0], NumOps);
4418 SDValue SelectionDAG::getNode(unsigned Opcode, DebugLoc DL, EVT VT,
4421 case 0: return getNode(Opcode, DL, VT);
4422 case 1: return getNode(Opcode, DL, VT, Ops[0]);
4423 case 2: return getNode(Opcode, DL, VT, Ops[0], Ops[1]);
4424 case 3: return getNode(Opcode, DL, VT, Ops[0], Ops[1], Ops[2]);
4436 assert(Ops[2].getValueType() == VT &&
4450 SDVTList VTs = getVTList(VT);
4452 if (VT != MVT::Glue) {
4503 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
4508 unsigned NumBits = VT.getScalarType().getSizeInBits()*2;
4510 return getNode(Opcode, DL, VT, N1, N2, N3.getOperand(0));
4591 SDVTList SelectionDAG::getVTList(EVT VT) {
4592 return makeVTList(SDNode::getValueTypeList(VT), 1);
4805 EVT VT) {
4806 SDVTList VTs = getVTList(VT);
4811 EVT VT, SDValue Op1) {
4812 SDVTList VTs = getVTList(VT);
4818 EVT VT, SDValue Op1,
4820 SDVTList VTs = getVTList(VT);
4826 EVT VT, SDValue Op1,
4828 SDVTList VTs = getVTList(VT);
4834 EVT VT, const SDValue *Ops,
4836 SDVTList VTs = getVTList(VT);
5022 SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT) {
5023 SDVTList VTs = getVTList(VT);
5028 SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT, SDValue Op1) {
5029 SDVTList VTs = getVTList(VT);
5035 SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
5037 SDVTList VTs = getVTList(VT);
5043 SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
5045 SDVTList VTs = getVTList(VT);
5051 SelectionDAG::getMachineNode(unsigned Opcode, DebugLoc dl, EVT VT,
5053 SDVTList VTs = getVTList(VT);
5181 SelectionDAG::getTargetExtractSubreg(int SRIdx, DebugLoc DL, EVT VT,
5185 VT, Operand, SRIdxVal);
5192 SelectionDAG::getTargetInsertSubreg(int SRIdx, DebugLoc DL, EVT VT,
5196 VT, Operand, Subreg, SRIdxVal);
5686 EVT VT, int64_t o, unsigned char TF)
5687 : SDNode(Opc, DL, getSDVTList(VT)), Offset(o), TargetFlags(TF) {
5737 const EVT *SDNode::getValueTypeList(EVT VT) {
5738 if (VT.isExtended()) {
5740 return &(*EVTs->insert(VT).first);
5742 assert(VT.getSimpleVT() < MVT::LAST_VALUETYPE &&
5744 return &SimpleVTArray->VTs[VT.getSimpleVT().SimpleTy];
5888 EVT VT = N->getValueType(0);
5889 unsigned NE = VT.getVectorNumElements();
5890 EVT EltVT = VT.getVectorElementType();
5964 EVT VT = LD->getValueType(0);
5965 if (VT.getSizeInBits() / 8 != Bytes)
6057 EVT VT = getValueType(0);
6058 assert(VT.isVector() && "Expected a vector type");
6059 unsigned sz = VT.getSizeInBits();
6072 unsigned EltBitSize = VT.getVectorElementType().getSizeInBits();
6117 bool ShuffleVectorSDNode::isSplatMask(const int *Mask, EVT VT) {
6120 for (i = 0, e = VT.getVectorNumElements(); i != e && Mask[i] < 0; ++i)