public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-1686] libatomic: x86_64: Always try ifunc
@ 2023-06-10 13:45 Xi Ruoyao
  0 siblings, 0 replies; only message in thread
From: Xi Ruoyao @ 2023-06-10 13:45 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:db80262475d28ae074a2cda7a1a6c2ea525791b9

commit r14-1686-gdb80262475d28ae074a2cda7a1a6c2ea525791b9
Author: Xi Ruoyao <xry111@xry111.site>
Date:   Sat Jun 3 02:25:44 2023 +0800

    libatomic: x86_64: Always try ifunc
    
    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.
    
    libatomic/ChangeLog:
    
            * configure.tgt: For x86_64, always set try_ifunc=yes.

Diff:
---
 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

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

only message in thread, other threads:[~2023-06-10 13:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-10 13:45 [gcc r14-1686] libatomic: x86_64: Always try ifunc Xi Ruoyao

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