]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libatomic: x86_64: Always try ifunc
authorXi Ruoyao <xry111@xry111.site>
Fri, 2 Jun 2023 18:25:44 +0000 (02:25 +0800)
committerXi Ruoyao <xry111@xry111.site>
Sat, 10 Jun 2023 13:43:56 +0000 (21:43 +0800)
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.

libatomic/configure.tgt

index a92ae9e8309b2a986627038cc8f9e6908ef7fc1c..39dd5686f2e65168578d7479446b4f3b5a03e513 100644 (file)
@@ -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