]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
lib2funcs.c (__clrsbhi2): New function.
authorNick Clifton <nickc@redhat.com>
Tue, 31 Jul 2012 09:09:29 +0000 (09:09 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Tue, 31 Jul 2012 09:09:29 +0000 (09:09 +0000)
* config/stormy16/lib2funcs.c (__clrsbhi2): New function.
Implements __clrsb for an HImode argument.
* config/stormy16/clrsbhi2.c: New file:
* config/stormy16/t-stormy16 (LIB2ADD): Add clrsbhi2.c.

From-SVN: r189997

libgcc/ChangeLog
libgcc/config/stormy16/clrsbhi2.c [new file with mode: 0644]
libgcc/config/stormy16/lib2funcs.c
libgcc/config/stormy16/t-stormy16

index bcfd22b41f9db9fbf2cdc58e1e98bbeb38a22fd0..9d629e6ab8c2709b53757d143efed01d8e790810 100644 (file)
@@ -1,3 +1,10 @@
+2012-07-31  Nick Clifton  <nickc@redhat.com>
+
+       * config/stormy16/lib2funcs.c (__clrsbhi2): New function.
+       Implements __clrsb for an HImode argument.
+       * config/stormy16/clrsbhi2.c: New file:
+       * config/stormy16/t-stormy16 (LIB2ADD): Add clrsbhi2.c.
+
 2012-07-22  Steven Bosscher  <steven@gcc.gnu.org>
 
        * libgcov.c (__gcov_ior_profiler): Benign comment fix.
diff --git a/libgcc/config/stormy16/clrsbhi2.c b/libgcc/config/stormy16/clrsbhi2.c
new file mode 100644 (file)
index 0000000..3ce41ac
--- /dev/null
@@ -0,0 +1,2 @@
+#define XSTORMY16_CLRSBHI2
+#include "lib2funcs.c"
index a10a9b281193f23e3fa5bddfa4bc2304acbea4c8..a996fd15e242f3c3217b7745f4c3783cdaccb2a3 100644 (file)
@@ -311,6 +311,22 @@ __ffshi2 (UHWtype u)
 }
 #endif
 
+#ifdef XSTORMY16_CLRSBHI2
+/* Returns the number of leading redundant sign bits in X.
+   I.e. the number of bits following the most significant bit which are
+   identical to it.  There are no special cases for 0 or other values.  */
+
+int
+__clrsbhi2 (HWtype x)
+{
+  if (x < 0)
+    x = ~x;
+  if (x == 0)
+    return 15;
+  return __builtin_clz (x) - 1;
+}
+#endif
+
 #ifdef XSTORMY16_UCMPSI2
 /* Performs an unsigned comparison of two 32-bit values: A and B.
    If A is less than B, then 0 is returned.  If A is greater than B,
index d62d167d93d455ffd149316d92ca89c59a4619ba..48ded89d3bf378dbb8ac7e0d658ef2b475059dd2 100644 (file)
@@ -33,6 +33,7 @@ LIB2ADD = \
        $(srcdir)/config/stormy16/clzhi2.c \
        $(srcdir)/config/stormy16/ctzhi2.c \
        $(srcdir)/config/stormy16/ffshi2.c \
+       $(srcdir)/config/stormy16/clrsbhi2.c \
        $(srcdir)/config/stormy16/cmpsi2.c \
        $(srcdir)/config/stormy16/ucmpsi2.c