about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2022-10-15 14:12:13 +0800
committercaiyinyu <caiyinyu@loongson.cn>2022-10-28 15:02:53 +0800
commit37db2657c92da3bc50128feed53b3f58739a9b19 (patch)
treecd4969782932ac13a01e72a36bcb797d66bb9bdf /stdlib
parent6f360366f7f76b158a0f4bf20d42f2854ad56264 (diff)
downloadglibc-37db2657c92da3bc50128feed53b3f58739a9b19.tar.gz
glibc-37db2657c92da3bc50128feed53b3f58739a9b19.tar.xz
glibc-37db2657c92da3bc50128feed53b3f58739a9b19.zip
longlong.h: update from GCC for LoongArch clz/ctz support
Update longlong.h to GCC r13-3269.  Keep our local change (prefer https
for gnu.org URL).
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/longlong.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/stdlib/longlong.h b/stdlib/longlong.h
index 9b89469ac2..d8f76a43b5 100644
--- a/stdlib/longlong.h
+++ b/stdlib/longlong.h
@@ -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.  */ \