public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Adhemerval Zanella <azanella@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc] LoongArch: Use builtins for ffs and ffsll
Date: Mon,  5 Feb 2024 18:39:55 +0000 (GMT)	[thread overview]
Message-ID: <20240205183955.407DE38582AA@sourceware.org> (raw)

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

                 reply	other threads:[~2024-02-05 18:39 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240205183955.407DE38582AA@sourceware.org \
    --to=azanella@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).