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
This commit is contained in:
Nick Clifton 2009-11-30 10:10:52 +00:00 committed by Nick Clifton
parent 1dfddbb4d3
commit 0761b46075
4 changed files with 30 additions and 36 deletions

View File

@ -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.

View File

@ -1,2 +0,0 @@
#define XSTORMY16_COUNT_LEADING_ZEROS
#include "stormy16-lib2.c"

View File

@ -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 */

View File

@ -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