public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] longlong.h: update from GCC for LoongArch clz/ctz support
@ 2022-10-15  6:12 Xi Ruoyao
  2022-10-24 13:08 ` caiyinyu
  2022-10-24 14:10 ` Adhemerval Zanella Netto
  0 siblings, 2 replies; 3+ messages in thread
From: Xi Ruoyao @ 2022-10-15  6:12 UTC (permalink / raw)
  To: libc-alpha; +Cc: caiyinyu, Joseph Myers, Wang Xuerui, Xi Ruoyao

Update longlong.h to GCC r13-3269.  Keep our local change (prefer https
for gnu.org URL).
---
 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.  */ \
-- 
2.38.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] longlong.h: update from GCC for LoongArch clz/ctz support
  2022-10-15  6:12 [PATCH] longlong.h: update from GCC for LoongArch clz/ctz support Xi Ruoyao
@ 2022-10-24 13:08 ` caiyinyu
  2022-10-24 14:10 ` Adhemerval Zanella Netto
  1 sibling, 0 replies; 3+ messages in thread
From: caiyinyu @ 2022-10-24 13:08 UTC (permalink / raw)
  To: Xi Ruoyao, libc-alpha; +Cc: Joseph Myers, Wang Xuerui

Gentle Ping.

Tested with gcc 12.0.1 binutils 2.39 and this patch need to be backport 
to glibc 2.36-master.

在 2022/10/15 下午2:12, Xi Ruoyao 写道:
> Update longlong.h to GCC r13-3269.  Keep our local change (prefer https
> for gnu.org URL).
> ---
>   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] 3+ messages in thread

* Re: [PATCH] longlong.h: update from GCC for LoongArch clz/ctz support
  2022-10-15  6:12 [PATCH] longlong.h: update from GCC for LoongArch clz/ctz support Xi Ruoyao
  2022-10-24 13:08 ` caiyinyu
@ 2022-10-24 14:10 ` Adhemerval Zanella Netto
  1 sibling, 0 replies; 3+ messages in thread
From: Adhemerval Zanella Netto @ 2022-10-24 14:10 UTC (permalink / raw)
  To: Xi Ruoyao, libc-alpha; +Cc: Wang Xuerui, Joseph Myers, caiyinyu



On 15/10/22 03:12, Xi Ruoyao via Libc-alpha wrote:
> Update longlong.h to GCC r13-3269.  Keep our local change (prefer https
> for gnu.org URL).


LGTM, it matches gcc commit 6f653a2c85a450714bac905ea4f153234bc6cd5f.

Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> ---
>  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] 3+ messages in thread

end of thread, other threads:[~2022-10-24 14:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-15  6:12 [PATCH] longlong.h: update from GCC for LoongArch clz/ctz support Xi Ruoyao
2022-10-24 13:08 ` caiyinyu
2022-10-24 14:10 ` Adhemerval Zanella Netto

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