Message ID | EB4625145972F94C9680D8CADD651615787D62B5@SATLEXDAG02.amd.com |
---|---|
State | New |
Headers | show |
On Fri, Aug 01, 2014 at 02:52:28PM +0000, Gopalasubramanian, Ganesh wrote: > --- a/gcc/config/i386/driver-i386.c > +++ b/gcc/config/i386/driver-i386.c > @@ -432,7 +432,8 @@ const char *host_detect_local_cpu (int argc, const char **argv) > > model = (eax >> 4) & 0x0f; > family = (eax >> 8) & 0x0f; > - if (vendor == signature_INTEL_ebx) > + if ((vendor == signature_INTEL_ebx) || > + (vendor == signature_AMD_ebx)) Wrong formatting. No ()s around the comparisons needed, and || should go on the second line, not first. > @@ -576,7 +577,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) > > if (name == signature_NSC_ebx) > processor = PROCESSOR_GEODE; > - else if (has_movbe) > + else if (family == 22) > processor = PROCESSOR_BTVER2; Wouldn't it be safer to use has_movbe && family == 22? I mean, especially with emulators which choose to provide some architecture, but disable some CPUID flags it is IMHO safer to also check the flags. Jakub
On Fri, Aug 1, 2014 at 5:00 PM, Jakub Jelinek <jakub@redhat.com> wrote: >> --- a/gcc/config/i386/driver-i386.c >> +++ b/gcc/config/i386/driver-i386.c >> @@ -432,7 +432,8 @@ const char *host_detect_local_cpu (int argc, const char **argv) >> >> model = (eax >> 4) & 0x0f; >> family = (eax >> 8) & 0x0f; >> - if (vendor == signature_INTEL_ebx) >> + if ((vendor == signature_INTEL_ebx) || >> + (vendor == signature_AMD_ebx)) > > Wrong formatting. No ()s around the comparisons needed, and > || should go on the second line, not first. > >> @@ -576,7 +577,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) >> >> if (name == signature_NSC_ebx) >> processor = PROCESSOR_GEODE; >> - else if (has_movbe) >> + else if (family == 22) >> processor = PROCESSOR_BTVER2; > > Wouldn't it be safer to use has_movbe && family == 22? > I mean, especially with emulators which choose to provide some architecture, > but disable some CPUID flags it is IMHO safer to also check the flags. OK, after rethinking this, let's go with the safer original patch (sorry for a bit of confusion, but we cleared a lot of open questions during the discussion). The original patch is OK for mainline and branches. OTOH, it looks we will have to redesign -march=native someday to only pass options, derived from cpuid and eventually pass -mtune based on detected family. Thanks, Uros.
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 706fedc..202bd99 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-08-01 Ganesh Gopalasubramanian <Ganesh.Gopalasubramanian@amd.com> + + * config/i386/driver-i386.c (host_detect_local_cpu): Handle AMD's extended family + information. Handle BTVER2 cpu with cpuid family value. + 2014-07-31 James Greenhalgh <james.greenhalgh@arm.com> * config/aarch64/arm_neon.h (vpadd_<suf><8,16,32,64>): Move to diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c index 1c6385f..0402c90 100644 --- a/gcc/config/i386/driver-i386.c +++ b/gcc/config/i386/driver-i386.c @@ -432,7 +432,8 @@ const char *host_detect_local_cpu (int argc, const char **argv) model = (eax >> 4) & 0x0f; family = (eax >> 8) & 0x0f; - if (vendor == signature_INTEL_ebx) + if ((vendor == signature_INTEL_ebx) || + (vendor == signature_AMD_ebx)) { unsigned int extended_model, extended_family; @@ -576,7 +577,7 @@ const char *host_detect_local_cpu (int argc, const char **argv) if (name == signature_NSC_ebx) processor = PROCESSOR_GEODE; - else if (has_movbe) + else if (family == 22) processor = PROCESSOR_BTVER2; else if (has_avx2) processor = PROCESSOR_BDVER4;