Daily bump.
[gcc.git] / libgcc / libgcc2.c
index 9fb150b2dd5fc415736a110ff5f979edd5ad1b6b..e0a9fd712e70c816113ddb6d061ce979657878fc 100644 (file)
@@ -1,6 +1,6 @@
 /* More subroutines needed by GCC output code on some machines.  */
 /* Compile this one with gcc.  */
-/* Copyright (C) 1989-2016 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -375,7 +375,8 @@ __mulvDI3 (DWtype u, DWtype v)
                }
              else
                {
-                 if (uu.s.high == (Wtype) -1 && vv.s.high == (Wtype) - 1)
+                 if ((uu.s.high & vv.s.high) == (Wtype) -1
+                     && (uu.s.low | vv.s.low) != 0)
                    {
                      DWunion ww = {.ll = (UDWtype) (UWtype) uu.s.low
                                    * (UDWtype) (UWtype) vv.s.low};
@@ -680,7 +681,8 @@ __udiv_w_sdiv (UWtype *rp __attribute__ ((__unused__)),
 #endif
 \f
 #if (defined (L_udivdi3) || defined (L_divdi3) || \
-     defined (L_umoddi3) || defined (L_moddi3))
+     defined (L_umoddi3) || defined (L_moddi3) || \
+     defined (L_divmoddi4))
 #define L_udivmoddi4
 #endif
 
@@ -937,7 +939,8 @@ __parityDI2 (UDWtype x)
 #ifdef TARGET_HAS_NO_HW_DIVIDE
 
 #if (defined (L_udivdi3) || defined (L_divdi3) || \
-     defined (L_umoddi3) || defined (L_moddi3))
+     defined (L_umoddi3) || defined (L_moddi3) || \
+     defined (L_divmoddi4))
 static inline __attribute__ ((__always_inline__))
 #endif
 UDWtype
@@ -1004,7 +1007,8 @@ __udivmoddi4 (UDWtype n, UDWtype d, UDWtype *rp)
 #else
 
 #if (defined (L_udivdi3) || defined (L_divdi3) || \
-     defined (L_umoddi3) || defined (L_moddi3))
+     defined (L_umoddi3) || defined (L_moddi3) || \
+     defined (L_divmoddi4))
 static inline __attribute__ ((__always_inline__))
 #endif
 UDWtype
@@ -1269,6 +1273,34 @@ __moddi3 (DWtype u, DWtype v)
 }
 #endif
 
+#ifdef L_divmoddi4
+DWtype
+__divmoddi4 (DWtype u, DWtype v, DWtype *rp)
+{
+  Wtype c1 = 0, c2 = 0;
+  DWunion uu = {.ll = u};
+  DWunion vv = {.ll = v};
+  DWtype w;
+  DWtype r;
+
+  if (uu.s.high < 0)
+    c1 = ~c1, c2 = ~c2,
+    uu.ll = -uu.ll;
+  if (vv.s.high < 0)
+    c1 = ~c1,
+    vv.ll = -vv.ll;
+
+  w = __udivmoddi4 (uu.ll, vv.ll, (UDWtype*)&r);
+  if (c1)
+    w = -w;
+  if (c2)
+    r = -r;
+
+  *rp = r;
+  return w;
+}
+#endif
+
 #ifdef L_umoddi3
 UDWtype
 __umoddi3 (UDWtype u, UDWtype v)
@@ -1643,11 +1675,16 @@ FUNC (DWtype u)
     hi = -(UWtype) hi;
 
   UWtype count, shift;
+#if !defined (COUNT_LEADING_ZEROS_0) || COUNT_LEADING_ZEROS_0 != W_TYPE_SIZE
+  if (hi == 0)
+    count = W_TYPE_SIZE;
+  else
+#endif
   count_leading_zeros (count, hi);
 
   /* No leading bits means u == minimum.  */
   if (count == 0)
-    return -(Wtype_MAXp1_F * (Wtype_MAXp1_F / 2));
+    return Wtype_MAXp1_F * (FSTYPE) (hi | ((UWtype) u != 0));
 
   shift = 1 + W_TYPE_SIZE - count;
 
@@ -1902,15 +1939,9 @@ NAME (TYPE x, int m)
 #define CONCAT2(A,B)   _CONCAT2(A,B)
 #define _CONCAT2(A,B)  A##B
 
-/* All of these would be present in a full C99 implementation of <math.h>
-   and <complex.h>.  Our problem is that only a few systems have such full
-   implementations.  Further, libgcc_s.so isn't currently linked against
-   libm.so, and even for systems that do provide full C99, the extra overhead
-   of all programs using libgcc having to link against libm.  So avoid it.  */
-
-#define isnan(x)       __builtin_expect ((x) != (x), 0)
-#define isfinite(x)    __builtin_expect (!isnan((x) - (x)), 1)
-#define isinf(x)       __builtin_expect (!isnan(x) & !isfinite(x), 0)
+#define isnan(x)       __builtin_isnan (x)
+#define isfinite(x)    __builtin_isfinite (x)
+#define isinf(x)       __builtin_isinf (x)
 
 #define INFINITY       CONCAT2(__builtin_huge_val, CEXT) ()
 #define I              1i
@@ -2131,11 +2162,14 @@ __eprintf (const char *string, const char *expression,
 /* Clear part of an instruction cache.  */
 
 void
-__clear_cache (char *beg __attribute__((__unused__)),
-              char *end __attribute__((__unused__)))
+__clear_cache (void *beg __attribute__((__unused__)),
+              void *end __attribute__((__unused__)))
 {
 #ifdef CLEAR_INSN_CACHE
-  CLEAR_INSN_CACHE (beg, end);
+  /* Cast the void* pointers to char* as some implementations
+     of the macro assume the pointers can be subtracted from
+     one another.  */
+  CLEAR_INSN_CACHE ((char *) beg, (char *) end);
 #endif /* CLEAR_INSN_CACHE */
 }