Message ID | 20201214131302.GE3788@tucnak |
---|---|
State | New |
Headers | show |
Series | i386: Make -march=x86-64-v[234] behave more like other -march= options | expand |
On Mon, Dec 14, 2020 at 2:13 PM Jakub Jelinek <jakub@redhat.com> wrote: > > Hi! > > 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-32=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. > > Ok for trunk if this passes full bootstrap/regtest? > > 2020-12-14 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. LGTM, but please allow some time for HJ to comment. Thanks, Uros. > > --- gcc/config/i386/i386-options.c.jj 2020-12-08 15:43:46.641140657 +0100 > +++ gcc/config/i386/i386-options.c 2020-12-14 13:31:51.864733294 +0100 > @@ -2084,17 +2084,6 @@ ix86_option_override_internal (bool main > return false; > } > > - /* The feature-only micro-architecture levels that use > - PTA_NO_TUNE are only defined for the x86-64 psABI. */ > - if ((processor_alias_table[i].flags & PTA_NO_TUNE) != 0 > - && (!TARGET_64BIT_P (opts->x_ix86_isa_flags) > - || opts->x_ix86_abi != SYSV_ABI)) > - { > - error (G_("%qs architecture level is only defined" > - " for the x86-64 psABI"), opts->x_ix86_arch_string); > - return false; > - } > - > ix86_schedule = processor_alias_table[i].schedule; > ix86_arch = processor_alias_table[i].processor; > > --- gcc/config.gcc.jj 2020-12-08 10:36:28.817303511 +0100 > +++ gcc/config.gcc 2020-12-14 14:00:27.571656138 +0100 > @@ -4517,10 +4517,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 > ;; > --- gcc/doc/invoke.texi.jj 2020-12-09 23:51:01.284558982 +0100 > +++ gcc/doc/invoke.texi 2020-12-14 13:36:45.523458639 +0100 > @@ -29778,8 +29778,9 @@ A generic CPU with 64-bit extensions. > @itemx x86-64-v3 > @itemx x86-64-v4 > These choices for @var{cpu-type} select the corresponding > -micro-architecture level from the x86-64 psABI. They are only available > -when compiling for an x86-64 target that uses the System V psABI@. > +micro-architecture level from the x86-64 psABI. On ABIs other than > +the x86-64 psABI they select the same CPU features as the x86-64 psABI > +documents for the particular micro-architecture level. > > Since these @var{cpu-type} values do not have a corresponding > @option{-mtune} setting, using @option{-march} with these values enables > --- gcc/testsuite/gcc.target/i386/x86-64-v2.c.jj 2020-10-12 12:30:34.327813333 +0200 > +++ gcc/testsuite/gcc.target/i386/x86-64-v2.c 2020-12-14 13:48:35.039554681 +0100 > @@ -12,8 +12,10 @@ > #ifndef __SSE2__ > # error __SSE2__ not defined > #endif > -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > +#ifdef __x86_64__ > +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > +# endif > #endif > #ifndef __LAHF_SAHF__ > # error __LAHF_SAHF__ not defined > --- gcc/testsuite/gcc.target/i386/x86-64-v2-other.c.jj 2020-12-14 13:46:04.355233294 +0100 > +++ gcc/testsuite/gcc.target/i386/x86-64-v2-other.c 2020-12-14 13:46:04.355233294 +0100 > @@ -0,0 +1,5 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=x86-64-v2" } */ > + > +/* Verify -march=x86-64-v2 works even with -m32 or -mabi=ms. */ > +#include "x86-64-v2.c" > --- gcc/testsuite/gcc.target/i386/x86-64-v2-msabi.c.jj 2020-12-14 13:46:04.356233283 +0100 > +++ gcc/testsuite/gcc.target/i386/x86-64-v2-msabi.c 2020-12-14 13:46:04.356233283 +0100 > @@ -0,0 +1,5 @@ > +/* { dg-do compile { target lp64 } } */ > +/* { dg-options "-mabi=ms -march=x86-64-v2" } */ > + > +/* Verify -march=x86-64-v2 works even with -mabi=ms. */ > +#include "x86-64-v2.c" > --- gcc/testsuite/gcc.target/i386/x86-64-v3.c.jj 2020-10-12 12:30:34.327813333 +0200 > +++ gcc/testsuite/gcc.target/i386/x86-64-v3.c 2020-12-14 13:48:53.391350247 +0100 > @@ -1,7 +1,7 @@ > /* { dg-do compile { target { ! ia32 } } } */ > /* { dg-options "-mabi=sysv -march=x86-64-v3" } */ > > -/* Verify that the CPU features required by x86-64-v4 are enabled. */ > +/* Verify that the CPU features required by x86-64-v3 are enabled. */ > > #ifndef __MMX__ > # error __MMX__ not defined > @@ -12,8 +12,10 @@ > #ifndef __SSE2__ > # error __SSE2__ not defined > #endif > -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > +#ifdef __x86_64__ > +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > +# endif > #endif > #ifndef __LAHF_SAHF__ > # error __LAHF_SAHF__ not defined > --- gcc/testsuite/gcc.target/i386/x86-64-v3-other.c.jj 2020-12-14 13:46:04.355233294 +0100 > +++ gcc/testsuite/gcc.target/i386/x86-64-v3-other.c 2020-12-14 13:46:04.355233294 +0100 > @@ -0,0 +1,5 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=x86-64-v3" } */ > + > +/* Verify -march=x86-64-v3 works even with -m32 or -mabi=ms. */ > +#include "x86-64-v3.c" > --- gcc/testsuite/gcc.target/i386/x86-64-v3-msabi.c.jj 2020-12-14 13:46:04.355233294 +0100 > +++ gcc/testsuite/gcc.target/i386/x86-64-v3-msabi.c 2020-12-14 13:46:04.355233294 +0100 > @@ -0,0 +1,5 @@ > +/* { dg-do compile { target lp64 } } */ > +/* { dg-options "-mabi=ms -march=x86-64-v3" } */ > + > +/* Verify -march=x86-64-v3 works even with -mabi=ms. */ > +#include "x86-64-v3.c" > --- gcc/testsuite/gcc.target/i386/x86-64-v4.c.jj 2020-10-12 12:30:34.328813318 +0200 > +++ gcc/testsuite/gcc.target/i386/x86-64-v4.c 2020-12-14 13:49:09.620169461 +0100 > @@ -12,8 +12,10 @@ > #ifndef __SSE2__ > # error __SSE2__ not defined > #endif > -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > +#ifdef __x86_64__ > +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > +# endif > #endif > #ifndef __LAHF_SAHF__ > # error __LAHF_SAHF__ not defined > --- gcc/testsuite/gcc.target/i386/x86-64-v4-other.c.jj 2020-12-14 13:46:04.355233294 +0100 > +++ gcc/testsuite/gcc.target/i386/x86-64-v4-other.c 2020-12-14 13:46:04.355233294 +0100 > @@ -0,0 +1,5 @@ > +/* { dg-do compile } */ > +/* { dg-options "-march=x86-64-v4" } */ > + > +/* Verify -march=x86-64-v4 works even with -m32 or -mabi=ms. */ > +#include "x86-64-v4.c" > --- gcc/testsuite/gcc.target/i386/x86-64-v4-msabi.c.jj 2020-12-14 13:46:04.356233283 +0100 > +++ gcc/testsuite/gcc.target/i386/x86-64-v4-msabi.c 2020-12-14 13:46:04.356233283 +0100 > @@ -0,0 +1,5 @@ > +/* { dg-do compile { target lp64 } } */ > +/* { dg-options "-mabi=ms -march=x86-64-v4" } */ > + > +/* Verify -march=x86-64-v4 works even with -mabi=ms. */ > +#include "x86-64-v4.c" > > Jakub >
On Mon, Dec 14, 2020 at 7:09 AM Uros Bizjak <ubizjak@gmail.com> wrote: > > On Mon, Dec 14, 2020 at 2:13 PM Jakub Jelinek <jakub@redhat.com> wrote: > > > > Hi! > > > > 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-32=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. > > > > Ok for trunk if this passes full bootstrap/regtest? > > > > 2020-12-14 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. > > LGTM, but please allow some time for HJ to comment. LGTM too. Thanks. > Thanks, > Uros. > > > > > --- gcc/config/i386/i386-options.c.jj 2020-12-08 15:43:46.641140657 +0100 > > +++ gcc/config/i386/i386-options.c 2020-12-14 13:31:51.864733294 +0100 > > @@ -2084,17 +2084,6 @@ ix86_option_override_internal (bool main > > return false; > > } > > > > - /* The feature-only micro-architecture levels that use > > - PTA_NO_TUNE are only defined for the x86-64 psABI. */ > > - if ((processor_alias_table[i].flags & PTA_NO_TUNE) != 0 > > - && (!TARGET_64BIT_P (opts->x_ix86_isa_flags) > > - || opts->x_ix86_abi != SYSV_ABI)) > > - { > > - error (G_("%qs architecture level is only defined" > > - " for the x86-64 psABI"), opts->x_ix86_arch_string); > > - return false; > > - } > > - > > ix86_schedule = processor_alias_table[i].schedule; > > ix86_arch = processor_alias_table[i].processor; > > > > --- gcc/config.gcc.jj 2020-12-08 10:36:28.817303511 +0100 > > +++ gcc/config.gcc 2020-12-14 14:00:27.571656138 +0100 > > @@ -4517,10 +4517,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 > > ;; > > --- gcc/doc/invoke.texi.jj 2020-12-09 23:51:01.284558982 +0100 > > +++ gcc/doc/invoke.texi 2020-12-14 13:36:45.523458639 +0100 > > @@ -29778,8 +29778,9 @@ A generic CPU with 64-bit extensions. > > @itemx x86-64-v3 > > @itemx x86-64-v4 > > These choices for @var{cpu-type} select the corresponding > > -micro-architecture level from the x86-64 psABI. They are only available > > -when compiling for an x86-64 target that uses the System V psABI@. > > +micro-architecture level from the x86-64 psABI. On ABIs other than > > +the x86-64 psABI they select the same CPU features as the x86-64 psABI > > +documents for the particular micro-architecture level. > > > > Since these @var{cpu-type} values do not have a corresponding > > @option{-mtune} setting, using @option{-march} with these values enables > > --- gcc/testsuite/gcc.target/i386/x86-64-v2.c.jj 2020-10-12 12:30:34.327813333 +0200 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v2.c 2020-12-14 13:48:35.039554681 +0100 > > @@ -12,8 +12,10 @@ > > #ifndef __SSE2__ > > # error __SSE2__ not defined > > #endif > > -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > > -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > > +#ifdef __x86_64__ > > +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > > +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > > +# endif > > #endif > > #ifndef __LAHF_SAHF__ > > # error __LAHF_SAHF__ not defined > > --- gcc/testsuite/gcc.target/i386/x86-64-v2-other.c.jj 2020-12-14 13:46:04.355233294 +0100 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v2-other.c 2020-12-14 13:46:04.355233294 +0100 > > @@ -0,0 +1,5 @@ > > +/* { dg-do compile } */ > > +/* { dg-options "-march=x86-64-v2" } */ > > + > > +/* Verify -march=x86-64-v2 works even with -m32 or -mabi=ms. */ > > +#include "x86-64-v2.c" > > --- gcc/testsuite/gcc.target/i386/x86-64-v2-msabi.c.jj 2020-12-14 13:46:04.356233283 +0100 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v2-msabi.c 2020-12-14 13:46:04.356233283 +0100 > > @@ -0,0 +1,5 @@ > > +/* { dg-do compile { target lp64 } } */ > > +/* { dg-options "-mabi=ms -march=x86-64-v2" } */ > > + > > +/* Verify -march=x86-64-v2 works even with -mabi=ms. */ > > +#include "x86-64-v2.c" > > --- gcc/testsuite/gcc.target/i386/x86-64-v3.c.jj 2020-10-12 12:30:34.327813333 +0200 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v3.c 2020-12-14 13:48:53.391350247 +0100 > > @@ -1,7 +1,7 @@ > > /* { dg-do compile { target { ! ia32 } } } */ > > /* { dg-options "-mabi=sysv -march=x86-64-v3" } */ > > > > -/* Verify that the CPU features required by x86-64-v4 are enabled. */ > > +/* Verify that the CPU features required by x86-64-v3 are enabled. */ > > > > #ifndef __MMX__ > > # error __MMX__ not defined > > @@ -12,8 +12,10 @@ > > #ifndef __SSE2__ > > # error __SSE2__ not defined > > #endif > > -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > > -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > > +#ifdef __x86_64__ > > +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > > +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > > +# endif > > #endif > > #ifndef __LAHF_SAHF__ > > # error __LAHF_SAHF__ not defined > > --- gcc/testsuite/gcc.target/i386/x86-64-v3-other.c.jj 2020-12-14 13:46:04.355233294 +0100 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v3-other.c 2020-12-14 13:46:04.355233294 +0100 > > @@ -0,0 +1,5 @@ > > +/* { dg-do compile } */ > > +/* { dg-options "-march=x86-64-v3" } */ > > + > > +/* Verify -march=x86-64-v3 works even with -m32 or -mabi=ms. */ > > +#include "x86-64-v3.c" > > --- gcc/testsuite/gcc.target/i386/x86-64-v3-msabi.c.jj 2020-12-14 13:46:04.355233294 +0100 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v3-msabi.c 2020-12-14 13:46:04.355233294 +0100 > > @@ -0,0 +1,5 @@ > > +/* { dg-do compile { target lp64 } } */ > > +/* { dg-options "-mabi=ms -march=x86-64-v3" } */ > > + > > +/* Verify -march=x86-64-v3 works even with -mabi=ms. */ > > +#include "x86-64-v3.c" > > --- gcc/testsuite/gcc.target/i386/x86-64-v4.c.jj 2020-10-12 12:30:34.328813318 +0200 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v4.c 2020-12-14 13:49:09.620169461 +0100 > > @@ -12,8 +12,10 @@ > > #ifndef __SSE2__ > > # error __SSE2__ not defined > > #endif > > -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > > -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > > +#ifdef __x86_64__ > > +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 > > +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined > > +# endif > > #endif > > #ifndef __LAHF_SAHF__ > > # error __LAHF_SAHF__ not defined > > --- gcc/testsuite/gcc.target/i386/x86-64-v4-other.c.jj 2020-12-14 13:46:04.355233294 +0100 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v4-other.c 2020-12-14 13:46:04.355233294 +0100 > > @@ -0,0 +1,5 @@ > > +/* { dg-do compile } */ > > +/* { dg-options "-march=x86-64-v4" } */ > > + > > +/* Verify -march=x86-64-v4 works even with -m32 or -mabi=ms. */ > > +#include "x86-64-v4.c" > > --- gcc/testsuite/gcc.target/i386/x86-64-v4-msabi.c.jj 2020-12-14 13:46:04.356233283 +0100 > > +++ gcc/testsuite/gcc.target/i386/x86-64-v4-msabi.c 2020-12-14 13:46:04.356233283 +0100 > > @@ -0,0 +1,5 @@ > > +/* { dg-do compile { target lp64 } } */ > > +/* { dg-options "-mabi=ms -march=x86-64-v4" } */ > > + > > +/* Verify -march=x86-64-v4 works even with -mabi=ms. */ > > +#include "x86-64-v4.c" > > > > Jakub > >
--- gcc/config/i386/i386-options.c.jj 2020-12-08 15:43:46.641140657 +0100 +++ gcc/config/i386/i386-options.c 2020-12-14 13:31:51.864733294 +0100 @@ -2084,17 +2084,6 @@ ix86_option_override_internal (bool main return false; } - /* The feature-only micro-architecture levels that use - PTA_NO_TUNE are only defined for the x86-64 psABI. */ - if ((processor_alias_table[i].flags & PTA_NO_TUNE) != 0 - && (!TARGET_64BIT_P (opts->x_ix86_isa_flags) - || opts->x_ix86_abi != SYSV_ABI)) - { - error (G_("%qs architecture level is only defined" - " for the x86-64 psABI"), opts->x_ix86_arch_string); - return false; - } - ix86_schedule = processor_alias_table[i].schedule; ix86_arch = processor_alias_table[i].processor; --- gcc/config.gcc.jj 2020-12-08 10:36:28.817303511 +0100 +++ gcc/config.gcc 2020-12-14 14:00:27.571656138 +0100 @@ -4517,10 +4517,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 ;; --- gcc/doc/invoke.texi.jj 2020-12-09 23:51:01.284558982 +0100 +++ gcc/doc/invoke.texi 2020-12-14 13:36:45.523458639 +0100 @@ -29778,8 +29778,9 @@ A generic CPU with 64-bit extensions. @itemx x86-64-v3 @itemx x86-64-v4 These choices for @var{cpu-type} select the corresponding -micro-architecture level from the x86-64 psABI. They are only available -when compiling for an x86-64 target that uses the System V psABI@. +micro-architecture level from the x86-64 psABI. On ABIs other than +the x86-64 psABI they select the same CPU features as the x86-64 psABI +documents for the particular micro-architecture level. Since these @var{cpu-type} values do not have a corresponding @option{-mtune} setting, using @option{-march} with these values enables --- gcc/testsuite/gcc.target/i386/x86-64-v2.c.jj 2020-10-12 12:30:34.327813333 +0200 +++ gcc/testsuite/gcc.target/i386/x86-64-v2.c 2020-12-14 13:48:35.039554681 +0100 @@ -12,8 +12,10 @@ #ifndef __SSE2__ # error __SSE2__ not defined #endif -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined +#ifdef __x86_64__ +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined +# endif #endif #ifndef __LAHF_SAHF__ # error __LAHF_SAHF__ not defined --- gcc/testsuite/gcc.target/i386/x86-64-v2-other.c.jj 2020-12-14 13:46:04.355233294 +0100 +++ gcc/testsuite/gcc.target/i386/x86-64-v2-other.c 2020-12-14 13:46:04.355233294 +0100 @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-march=x86-64-v2" } */ + +/* Verify -march=x86-64-v2 works even with -m32 or -mabi=ms. */ +#include "x86-64-v2.c" --- gcc/testsuite/gcc.target/i386/x86-64-v2-msabi.c.jj 2020-12-14 13:46:04.356233283 +0100 +++ gcc/testsuite/gcc.target/i386/x86-64-v2-msabi.c 2020-12-14 13:46:04.356233283 +0100 @@ -0,0 +1,5 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-mabi=ms -march=x86-64-v2" } */ + +/* Verify -march=x86-64-v2 works even with -mabi=ms. */ +#include "x86-64-v2.c" --- gcc/testsuite/gcc.target/i386/x86-64-v3.c.jj 2020-10-12 12:30:34.327813333 +0200 +++ gcc/testsuite/gcc.target/i386/x86-64-v3.c 2020-12-14 13:48:53.391350247 +0100 @@ -1,7 +1,7 @@ /* { dg-do compile { target { ! ia32 } } } */ /* { dg-options "-mabi=sysv -march=x86-64-v3" } */ -/* Verify that the CPU features required by x86-64-v4 are enabled. */ +/* Verify that the CPU features required by x86-64-v3 are enabled. */ #ifndef __MMX__ # error __MMX__ not defined @@ -12,8 +12,10 @@ #ifndef __SSE2__ # error __SSE2__ not defined #endif -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined +#ifdef __x86_64__ +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined +# endif #endif #ifndef __LAHF_SAHF__ # error __LAHF_SAHF__ not defined --- gcc/testsuite/gcc.target/i386/x86-64-v3-other.c.jj 2020-12-14 13:46:04.355233294 +0100 +++ gcc/testsuite/gcc.target/i386/x86-64-v3-other.c 2020-12-14 13:46:04.355233294 +0100 @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-march=x86-64-v3" } */ + +/* Verify -march=x86-64-v3 works even with -m32 or -mabi=ms. */ +#include "x86-64-v3.c" --- gcc/testsuite/gcc.target/i386/x86-64-v3-msabi.c.jj 2020-12-14 13:46:04.355233294 +0100 +++ gcc/testsuite/gcc.target/i386/x86-64-v3-msabi.c 2020-12-14 13:46:04.355233294 +0100 @@ -0,0 +1,5 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-mabi=ms -march=x86-64-v3" } */ + +/* Verify -march=x86-64-v3 works even with -mabi=ms. */ +#include "x86-64-v3.c" --- gcc/testsuite/gcc.target/i386/x86-64-v4.c.jj 2020-10-12 12:30:34.328813318 +0200 +++ gcc/testsuite/gcc.target/i386/x86-64-v4.c 2020-12-14 13:49:09.620169461 +0100 @@ -12,8 +12,10 @@ #ifndef __SSE2__ # error __SSE2__ not defined #endif -#ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 -# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined +#ifdef __x86_64__ +# ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 +# error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 not defined +# endif #endif #ifndef __LAHF_SAHF__ # error __LAHF_SAHF__ not defined --- gcc/testsuite/gcc.target/i386/x86-64-v4-other.c.jj 2020-12-14 13:46:04.355233294 +0100 +++ gcc/testsuite/gcc.target/i386/x86-64-v4-other.c 2020-12-14 13:46:04.355233294 +0100 @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-options "-march=x86-64-v4" } */ + +/* Verify -march=x86-64-v4 works even with -m32 or -mabi=ms. */ +#include "x86-64-v4.c" --- gcc/testsuite/gcc.target/i386/x86-64-v4-msabi.c.jj 2020-12-14 13:46:04.356233283 +0100 +++ gcc/testsuite/gcc.target/i386/x86-64-v4-msabi.c 2020-12-14 13:46:04.356233283 +0100 @@ -0,0 +1,5 @@ +/* { dg-do compile { target lp64 } } */ +/* { dg-options "-mabi=ms -march=x86-64-v4" } */ + +/* Verify -march=x86-64-v4 works even with -mabi=ms. */ +#include "x86-64-v4.c"