if (SrcEltTy->getTypeID() == Type::DoubleTyID) {
for (unsigned i = 0; i != SrcNumElts; ++i) {
- uint64_t V = *cast<ConstantFP>(CV->getOperand(i))->
- getValueAPF().convertToAPInt().getRawData();
+ uint64_t V = cast<ConstantFP>(CV->getOperand(i))->
+ getValueAPF().convertToAPInt().getZExtValue();
Constant *C = ConstantInt::get(Type::Int64Ty, V);
Result.push_back(ConstantExpr::getBitCast(C, DstEltTy ));
}
assert(SrcEltTy->getTypeID() == Type::FloatTyID);
for (unsigned i = 0; i != SrcNumElts; ++i) {
- uint32_t V = (uint32_t)*cast<ConstantFP>(CV->getOperand(i))->
- getValueAPF().convertToAPInt().getRawData();
+ uint32_t V = (uint32_t)cast<ConstantFP>(CV->getOperand(i))->
+ getValueAPF().convertToAPInt().getZExtValue();
Constant *C = ConstantInt::get(Type::Int32Ty, V);
Result.push_back(ConstantExpr::getBitCast(C, DstEltTy));
}
return const_cast<Constant*>(V);
if (DestTy->isFloatingPoint()) {
- if (DestTy == Type::FloatTy)
- return ConstantFP::get(DestTy, APFloat(CI->getValue()));
- assert(DestTy == Type::DoubleTy && "Unknown FP type!");
+ assert((DestTy == Type::DoubleTy || DestTy == Type::FloatTy) &&
+ "Unknown FP type!");
return ConstantFP::get(DestTy, APFloat(CI->getValue()));
}
// Otherwise, can't fold this (vector?)