> [AMD Public Use] > > Hi Honza, > > > -----Original Message----- > > From: Jan Hubicka <hubi...@ucw.cz> > > Sent: Wednesday, March 31, 2021 1:15 AM > > To: Kumar, Venkataramanan <venkataramanan.ku...@amd.com> > > Cc: Uros Bizjak <ubiz...@gmail.com>; gcc-patches@gcc.gnu.org > > Subject: Re: [PATCH] [X86_64]: Enable support for next generation AMD Zen3 > > CPU > > > > [CAUTION: External Email] > > > > Hi, > > this patch backports the initial support to gcc10 branch. Since the > > trunk and branch diverged there is non-trivial change to cpuinfo > > discovery. I do; > > > > --- a/libgcc/config/i386/cpuinfo.c > > +++ b/libgcc/config/i386/cpuinfo.c > > @@ -111,6 +111,12 @@ get_amd_cpu (unsigned int family, unsigned int model) > > if (model >= 0x30) > > __cpu_model.__cpu_subtype = AMDFAM17H_ZNVER2; > > break; > > + case 0x19: > > + __cpu_model.__cpu_type = AMDFAM19H; > > + /* AMD family 19h version 1. */ > > + if (model <= 0x0f) > > + __cpu_model.__cpu_subtype = AMDFAM19H_ZNVER3; > > + break; > > default: > > break; > > } > > > > While your patch also sets ZNVER3 for case where VAES is supporte that > > would require backporting more of logic detecting VAES. Is that > > necessary? > > I think you are referring to the below change. > > diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c > index ecdad5765d5..2bfa037dd8b 100644 > --- a/gcc/config/i386/driver-i386.c > +++ b/gcc/config/i386/driver-i386.c > @@ -455,6 +455,8 @@ const char *host_detect_local_cpu (int argc, const char > **argv) > processor = PROCESSOR_GEODE; > else if (has_feature (FEATURE_MOVBE) && family == 22) > processor = PROCESSOR_BTVER2; > + else if (has_feature (FEATURE_VAES)) > + processor = PROCESSOR_ZNVER3; > else if (has_feature (FEATURE_CLWB)) > processor = PROCESSOR_ZNVER2; > > My understanding is that when we use -march=native on znver3 machine it would > check for "vaes" to detect the machine. > Otherwise it would detect it as znver2 machine. So we need that detection > logic.
I was wondering about + case 0x19: + cpu_model->__cpu_type = AMDFAM19H; + /* AMD family 19h version 1. */ + if (model <= 0x0f) + { + cpu = "znver3"; + CHECK___builtin_cpu_is ("znver3"); + cpu_model->__cpu_subtype = AMDFAM19H_ZNVER3; + } + else if (has_cpu_feature (cpu_model, cpu_features2, + FEATURE_VAES)) + { + cpu = "znver3"; + CHECK___builtin_cpu_is ("znver3"); + cpu_model->__cpu_subtype = AMDFAM19H_ZNVER3; + } + break; For znver3 we detect the model number and I wonder why we also test the VAES feature when we don't do that for other families. Honza