summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@cygnus.com>2000-10-05 22:29:56 -0700
committerRichard Henderson <rth@gcc.gnu.org>2000-10-05 22:29:56 -0700
commitd6eacd48360d5a1e8d5ca6ef7a1826f72c05ceb2 (patch)
treeeb967cd058e472946fc54fbdae14374af6029882
parentc74fa144ca7cc415fbbb7c3a46ec6c71c3f055ca (diff)
downloadgcc-d6eacd48360d5a1e8d5ca6ef7a1826f72c05ceb2.tar.gz
Makefile.in (LIB2FUNCS): Add _clz.
* 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
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/libgcc2.c31
-rw-r--r--gcc/libgcc2.h6
4 files changed, 25 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b4259e8c838..111b37d45fe 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index ab472bb7d6b..669a8ff37b2 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -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 \
diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c
index 61633861381..20e7778f700 100644
--- a/gcc/libgcc2.c
+++ b/gcc/libgcc2.c
@@ -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
@@ -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))
diff --git a/gcc/libgcc2.h b/gcc/libgcc2.h
index 2fd6bfe4ab7..e52867399c9 100644
--- a/gcc/libgcc2.h
+++ b/gcc/libgcc2.h
@@ -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__ */