From: Xi Ruoyao <xry111@xry111.site>
To: gcc-patches@gcc.gnu.org
Cc: Jakub Jelinek <jakub@redhat.com>, Xi Ruoyao <xry111@xry111.site>
Subject: [PATCH] libatomic: x86_64: Always try ifunc
Date: Sat, 3 Jun 2023 19:25:32 +0800 [thread overview]
Message-ID: <20230603112532.3264658-1-xry111@xry111.site> (raw)
We used to skip ifunc check when CX16 is available. But now we use
CX16+AVX+Intel/AMD for the "perfect" 16b load implementation, so CX16
alone is not a sufficient reason not to use ifunc (see PR104688).
This causes a subtle and annoying issue: when GCC is built with a
higher -march= setting in CFLAGS_FOR_TARGET, ifunc is disabled and
the worst (locked) implementation of __atomic_load_16 is always used.
There seems no good way to check if the CPU is Intel or AMD from
the built-in macros (maybe we can check every known model like __skylake,
__bdver2, ..., but it will be very error-prune and require an update
whenever we add the support for a new x86 model). The best thing we can
do seems "always try ifunc" here.
Bootstrapped and tested on x86_64-linux-gnu. Ok for trunk?
libatomic/ChangeLog:
* configure.tgt: For x86_64, always set try_ifunc=yes.
---
libatomic/configure.tgt | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index a92ae9e8309..39dd5686f2e 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -100,9 +100,7 @@ EOF
fi
cat > conftestx.c <<EOF
#ifdef __x86_64__
-#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16
-#error need -mcx16
-#endif
+#error ifunc is always wanted for 16B atomic load
#else
#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
#error need -march=i686
--
2.41.0
next reply other threads:[~2023-06-03 11:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-03 11:25 Xi Ruoyao [this message]
2023-06-03 12:53 ` Bernhard Reutner-Fischer
2023-06-03 13:46 ` Xi Ruoyao
2023-06-03 14:04 ` Bernhard Reutner-Fischer
2023-06-09 12:37 ` Ping: " Xi Ruoyao
2023-06-09 12:49 ` Jakub Jelinek
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=20230603112532.3264658-1-xry111@xry111.site \
--to=xry111@xry111.site \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
/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).