]> gcc.gnu.org Git - gcc.git/commitdiff
lib2funcs.c (__clrsbhi2): New function.
authorNick Clifton <nickc@redhat.com>
Wed, 1 Aug 2012 09:36:01 +0000 (09:36 +0000)
committerNick Clifton <nickc@gcc.gnu.org>
Wed, 1 Aug 2012 09:36:01 +0000 (09:36 +0000)
* config/m32c/lib2funcs.c (__clrsbhi2): New function.
Implements __clrsb for an HImode argument.

From-SVN: r190032

libgcc/ChangeLog
libgcc/config/m32c/lib2funcs.c

index 9d629e6ab8c2709b53757d143efed01d8e790810..62f9446ea49112ef9958ca84f78b14b0e1df722a 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-01  Nick Clifton  <nickc@redhat.com>
+
+       * config/m32c/lib2funcs.c (__clrsbhi2): New function.
+       Implements __clrsb for an HImode argument.
+
 2012-07-31  Nick Clifton  <nickc@redhat.com>
 
        * config/stormy16/lib2funcs.c (__clrsbhi2): New function.
index 274affc4ab094f3d13aad166067fbb41bc2a1c4f..76b237cdf269b1ecc197622d770372638ea15957 100644 (file)
@@ -1,5 +1,5 @@
 /* libgcc routines for R8C/M16C/M32C
-   Copyright (C) 2005, 2009
+   Copyright (C) 2005, 2009, 2012
    Free Software Foundation, Inc.
    Contributed by Red Hat.
 
@@ -132,3 +132,17 @@ __umoddi3 (uint32_type a, uint32_type b)
 {
   return udivmodsi4 (a, b, 1);
 }
+
+/* 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 (word_type x)
+{
+  if (x < 0)
+    x = ~x;
+  if (x == 0)
+    return 15;
+  return __builtin_clz (x) - 1;
+}
This page took 0.073822 seconds and 5 git commands to generate.