[PATCH, i386] Handle extended family cpuid info for AMD
Uros Bizjak
ubizjak@gmail.com
Fri Aug 1 18:25:00 GMT 2014
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.
More information about the Gcc-patches
mailing list