On Wed, Oct 21, 2020 at 5:15 PM Jakub Jelinek <ja...@redhat.com> wrote:
>
> On Wed, Sep 30, 2020 at 06:06:31PM +0200, Florian Weimer wrote:
> > --- a/gcc/common/config/i386/i386-common.c
> > +++ b/gcc/common/config/i386/i386-common.c
> > @@ -1795,9 +1795,13 @@ const pta processor_alias_table[] =
> >      PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE | PTA_FXSR, 0, P_NONE},
> >    {"athlon-mp", PROCESSOR_ATHLON, CPU_ATHLON,
> >      PTA_MMX | PTA_3DNOW | PTA_3DNOW_A | PTA_SSE | PTA_FXSR, 0, P_NONE},
> > -  {"x86-64", PROCESSOR_K8, CPU_K8,
> > -    PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_NO_SAHF | PTA_FXSR,
> > -    0, P_NONE},
> > +  {"x86-64", PROCESSOR_K8, CPU_K8, PTA_X86_64_BASELINE, 0, P_NONE},
> > +  {"x86-64-v2", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V2 | PTA_NO_TUNE,
> > +   0, P_NONE},
> > +  {"x86-64-v3", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V3 | PTA_NO_TUNE,
> > +   0, P_NONE},
> > +  {"x86-64-v4", PROCESSOR_K8, CPU_GENERIC, PTA_X86_64_V4 | PTA_NO_TUNE,
> > +   0, P_NONE},
> >    {"eden-x2", PROCESSOR_K8, CPU_K8,
> >      PTA_64BIT | PTA_MMX | PTA_SSE | PTA_SSE2 | PTA_SSE3 | PTA_FXSR,
> >      0, P_NONE},
>
> I have noticed that one can't configure gcc to default to these.
>
> I've also found various other 32-bit or 64-bit -march= arguments for which
> it wasn't possible to configure gcc to default to those.
>
> The x86-64-v* the patch only allows in --with-arch_64=, because otherwise
> it fails build miserably - as
> ./xgcc -B ./ -S -march=x86-64-v2 -m32 test.c
> cc1: error: ‘x86-64-v2’ architecture level is only defined for the x86-64 
> psABI
> when building 32-bit multilibs.  Even if multilibs are disallowed, I think
> the compiler still supports -m32 and so --with-arch_64= seems to be the only
> option in which we can support that.
>
> Ok for trunk if this passes bootstrap/regtest?  So far I've just tested that
> e.g. --with-tune=x86-64-v3 build fails as expected and 
> --with-arch_64=x86-64-v3
> one went fine.
>
> 2020-10-21  Jakub Jelinek  <ja...@redhat.com>
>
>         * config.gcc (x86_archs): Add samuel-2, nehemiah, c7 and esther.
>         (x86_64_archs): Add eden-x2, nano, nano-1000, nano-2000, nano-3000,
>         nano-x2, eden-x4, nano-x4, x86-64-v2, x86-64-v3 and x86-64-v4.
>         (i[34567]86-*-* | x86_64-*-*): Only allow x86-64-v* as argument
>         to --with-arch_64=.

LGTM.

Thanks,
Uros.

>
> --- gcc/config.gcc.jj   2020-10-15 09:04:50.614521860 +0200
> +++ gcc/config.gcc      2020-10-21 17:03:10.396077993 +0200
> @@ -662,7 +662,8 @@ tm_defines="$tm_defines LIBC_GLIBC=1 LIB
>  x86_archs="athlon athlon-4 athlon-fx athlon-mp athlon-tbird \
>  athlon-xp k6 k6-2 k6-3 geode c3 c3-2 winchip-c6 winchip2 i386 i486 \
>  i586 i686 pentium pentium-m pentium-mmx pentium2 pentium3 pentium3m \
> -pentium4 pentium4m pentiumpro prescott lakemont"
> +pentium4 pentium4m pentiumpro prescott lakemont samuel-2 nehemiah \
> +c7 esther"
>
>  # 64-bit x86 processors supported by --with-arch=.  Each processor
>  # MUST be separated by exactly one space.
> @@ -672,7 +673,8 @@ opteron-sse3 nocona core2 corei7 corei7-
>  slm nehalem westmere sandybridge ivybridge haswell broadwell bonnell \
>  silvermont knl knm skylake-avx512 cannonlake icelake-client icelake-server \
>  skylake goldmont goldmont-plus tremont cascadelake tigerlake cooperlake \
> -sapphirerapids alderlake x86-64 native"
> +sapphirerapids alderlake eden-x2 nano nano-1000 nano-2000 nano-3000 \
> +nano-x2 eden-x4 nano-x4 x86-64 x86-64-v2 x86-64-v3 x86-64-v4 native"
>
>  # Additional x86 processors supported by --with-cpu=.  Each processor
>  # MUST be separated by exactly one space.
> @@ -4458,6 +4460,17 @@ case "${target}" in
>                                 if test x${val} != x; then
>                                         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*)
> +                                                       echo "Unknown CPU 
> given in --with-$which=$val." 1>&2
> +                                                       exit 1
> +                                                       ;;
> +                                               *)
> +                                                       ;;
> +                                               esac
>                                                 # OK
>                                                 ;;
>                                         *)
>
>         Jakub
>

Reply via email to