aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/SelectionDAG
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2010-05-07 21:35:53 +0000
committerDale Johannesen <dalej@apple.com>2010-05-07 21:35:53 +0000
commit6a11bccbdc8ea01d75400341046cc1b8b2f482b1 (patch)
treea2f28e5284f7cd9295f83072a364ee68a798b185 /lib/CodeGen/SelectionDAG
parent9c371c62fee60d6fcd700c6f6099d8990c5441dc (diff)
downloadexternal_llvm-6a11bccbdc8ea01d75400341046cc1b8b2f482b1.zip
external_llvm-6a11bccbdc8ea01d75400341046cc1b8b2f482b1.tar.gz
external_llvm-6a11bccbdc8ea01d75400341046cc1b8b2f482b1.tar.bz2
Fix PR 7087, and probably other things, by extending
getConstantFP to accept the two supported long double target types. This was not the original intent, but there are other places that assume this works and it's easy enough to do. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@103299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/SelectionDAG')
-rw-r--r--lib/CodeGen/SelectionDAG/SelectionDAG.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
index 4854ff2..e9de6d5 100644
--- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
+++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
@@ -964,8 +964,18 @@ SDValue SelectionDAG::getConstantFP(double Val, EVT VT, bool isTarget) {
EVT EltVT = VT.getScalarType();
if (EltVT==MVT::f32)
return getConstantFP(APFloat((float)Val), VT, isTarget);
- else
+ else if (EltVT==MVT::f64)
return getConstantFP(APFloat(Val), VT, isTarget);
+ else if (EltVT==MVT::f80 || EltVT==MVT::f128) {
+ bool ignored;
+ APFloat apf = APFloat(Val);
+ apf.convert(*EVTToAPFloatSemantics(EltVT), APFloat::rmNearestTiesToEven,
+ &ignored);
+ return getConstantFP(apf, VT, isTarget);
+ } else {
+ assert(0 && "Unsupported type in getConstantFP");
+ return SDValue();
+ }
}
SDValue SelectionDAG::getGlobalAddress(const GlobalValue *GV,