diff options
author | Nick Clifton <nickc@redhat.com> | 2009-11-30 10:10:52 +0000 |
---|---|---|
committer | Nick Clifton <nickc@gcc.gnu.org> | 2009-11-30 10:10:52 +0000 |
commit | 0761b46075f1c53a0fc01292b1956dd95137e18e (patch) | |
tree | 116be8b118c4bade74b64257dfadd6ff6c8802fe | |
parent | 1dfddbb4d341548f0b196873f0d2b9c9b058b8a4 (diff) | |
download | gcc-0761b46075f1c53a0fc01292b1956dd95137e18e.zip gcc-0761b46075f1c53a0fc01292b1956dd95137e18e.tar.gz gcc-0761b46075f1c53a0fc01292b1956dd95137e18e.tar.bz2 |
stormy16-lib2-count-leading-zeros.c: Delete.
* 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.
From-SVN: r154770
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c | 2 | ||||
-rw-r--r-- | gcc/config/stormy16/stormy16-lib2.c | 44 | ||||
-rw-r--r-- | gcc/config/stormy16/t-stormy16 | 10 |
4 files changed, 30 insertions, 36 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ae70d02..2db2fdc 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 1b98d30..0000000 --- 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 91c3c3d..0c99cdd 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 b103f88..8959e64 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 |