]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
longlong.h: update from GCC for LoongArch clz/ctz support
authorXi Ruoyao <xry111@xry111.site>
Sat, 15 Oct 2022 06:12:13 +0000 (14:12 +0800)
committercaiyinyu <caiyinyu@loongson.cn>
Fri, 28 Oct 2022 07:02:53 +0000 (15:02 +0800)
Update longlong.h to GCC r13-3269.  Keep our local change (prefer https
for gnu.org URL).

stdlib/longlong.h

index 9b89469ac21ed70562d99a8d1436dfecaeebd577..d8f76a43b50ffd45b5e7489eaf637bafe93843b3 100644 (file)
@@ -593,6 +593,18 @@ extern UDItype __umulsidi3 (USItype, USItype);
 #define UMUL_TIME 14
 #endif
 
+#ifdef __loongarch__
+# if W_TYPE_SIZE == 32
+#  define count_leading_zeros(count, x)  ((count) = __builtin_clz (x))
+#  define count_trailing_zeros(count, x) ((count) = __builtin_ctz (x))
+#  define COUNT_LEADING_ZEROS_0 32
+# elif W_TYPE_SIZE == 64
+#  define count_leading_zeros(count, x)  ((count) = __builtin_clzll (x))
+#  define count_trailing_zeros(count, x) ((count) = __builtin_ctzll (x))
+#  define COUNT_LEADING_ZEROS_0 64
+# endif
+#endif
+
 #if defined (__M32R__) && W_TYPE_SIZE == 32
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
   /* The cmp clears the condition bit.  */ \