Makefile.in (LIB2FUNCS): Add _clz.
authorRichard Henderson <rth@cygnus.com>
Fri, 6 Oct 2000 05:29:56 +0000 (22:29 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Fri, 6 Oct 2000 05:29:56 +0000 (22:29 -0700)
        * Makefile.in (LIB2FUNCS): Add _clz.
        * libgcc2.c (__ffsdi2): Use count_trailing_zeros.
        (__clz_tab): Put in its own unit, non-static.
        * libgcc2.h: Always include longlong.h.

From-SVN: r36744

gcc/ChangeLog
gcc/Makefile.in
gcc/libgcc2.c
gcc/libgcc2.h

index b4259e8c8389e444d236d3089b0fc8eb5805713e..111b37d45fe2b34df559ecf3f377b8d0491bc6a3 100644 (file)
@@ -1,3 +1,10 @@
+2000-10-05  Richard Henderson  <rth@cygnus.com>
+
+       * Makefile.in (LIB2FUNCS): Add _clz.
+       * libgcc2.c (__ffsdi2): Use count_trailing_zeros.
+       (__clz_tab): Put in its own unit, non-static.
+       * libgcc2.h: Always include longlong.h.
+
 2000-10-05  Richard Henderson  <rth@cygnus.com>
 
        * config/alpha/alpha.c (alpha_emit_setcc): Don't swap GT tests
index ab472bb7d6ba6c588310bc889940dec928b0f2b6..669a8ff37b229b9855f685c279245b3090b107f4 100644 (file)
@@ -738,7 +738,7 @@ LIB1FUNCS = _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
 
 # Library members defined in libgcc2.c.
 LIB2FUNCS = _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
-     _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 \
+     _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz \
     _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf \
     _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi \
     _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi \
index 616338613811190095d86a5aaceec022f000dd1c..20e7778f7000fc147a1cb53025a00ea7c9280be6 100644 (file)
@@ -165,19 +165,19 @@ __ashrdi3 (DWtype u, word_type b)
 DWtype
 __ffsdi2 (DWtype u)
 {
-  DWunion uu, w;
+  DWunion uu;
+  UWtype word, count, add;
+
   uu.ll = u;
-  w.s.high = 0;
-  w.s.low = ffs (uu.s.low);
-  if (w.s.low != 0)
-    return w.ll;
-  w.s.low = ffs (uu.s.high);
-  if (w.s.low != 0)
-    {
-      w.s.low += BITS_PER_UNIT * sizeof (Wtype);
-      return w.ll;
-    }
-  return w.ll;
+  if (uu.s.low != 0)
+    word = uu.s.low, add = 0;
+  else if (uu.s.high != 0)
+    word = uu.s.high, add = BITS_PER_UNIT * sizeof (Wtype);
+  else
+    return 0;
+
+  count_trailing_zeros (count, word);
+  return count + add + 1;
 }
 #endif
 \f
@@ -315,8 +315,8 @@ __udiv_w_sdiv (UWtype *rp __attribute__ ((__unused__)),
 #define L_udivmoddi4
 #endif
 
-#ifdef L_udivmoddi4
-static const UQItype __clz_tab[] =
+#ifdef L_clz
+const UQItype __clz_tab[] =
 {
   0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
   6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
@@ -327,6 +327,9 @@ static const UQItype __clz_tab[] =
   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
   8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
 };
+#endif
+
+#ifdef L_udivmoddi4
 
 #if (defined (L_udivdi3) || defined (L_divdi3) || \
      defined (L_umoddi3) || defined (L_moddi3))
index 2fd6bfe4ab7361290d30adc9d232f17132926f1f..e52867399c9bf49d273a88ff3ca39411bbd3a100 100644 (file)
@@ -299,12 +299,6 @@ typedef union
   DWtype ll;
 } DWunion;
 
-#if (defined (L_udivmoddi4) || defined (L_muldi3) || defined (L_udiv_w_sdiv)\
-     || defined (L_divdi3) || defined (L_udivdi3) \
-     || defined (L_moddi3) || defined (L_umoddi3))
-
 #include "longlong.h"
 
-#endif /* udiv or mul */
-
 #endif /* __LIBGCC2_H__ */