mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 16:33:28 +00:00
Fix constant folding of FP->int due to cut & paste error in last commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32447 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6a126513fc
commit
8c4fed50e3
@ -983,9 +983,10 @@ Constant *llvm::ConstantFoldCastInstruction(unsigned opc, const Constant *V,
|
|||||||
if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) {
|
if (const ConstantFP *FP = dyn_cast<ConstantFP>(V)) {
|
||||||
// FP -> Integral.
|
// FP -> Integral.
|
||||||
if (DestTy->isIntegral()) {
|
if (DestTy->isIntegral()) {
|
||||||
if (DestTy == Type::FloatTy)
|
if (DestTy == Type::IntTy || DestTy == Type::UIntTy)
|
||||||
return ConstantInt::get(DestTy, FloatToBits(FP->getValue()));
|
return ConstantInt::get(DestTy, FloatToBits(FP->getValue()));
|
||||||
assert(DestTy == Type::DoubleTy && "Unknown FP type!");
|
assert((DestTy == Type::LongTy || DestTy == Type::ULongTy)
|
||||||
|
&& "Incorrect integer type for bitcast!");
|
||||||
return ConstantInt::get(DestTy, DoubleToBits(FP->getValue()));
|
return ConstantInt::get(DestTy, DoubleToBits(FP->getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user