extend fp values with FP_EXTEND not FP_ROUND.
authorChris Lattner <sabre@nondot.org>
Sun, 9 Mar 2008 07:47:22 +0000 (07:47 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 9 Mar 2008 07:47:22 +0000 (07:47 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48097 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 1140e20a44003c6b7f76d5c0cfbb748ae4365856..97e12a4a0e9a84bd0705034d43e1c23928353788 100644 (file)
@@ -759,9 +759,12 @@ static SDOperand getCopyFromParts(SelectionDAG &DAG,
     }
   }
 
-  if (MVT::isFloatingPoint(PartVT) && MVT::isFloatingPoint(ValueVT))
-    return DAG.getNode(ISD::FP_ROUND, ValueVT, Val,
-                       DAG.getIntPtrConstant(TruncExact));
+  if (MVT::isFloatingPoint(PartVT) && MVT::isFloatingPoint(ValueVT)) {
+    if (ValueVT < Val.getValueType())
+      return DAG.getNode(ISD::FP_ROUND, ValueVT, Val,
+                         DAG.getIntPtrConstant(TruncExact));
+    return DAG.getNode(ISD::FP_EXTEND, ValueVT, Val);
+  }
 
   if (MVT::getSizeInBits(PartVT) == MVT::getSizeInBits(ValueVT))
     return DAG.getNode(ISD::BIT_CONVERT, ValueVT, Val);