Check we aren't trying to convert PPC long double.
authorDale Johannesen <dalej@apple.com>
Sun, 20 Apr 2008 18:23:46 +0000 (18:23 +0000)
committerDale Johannesen <dalej@apple.com>
Sun, 20 Apr 2008 18:23:46 +0000 (18:23 +0000)
This fixes the testsuite failure on ppcf128-4.ll.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49994 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/CodeGen/SelectionDAGNodes.h
lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index ce84ed00b123b4c9494d2bd4b67e93a86cdf6a2f..a688a9f5af7dc3a0f2dac099878a310536c79feb 100644 (file)
@@ -1500,7 +1500,10 @@ public:
   /// We leave the version with the double argument here because it's just so
   /// convenient to write "2.0" and the like.  Without this function we'd 
   /// have to duplicate its logic everywhere it's called.
-  bool isExactlyValue(double V) const { 
+  bool isExactlyValue(double V) const {
+    // convert is not supported on this type
+    if (&Value.getSemantics() == &APFloat::PPCDoubleDouble)
+      return false;
     APFloat Tmp(V);
     Tmp.convert(Value.getSemantics(), APFloat::rmNearestTiesToEven);
     return isExactlyValue(Tmp);
index fa38c5084861d53e785277f5875e2894de519e76..90d64832d71b39c739293ebcea5281745599d5c5 100644 (file)
@@ -74,12 +74,9 @@ bool ConstantFPSDNode::isValueValidForType(MVT::ValueType VT,
                                            const APFloat& Val) {
   assert(MVT::isFloatingPoint(VT) && "Can only convert between FP types");
   
-  // Anything can be extended to ppc long double.
-  if (VT == MVT::ppcf128)
-    return true;
-  
-  // PPC long double cannot be shrunk to anything though.
-  if (&Val.getSemantics() == &APFloat::PPCDoubleDouble)
+  // PPC long double cannot be converted to any other type.
+  if (VT == MVT::ppcf128 ||
+      &Val.getSemantics() == &APFloat::PPCDoubleDouble)
     return false;
   
   // convert modifies in place, so make a copy.