diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-06 05:29:56 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-10-06 05:29:56 +0000 |
commit | 9ce1b52b3654f3d39a5560b8c2fc5864d556a54d (patch) | |
tree | eb967cd058e472946fc54fbdae14374af6029882 /gcc/libgcc2.c | |
parent | bc88252166a9cc784ef20ba17d2723906261cf86 (diff) | |
download | gcc-9ce1b52b3654f3d39a5560b8c2fc5864d556a54d.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36744 138bc75d-0d04-0410-961f-82ee72b054a4
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 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)) |