[llvm-commits] [llvm] r46617 - /llvm/trunk/lib/Support/APFloat.cpp

Dale Johannesen dalej at apple.com
Thu Jan 31 10:34:01 PST 2008


Author: johannes
Date: Thu Jan 31 12:34:01 2008
New Revision: 46617

URL: http://llvm.org/viewvc/llvm-project?rev=46617&view=rev
Log:
Chris' change to print an approximation to long doubles
exposed a bug in APFloat's long double->double conversion of
NaNs.  Broke several things in the ieee part of gcc testsuite.


Modified:
    llvm/trunk/lib/Support/APFloat.cpp

Modified: llvm/trunk/lib/Support/APFloat.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APFloat.cpp?rev=46617&r1=46616&r2=46617&view=diff

==============================================================================
--- llvm/trunk/lib/Support/APFloat.cpp (original)
+++ llvm/trunk/lib/Support/APFloat.cpp Thu Jan 31 12:34:01 2008
@@ -1712,6 +1712,8 @@
     fs = normalize(rounding_mode, lostFraction);
   } else if (category == fcNaN) {
     int shift = toSemantics.precision - semantics->precision;
+    // Do this now so significandParts gets the right answer
+    semantics = &toSemantics;
     // No normalization here, just truncate
     if (shift>0)
       APInt::tcShiftLeft(significandParts(), newPartCount, shift);
@@ -1721,7 +1723,6 @@
     // does not give you back the same bits.  This is dubious, and we
     // don't currently do it.  You're really supposed to get
     // an invalid operation signal at runtime, but nobody does that.
-    semantics = &toSemantics;
     fs = opOK;
   } else {
     semantics = &toSemantics;





More information about the llvm-commits mailing list