public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] LoongArch: Use builtins for ffs and ffsll
@ 2024-02-05 18:39 Adhemerval Zanella
  0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2024-02-05 18:39 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2e80f139376450acdb7d879d799439578a41810e

commit 2e80f139376450acdb7d879d799439578a41810e
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Sun Feb 4 08:27:50 2024 +0800

    LoongArch: Use builtins for ffs and ffsll
    
    On LoongArch GCC compiles __builtin_ffs{,ll} to basically
    `(x ? __builtin_ctz (x) : -1) + 1`.  Since a hardware ctz instruction is
    available, this is much better than the table-driven generic
    implementation.
    
    Tested on loongarch64.
    
    Signed-off-by: Xi Ruoyao <xry111@xry111.site>
    Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

Diff:
---
 sysdeps/loongarch/math-use-builtins-ffs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sysdeps/loongarch/math-use-builtins-ffs.h b/sysdeps/loongarch/math-use-builtins-ffs.h
new file mode 100644
index 0000000000..a83bb15414
--- /dev/null
+++ b/sysdeps/loongarch/math-use-builtins-ffs.h
@@ -0,0 +1,2 @@
+#define USE_FFS_BUILTIN   1
+#define USE_FFSLL_BUILTIN 1

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

only message in thread, other threads:[~2024-02-05 18:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-05 18:39 [glibc] LoongArch: Use builtins for ffs and ffsll Adhemerval Zanella

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