Lines Matching defs:DestTy
69 static Constant *FoldBitCast(Constant *V, Type *DestTy) {
71 if (SrcTy == DestTy)
75 return Constant::getAllOnesValue(DestTy);
82 if (isa<VectorType>(DestTy) && !isa<VectorType>(SrcTy))
83 return ConstantExpr::getBitCast(ConstantVector::get(V), DestTy);
87 if (!DestTy->isFPOrFPVectorTy() || DestTy->isPPC_FP128Ty() ||
88 DestTy->getScalarSizeInBits() != SrcTy->getScalarSizeInBits())
92 DestTy,
93 APFloat(DestTy->getScalarType()->getFltSemantics(), CI->getValue()));
101 if (isa<VectorType>(DestTy) && !isa<VectorType>(SrcTy))
102 return ConstantExpr::getBitCast(ConstantVector::get(V), DestTy);
114 if (!DestTy->isIntOrIntVectorTy() ||
115 DestTy->getScalarSizeInBits() != SrcTy->getScalarSizeInBits())
118 return ConstantInt::get(DestTy, FP->getValueAPF().bitcastToAPInt());
125 Type *DestTy) {
127 ? ConstantExpr::getCast(opc, V, DestTy)
128 : ConstantFoldCastInstruction(opc, V, DestTy);
132 Type *DestTy) {
134 return PoisonValue::get(DestTy);
142 return Constant::getNullValue(DestTy);
143 return UndefValue::get(DestTy);
146 if (V->isNullValue() && !DestTy->isX86_AMXTy() &&
148 return Constant::getNullValue(DestTy);
155 if (unsigned newOpc = foldConstantCastPair(opc, CE, DestTy))
156 return foldMaybeUndesirableCast(newOpc, CE->getOperand(0), DestTy);
164 DestTy->isVectorTy() &&
165 cast<FixedVectorType>(DestTy)->getNumElements() ==
167 VectorType *DestVecTy = cast<VectorType>(DestTy);
175 cast<VectorType>(DestTy)->getElementCount(), Res);
201 Val.convert(DestTy->getScalarType()->getFltSemantics(),
203 return ConstantFP::get(DestTy, Val);
211 APSInt IntVal(DestTy->getScalarSizeInBits(), opc == Instruction::FPToUI);
216 return PoisonValue::get(DestTy);
218 return ConstantInt::get(DestTy, IntVal);
225 APFloat apf(DestTy->getScalarType()->getFltSemantics(),
226 APInt::getZero(DestTy->getScalarSizeInBits()));
229 return ConstantFP::get(DestTy, apf);
234 uint32_t BitWidth = DestTy->getScalarSizeInBits();
235 return ConstantInt::get(DestTy, CI->getValue().zext(BitWidth));
240 uint32_t BitWidth = DestTy->getScalarSizeInBits();
241 return ConstantInt::get(DestTy, CI->getValue().sext(BitWidth));
246 uint32_t BitWidth = DestTy->getScalarSizeInBits();
247 return ConstantInt::get(DestTy, CI->getValue().trunc(BitWidth));
253 return FoldBitCast(V, DestTy);