summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-09-16 16:51:49 +0000
committerDale Johannesen <dalej@apple.com>2007-09-16 16:51:49 +0000
commit7f724e9b94e0069a41419d109ff13c4ea2b26cf7 (patch)
tree8bcf2d479a38fae12fa115458d668b568ef1d2d5 /llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
parent2f742085f51fb2c63b1ab65ce155f3d73c5e0c20 (diff)
downloadbcm5719-llvm-7f724e9b94e0069a41419d109ff13c4ea2b26cf7.tar.gz
bcm5719-llvm-7f724e9b94e0069a41419d109ff13c4ea2b26cf7.zip
Adjust per revew comments.
llvm-svn: 42002
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
index d709169d351..c4290c8aa50 100644
--- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp
@@ -486,12 +486,7 @@ static SDOperand ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP,
// double.
MVT::ValueType VT = CFP->getValueType(0);
bool isDouble = VT == MVT::f64;
- ConstantFP *LLVMC = ConstantFP::get(VT==MVT::f64 ? Type::DoubleTy :
- VT==MVT::f32 ? Type::FloatTy :
- VT==MVT::f80 ? Type::X86_FP80Ty :
- VT==MVT::f128 ? Type::FP128Ty :
- VT==MVT::ppcf128 ? Type::PPC_FP128Ty :
- Type::VoidTy, // error
+ ConstantFP *LLVMC = ConstantFP::get(MVT::getTypeForValueType(VT),
CFP->getValueAPF());
if (!UseCP) {
if (VT!=MVT::f64 && VT!=MVT::f32)
@@ -4620,12 +4615,9 @@ ExpandIntToFP(bool isSigned, MVT::ValueType DestTy, SDOperand Source) {
SDOperand FudgeInReg;
if (DestTy == MVT::f32)
FudgeInReg = DAG.getLoad(MVT::f32, DAG.getEntryNode(), CPIdx, NULL, 0);
- else if (DestTy == MVT::f64)
+ else if (MVT::getSizeInBits(DestTy) > MVT::getSizeInBits(MVT::f32))
// FIXME: Avoid the extend by construction the right constantpool?
- FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, MVT::f64, DAG.getEntryNode(),
- CPIdx, NULL, 0, MVT::f32);
- else if (DestTy == MVT::f80)
- FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, MVT::f80, DAG.getEntryNode(),
+ FudgeInReg = DAG.getExtLoad(ISD::EXTLOAD, DestTy, DAG.getEntryNode(),
CPIdx, NULL, 0, MVT::f32);
else
assert(0 && "Unexpected conversion");
@@ -4737,11 +4729,10 @@ SDOperand SelectionDAGLegalize::ExpandLegalINT_TO_FP(bool isSigned,
if (DestVT == MVT::f64) {
// do nothing
Result = Sub;
- } else if (DestVT == MVT::f32) {
- // if f32 then cast to f32
- Result = DAG.getNode(ISD::FP_ROUND, MVT::f32, Sub);
- } else if (DestVT == MVT::f80) {
- Result = DAG.getNode(ISD::FP_EXTEND, MVT::f80, Sub);
+ } else if (MVT::getSizeInBits(DestVT) < MVT::getSizeInBits(MVT::f64)) {
+ Result = DAG.getNode(ISD::FP_ROUND, DestVT, Sub);
+ } else if (MVT::getSizeInBits(DestVT) > MVT::getSizeInBits(MVT::f64)) {
+ Result = DAG.getNode(ISD::FP_EXTEND, DestVT, Sub);
}
return Result;
}
OpenPOWER on IntegriCloud