aboutsummaryrefslogtreecommitdiff
path: root/gcc/config.gcc
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2020-12-15 09:51:28 +0100
committerJakub Jelinek <jakub@redhat.com>2020-12-15 09:51:28 +0100
commit59482fa1e7243bd905c7e27c92ae2b89c79fff87 (patch)
tree0e905ede32d70838708111398fd7190b22936920 /gcc/config.gcc
parentefd08ad579a1dea6409bd280cb5c263ed0849839 (diff)
downloadgcc-59482fa1e7243bd905c7e27c92ae2b89c79fff87.zip
gcc-59482fa1e7243bd905c7e27c92ae2b89c79fff87.tar.gz
gcc-59482fa1e7243bd905c7e27c92ae2b89c79fff87.tar.bz2
i386: Make -march=x86-64-v[234] behave more like other -march= options
If somebody has -march=x86-64-v2 (or -v3 or -v4) in $CFLAGS, $CXXFLAGS etc., then -m32 or -mabi=ms stops working. What is worse, if one configures gcc --with-arch-64=x86-64-v2 (or -v3 or -v4), then -mabi=ms stops working. I think that is a nightmare user experience. It is ok that x86-64-v[234] behave slightly different from other -march= options (in that they imply unless overridden -mtune=generic rather then -mtune= equal to the -march argument), but the error when one mixes it with -mabi=ms, or -m32 doesn't improve anything. It is true that the exact option set is only defined in the x86-64 psABI (IMHO that is a mistake too, we should copy that into the GCC documentation like we document it for any other -march= option), but there is no reason why that exact set of CPU features can't be used for other ABIs, it is just a set of CPU features. If we add micro-architecture levels to the 32-bit ABI (I doubt anyone wants to do that, but just hypothetically), then those micro-architecture levels wouldn't certainly be called x86-64-v* but perhaps i386-v*. In the tests, __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 can't be expected on -m32 not because the CPU feature wouldn't be set, but because the instruction is 64-bit only and 32-bit code doesn't have __int128 etc. support. 2020-12-15 Jakub Jelinek <jakub@redhat.com> * config/i386/i386-options.c (ix86_option_override_internal): Don't error on -march=x86-64-v[234] with -m32 or -mabi=ms. * config.gcc: Don't reject --with-arch=x86-64-v[234] or --with-arch_32=x86-64-v[234]. * doc/invoke.texi (-march=x86-64-v[234]): Document what the option does for other ABIs. * gcc.target/i386/x86-64-v2.c: Don't expect __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 to be defined with -m32. * gcc.target/i386/x86-64-v2-other.c: New test. * gcc.target/i386/x86-64-v2-msabi.c: New test. * gcc.target/i386/x86-64-v3.c: Fix a comment pasto. Don't expect __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 to be defined with -m32. * gcc.target/i386/x86-64-v3-other.c: New test. * gcc.target/i386/x86-64-v3-msabi.c: New test. * gcc.target/i386/x86-64-v4.c:Don't expect __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 to be defined with -m32. * gcc.target/i386/x86-64-v4-other.c: New test. * gcc.target/i386/x86-64-v4-msabi.c: New test.
Diffstat (limited to 'gcc/config.gcc')
-rw-r--r--gcc/config.gcc4
1 files changed, 1 insertions, 3 deletions
diff --git a/gcc/config.gcc b/gcc/config.gcc
index a54f675..81b5523 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -4519,10 +4519,8 @@ case "${target}" in
case " $x86_64_archs " in
*" ${val} "*)
# Disallow x86-64-v* for --with-cpu=/--with-tune=
- # or --with-arch= or --with-arch_32=
- # It can be only specified in --with-arch_64=
case "x$which$val" in
- xcpu*x86-64-v*|xtune*x86-64-v*|xarchx86-64-v*|xarch_32x86-64-v*)
+ xcpu*x86-64-v*|xtune*x86-64-v*)
echo "Unknown CPU given in --with-$which=$val." 1>&2
exit 1
;;