From: Richard Henderson Date: Wed, 5 Feb 2003 00:52:24 +0000 (-0800) Subject: libgcc2.h, libgcc2.c (__ffsSI2): New. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dfff898c2701ef3d7934c1efb88b89974770d25d;p=platform%2Fupstream%2Fgcc.git libgcc2.h, libgcc2.c (__ffsSI2): New. * libgcc2.h, libgcc2.c (__ffsSI2): New. (__ffsDI2): Rename from __ffsdi2. * mklibgcc.in (lib2funcs): Add _ffssi2. From-SVN: r62422 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 17553a3..c3f0e05 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,11 @@ 2003-02-04 Richard Henderson + * libgcc2.h, libgcc2.c (__ffsSI2): New. + (__ffsDI2): Rename from __ffsdi2. + * mklibgcc.in (lib2funcs): Add _ffssi2. + +2003-02-04 Richard Henderson + * libgcc2.c (__paritysi2, __paritydi2): Replace last two reduction rounds with a "bit table" lookup. diff --git a/gcc/libgcc2.c b/gcc/libgcc2.c index 2801681..3736b2c 100644 --- a/gcc/libgcc2.c +++ b/gcc/libgcc2.c @@ -340,11 +340,27 @@ __ashrdi3 (DWtype u, word_type b) } #endif +#ifdef L_ffssi2 +#undef int +extern int __ffsSI2 (UWtype u); +int +__ffsSI2 (UWtype u) +{ + UWtype count; + + if (u == 0) + return 0; + + count_trailing_zeros (count, u); + return count + 1; +} +#endif + #ifdef L_ffsdi2 #undef int -extern int __ffsdi2 (DWtype u); +extern int __ffsDI2 (DWtype u); int -__ffsdi2 (DWtype u) +__ffsDI2 (DWtype u) { DWunion uu; UWtype word, count, add; diff --git a/gcc/libgcc2.h b/gcc/libgcc2.h index f32f4a0..876e1d5 100644 --- a/gcc/libgcc2.h +++ b/gcc/libgcc2.h @@ -182,7 +182,6 @@ typedef int word_type __attribute__ ((mode (__word__))); #define __lshrdi3 __NDW(lshr,3) #define __ashldi3 __NDW(ashl,3) #define __ashrdi3 __NDW(ashr,3) -#define __ffsdi2 __NDW(ffs,2) #define __cmpdi2 __NDW(cmp,2) #define __ucmpdi2 __NDW(ucmp,2) #define __udivmoddi4 __NDW(udivmod,4) @@ -203,6 +202,9 @@ typedef int word_type __attribute__ ((mode (__word__))); #define __fixunsdfSI __NW(fixunsdf,) #define __fixunssfSI __NW(fixunssf,) +#define __ffsSI2 __NW(ffs,2) +#define __ffsDI2 __NDW(ffs,2) + extern DWtype __muldi3 (DWtype, DWtype); extern DWtype __divdi3 (DWtype, DWtype); extern UDWtype __udivdi3 (UDWtype, UDWtype); diff --git a/gcc/mklibgcc.in b/gcc/mklibgcc.in index 74f7203..3a492da 100644 --- a/gcc/mklibgcc.in +++ b/gcc/mklibgcc.in @@ -44,14 +44,14 @@ echo 'force:' echo # Library members defined in libgcc2.c. -lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _ffsdi2 _clz +lib2funcs='_muldi3 _negdi2 _lshrdi3 _ashldi3 _ashrdi3 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fixunsxfdi _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf _clear_cache _trampoline __main _exit _absvsi2 _absvdi2 _addvsi3 _addvdi3 _subvsi3 _subvdi3 _mulvsi3 _mulvdi3 _negvsi2 _negvdi2 _ctors - _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab _popcountsi2 - _popcountdi2 _paritysi2 _paritydi2' + _ffssi2 _ffsdi2 _clz _clzsi2 _clzdi2 _ctzsi2 _ctzdi2 _popcount_tab + _popcountsi2 _popcountdi2 _paritysi2 _paritydi2' # Disable SHLIB_LINK if shared libgcc not enabled. if [ "@enable_shared@" = "no" ]; then