coarray_43.f90: Add "-latomic" option if libatomic_available.
[gcc.git] / libgcc / fp-bit.c
index 9b0c194604f81d82492da1e615c1b8b99d25af6f..38849f65b1c07b0c19c2ffacbc7cf392f62ae144 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-2017 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -202,15 +202,7 @@ pack_d (const fp_number_type *src)
   int sign = src->sign;
   int exp = 0;
 
-  if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && (isnan (src) || isinf (src)))
-    {
-      /* We can't represent these values accurately.  By using the
-        largest possible magnitude, we guarantee that the conversion
-        of infinity is at least as big as any finite number.  */
-      exp = EXPMAX;
-      fraction = ((fractype) 1 << FRACBITS) - 1;
-    }
-  else if (isnan (src))
+  if (isnan (src))
     {
       exp = EXPMAX;
       /* Restore the NaN's payload.  */
@@ -291,8 +283,7 @@ pack_d (const fp_number_type *src)
          fraction >>= NGARDS;
 #endif /* NO_DENORMALS */
        }
-      else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS)
-              && __builtin_expect (src->normal_exp > EXPBIAS, 0))
+      else if (__builtin_expect (src->normal_exp > EXPBIAS, 0))
        {
          exp = EXPMAX;
          fraction = 0;
@@ -300,35 +291,25 @@ pack_d (const fp_number_type *src)
       else
        {
          exp = src->normal_exp + EXPBIAS;
-         if (!ROUND_TOWARDS_ZERO)
+         /* IF the gard bits are the all zero, but the first, then we're
+            half way between two numbers, choose the one which makes the
+            lsb of the answer 0.  */
+         if ((fraction & GARDMASK) == GARDMSB)
            {
-             /* IF the gard bits are the all zero, but the first, then we're
-                half way between two numbers, choose the one which makes the
-                lsb of the answer 0.  */
-             if ((fraction & GARDMASK) == GARDMSB)
-               {
-                 if (fraction & (1 << NGARDS))
-                   fraction += GARDROUND + 1;
-               }
-             else
-               {
-                 /* Add a one to the guards to round up */
-                 fraction += GARDROUND;
-               }
-             if (fraction >= IMPLICIT_2)
-               {
-                 fraction >>= 1;
-                 exp += 1;
-               }
+             if (fraction & (1 << NGARDS))
+               fraction += GARDROUND + 1;
            }
-         fraction >>= NGARDS;
-
-         if (LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS) && exp > EXPMAX)
+         else
+           {
+             /* Add a one to the guards to round up */
+             fraction += GARDROUND;
+           }
+         if (fraction >= IMPLICIT_2)
            {
-             /* Saturate on overflow.  */
-             exp = EXPMAX;
-             fraction = ((fractype) 1 << FRACBITS) - 1;
+             fraction >>= 1;
+             exp += 1;
            }
+         fraction >>= NGARDS;
        }
     }
 
@@ -556,8 +537,7 @@ unpack_d (FLO_union_type * src, fp_number_type * dst)
          dst->fraction.ll = fraction;
        }
     }
-  else if (!LARGEST_EXPONENT_IS_NORMAL (FRAC_NBITS)
-          && __builtin_expect (exp == EXPMAX, 0))
+  else if (__builtin_expect (exp == EXPMAX, 0))
     {
       /* Huge exponent*/
       if (fraction == 0)
@@ -915,7 +895,7 @@ _fpmul_parts ( fp_number_type *  a,
       low <<= 1;
     }
 
-  if (!ROUND_TOWARDS_ZERO && (high & GARDMASK) == GARDMSB)
+  if ((high & GARDMASK) == GARDMSB)
     {
       if (high & (1 << NGARDS))
        {
@@ -1035,7 +1015,7 @@ _fpdiv_parts (fp_number_type * a,
        numerator *= 2;
       }
 
-    if (!ROUND_TOWARDS_ZERO && (quotient & GARDMASK) == GARDMSB)
+    if ((quotient & GARDMASK) == GARDMSB)
       {
        if (quotient & (1 << NGARDS))
          {