public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] longlong.h: update from GCC for LoongArch clz/ctz support
@ 2022-10-28  7:03 Yinyu Cai
  0 siblings, 0 replies; only message in thread
From: Yinyu Cai @ 2022-10-28  7:03 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=37db2657c92da3bc50128feed53b3f58739a9b19

commit 37db2657c92da3bc50128feed53b3f58739a9b19
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Sat Oct 15 14:12:13 2022 +0800

    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).

Diff:
---
 stdlib/longlong.h | 12 ++++++++++++
 1 file changed, 12 insertions(+)

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.  */ \

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-10-28  7:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28  7:03 [glibc] longlong.h: update from GCC for LoongArch clz/ctz support Yinyu Cai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).