diff options
author | Richard Henderson <rth@cygnus.com> | 2000-10-05 22:29:56 -0700 |
---|---|---|
committer | Richard Henderson <rth@gcc.gnu.org> | 2000-10-05 22:29:56 -0700 |
commit | d6eacd48360d5a1e8d5ca6ef7a1826f72c05ceb2 (patch) | |
tree | eb967cd058e472946fc54fbdae14374af6029882 /gcc/libgcc2.c | |
parent | c74fa144ca7cc415fbbb7c3a46ec6c71c3f055ca (diff) | |
download | gcc-d6eacd48360d5a1e8d5ca6ef7a1826f72c05ceb2.zip gcc-d6eacd48360d5a1e8d5ca6ef7a1826f72c05ceb2.tar.gz gcc-d6eacd48360d5a1e8d5ca6ef7a1826f72c05ceb2.tar.bz2 |
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
Diffstat (limited to 'gcc/libgcc2.c')
-rw-r--r-- | gcc/libgcc2.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c index 6163386..20e7778 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)) |