diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae70d025cb443b9850f89e909dc364d5bc5539de..2db2fdcf0d87907734105694c987b4ddf155e27a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2009-11-30 Nick Clifton <nickc@redhat.com> + + * config/stormy16/stormy16-lib2-count-leading-zeros.c: Delete. + * config/stormy16/t-stormy16 (LIB2FUNCS_EXTRA): Remove + stormy16-lib2-count-leading-zeros.c. + * config/stormy16/stormy16-lib2.c (__clzhi2): Move code from + __stormy16_count_leading_zeros() into this function. + (__ctzhi2): Use __builtin_clz. + (__ffshi2): Likewise. + 2009-11-30 Eric Botcazou <ebotcazou@adacore.com> * config/sparc/sparc.c (DF_MODES): Simplify. diff --git a/gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c b/gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c deleted file mode 100644 index 1b98d30c18bfd204986d1ec68771dac0855c41b6..0000000000000000000000000000000000000000 --- a/gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c +++ /dev/null @@ -1,2 +0,0 @@ -#define XSTORMY16_COUNT_LEADING_ZEROS -#include "stormy16-lib2.c" diff --git a/gcc/config/stormy16/stormy16-lib2.c b/gcc/config/stormy16/stormy16-lib2.c index 91c3c3dd2ca372b95c80ad877e4e7e548897cd05..0c99cdd3e9044b1a1db57a8c0092b41fced595c4 100644 --- a/gcc/config/stormy16/stormy16-lib2.c +++ b/gcc/config/stormy16/stormy16-lib2.c @@ -253,14 +253,24 @@ __parityhi2 (UHWtype x) #endif #ifdef XSTORMY16_CLZHI2 -/* Returns the number of leading zero bits in X. - FIXME: The return type really should be "unsigned int" - but this is not how the builtin is prototyped. */ - +/* Returns the number of zero-bits from the most significant bit to the + first nonzero bit in X. Returns 16 for X == 0. Implemented as a + simple for loop in order to save space by removing the need for + the __clz_tab array. + FIXME: The return type really should be "unsigned int" but this is + not how the builtin is prototyped. */ +#undef unsigned int __clzhi2 (UHWtype x) { - return __stormy16_count_leading_zeros (x); + unsigned int i; + unsigned int c; + unsigned int value = x; + + for (c = 0, i = 1 << 15; i; i >>= 1, c++) + if (i & value) + break; + return c; } #endif @@ -278,7 +288,7 @@ __ctzhi2 (UHWtype x) bits. */ x &= - x; - return 15 - __stormy16_count_leading_zeros (x); + return 15 - __builtin_clz (x); } #endif @@ -296,26 +306,6 @@ __ffshi2 (UHWtype u) if (u == 0) return 0; - return 16 - __stormy16_count_leading_zeros (u & - u); + return 16 - __builtin_clz (u & - u); } #endif - -#ifdef XSTORMY16_COUNT_LEADING_ZEROS -#undef unsigned -/* Count the number of zero-bits from the most significant bit to the - first nonzero bit in VALUE. Returns 16 for VALUE == 0. Implemented - as a simple for loop in order to save space by removing the need for - the __clz_tab array. */ - -unsigned int -__stormy16_count_leading_zeros (unsigned int value) -{ - unsigned int i; - unsigned int c; - - for (c = 0, i = 1 << 15; i; i >>= 1, c++) - if (i & value) - break; - return c; -} -#endif /* XSTORMY16_COUNT_LEADING_ZEROS */ diff --git a/gcc/config/stormy16/t-stormy16 b/gcc/config/stormy16/t-stormy16 index b103f88a1dfff2eea0dc1a42056b96864013f3a3..8959e64ab5e4a5c2bbaa84d42aebd0ca6ac7350d 100644 --- a/gcc/config/stormy16/t-stormy16 +++ b/gcc/config/stormy16/t-stormy16 @@ -18,8 +18,7 @@ # along with GCC; see the file COPYING3. If not see # <http://www.gnu.org/licenses/>. -# SImode routines - +# SImode arithmetic and logical routines, HImode bit counting routines. LIB2FUNCS_EXTRA = \ $(srcdir)/config/stormy16/stormy16-lib2-udivmodsi4.c \ $(srcdir)/config/stormy16/stormy16-lib2-divsi3.c \ @@ -33,12 +32,9 @@ LIB2FUNCS_EXTRA = \ $(srcdir)/config/stormy16/stormy16-lib2-parityhi2.c \ $(srcdir)/config/stormy16/stormy16-lib2-clzhi2.c \ $(srcdir)/config/stormy16/stormy16-lib2-ctzhi2.c \ - $(srcdir)/config/stormy16/stormy16-lib2-ffshi2.c \ - $(srcdir)/config/stormy16/stormy16-lib2-count-leading-zeros.c - - -# floating point emulation libraries + $(srcdir)/config/stormy16/stormy16-lib2-ffshi2.c +# Floating point emulation libraries. FPBIT = fp-bit.c DPBIT = dp-bit.c