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 b4259e8..111b37d 100644 (file)
@@ -1,5 +1,12 @@
 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
        when second op1 is const0_rtx.  Validate op0 as a register.
        * config/alpha/alpha.md (setcc_internal): Don't allow constants
index ab472bb..669a8ff 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 6163386..20e7778 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 2fd6bfe..e528673 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__ */