config.host: Append t-floattodi to tmake_file depending on host_address.
[gcc.git] / libgcc / fp-bit.c
index 60f23387e8127681dc4933f62501c6725e9c8219..4155fae28cafcf3d7bb5d9ec594bac084eec8f0e 100644 (file)
@@ -1,6 +1,6 @@
 /* This is a software floating point library which can be used
    for targets without hardware floating point. 
-   Copyright (C) 1994-2013 Free Software Foundation, Inc.
+   Copyright (C) 1994-2014 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -213,11 +213,18 @@ pack_d (const fp_number_type *src)
   else if (isnan (src))
     {
       exp = EXPMAX;
+      /* Restore the NaN's payload.  */
+      fraction >>= NGARDS;
+      fraction &= QUIET_NAN - 1;
       if (src->class == CLASS_QNAN || 1)
        {
 #ifdef QUIET_NAN_NEGATED
-         fraction |= QUIET_NAN - 1;
+         /* The quiet/signaling bit remains unset.  */
+         /* Make sure the fraction has a non-zero value.  */
+         if (fraction == 0)
+           fraction |= QUIET_NAN - 1;
 #else
+         /* Set the quiet/signaling bit.  */
          fraction |= QUIET_NAN;
 #endif
        }
@@ -573,8 +580,10 @@ unpack_d (FLO_union_type * src, fp_number_type * dst)
            {
              dst->class = CLASS_SNAN;
            }
-         /* Keep the fraction part as the nan number */
-         dst->fraction.ll = fraction;
+         /* Now that we know which kind of NaN we got, discard the
+            quiet/signaling bit, but do preserve the NaN payload.  */
+         fraction &= ~QUIET_NAN;
+         dst->fraction.ll = fraction << NGARDS;
        }
     }
   else