Hi DJ,

  The patch below adds an implementation of the __clrsbhi2 function to
  libgcc for the M32C port.  Implementing this function resolves several
  gcc testsuite failures that rely upon the function being present.

  Ok to apply ?

Cheers
  Nick

libgcc/ChangeLog
2012-07-31  Nick Clifton  <ni...@redhat.com>

        * config/m32c/lib2funcs.c (__clrsbhi2): New function.

Index: libgcc/config/m32c/lib2funcs.c
===================================================================
--- libgcc/config/m32c/lib2funcs.c      (revision 189996)
+++ libgcc/config/m32c/lib2funcs.c      (working copy)
@@ -132,3 +132,17 @@
 {
   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;
+}


Reply via email to