+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.
#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
bits. */
x &= - x;
- return 15 - __stormy16_count_leading_zeros (x);
+ return 15 - __builtin_clz (x);
}
#endif
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 */
# 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 \
$(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