OSDN Git Service

* config/stormy16/stormy16-lib2-count-leading-zeros.c: Delete.
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Nov 2009 10:10:52 +0000 (10:10 +0000)
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 30 Nov 2009 10:10:52 +0000 (10:10 +0000)
        * 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154770 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/stormy16/stormy16-lib2-count-leading-zeros.c [deleted file]
gcc/config/stormy16/stormy16-lib2.c
gcc/config/stormy16/t-stormy16

index ae70d02..2db2fdc 100644 (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.
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 (file)
index 1b98d30..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#define XSTORMY16_COUNT_LEADING_ZEROS
-#include "stormy16-lib2.c"
index 91c3c3d..0c99cdd 100644 (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 */
index b103f88..8959e64 100644 (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