public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] arm: Support gcc older than 10 for find_zero_all
@ 2023-02-20 16:48 Adhemerval Zanella
  2023-02-20 19:26 ` Richard Henderson
  0 siblings, 1 reply; 3+ messages in thread
From: Adhemerval Zanella @ 2023-02-20 16:48 UTC (permalink / raw)
  To: libc-alpha, Szabolcs Nagy

__builtin_arm_uqsub8 is only available on gcc newer or equal than 10.

Checked on arm-linux-gnueabihf built with gcc 9.
---
 sysdeps/arm/armv6t2/string-fza.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sysdeps/arm/armv6t2/string-fza.h b/sysdeps/arm/armv6t2/string-fza.h
index 76274ccca7..d85ce86434 100644
--- a/sysdeps/arm/armv6t2/string-fza.h
+++ b/sysdeps/arm/armv6t2/string-fza.h
@@ -33,7 +33,13 @@ find_zero_all (op_t x)
   /* Use unsigned saturated subtraction from 1 in each byte.
      That leaves 1 for every byte that was zero.  */
   op_t ones = repeat_bytes (0x01);
+#if __GNUC_PREREQ (10, 0)
   return __builtin_arm_uqsub8 (ones, x);
+#else
+  op_t ret;
+  asm ("uqsub8 %0,%1,%2" : "=r"(ret) : "r"(ones), "r"(x));
+  return ret;
+#endif
 }
 
 /* Identify bytes that are equal between X1 and X2.  */
-- 
2.34.1


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

* Re: [PATCH] arm: Support gcc older than 10 for find_zero_all
  2023-02-20 16:48 [PATCH] arm: Support gcc older than 10 for find_zero_all Adhemerval Zanella
@ 2023-02-20 19:26 ` Richard Henderson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2023-02-20 19:26 UTC (permalink / raw)
  To: Adhemerval Zanella, libc-alpha, Szabolcs Nagy

On 2/20/23 06:48, Adhemerval Zanella via Libc-alpha wrote:
> __builtin_arm_uqsub8 is only available on gcc newer or equal than 10.
> 
> Checked on arm-linux-gnueabihf built with gcc 9.
> ---
>   sysdeps/arm/armv6t2/string-fza.h | 6 ++++++
>   1 file changed, 6 insertions(+)

Whoops, thanks.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

> 
> diff --git a/sysdeps/arm/armv6t2/string-fza.h b/sysdeps/arm/armv6t2/string-fza.h
> index 76274ccca7..d85ce86434 100644
> --- a/sysdeps/arm/armv6t2/string-fza.h
> +++ b/sysdeps/arm/armv6t2/string-fza.h
> @@ -33,7 +33,13 @@ find_zero_all (op_t x)
>     /* Use unsigned saturated subtraction from 1 in each byte.
>        That leaves 1 for every byte that was zero.  */
>     op_t ones = repeat_bytes (0x01);
> +#if __GNUC_PREREQ (10, 0)
>     return __builtin_arm_uqsub8 (ones, x);
> +#else
> +  op_t ret;
> +  asm ("uqsub8 %0,%1,%2" : "=r"(ret) : "r"(ones), "r"(x));
> +  return ret;
> +#endif
>   }
>   
>   /* Identify bytes that are equal between X1 and X2.  */


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

* Re: [PATCH] arm: Support gcc older than 10 for find_zero_all
@ 2023-02-22 16:37 Wilco Dijkstra
  0 siblings, 0 replies; 3+ messages in thread
From: Wilco Dijkstra @ 2023-02-22 16:37 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: 'GNU C Library'

Hi Adhemerval,

> __builtin_arm_uqsub8 is only available on gcc newer or equal than 10.

> +#if __GNUC_PREREQ (10, 0)
>   return __builtin_arm_uqsub8 (ones, x);
> +#else
> +  op_t ret;
> +  asm ("uqsub8 %0,%1,%2" : "=r"(ret) : "r"(ones), "r"(x));
> +  return ret;
> +#endif

__builtin_arm_uqsub8 is an internal builtin function which might change -
the correct way is to include "arm_acle.h" and use __uqsub8 (). Since LLVM
doesn't seem to support this, it may be easier to only keep the inline assembler
for now.

Cheers,
Wilco

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

end of thread, other threads:[~2023-02-22 16:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-20 16:48 [PATCH] arm: Support gcc older than 10 for find_zero_all Adhemerval Zanella
2023-02-20 19:26 ` Richard Henderson
2023-02-22 16:37 Wilco Dijkstra

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