]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - libgcc/config/stormy16/lib2funcs.c
Update copyright years.
[thirdparty/gcc.git] / libgcc / config / stormy16 / lib2funcs.c
index a10a9b281193f23e3fa5bddfa4bc2304acbea4c8..9e05d7a79c6adaff355a3d71bea4066efb2bd6f7 100644 (file)
@@ -4,7 +4,7 @@
    files.  On this glorious day maybe this code can be integrated into
    it too.  */
 
-/* Copyright (C) 2005, 2008, 2009, 2010, 2011  Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
 
    This file is part of GCC.
 
@@ -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,