[Bug target/77756] __get_cpuid() returns wrong values for level 7 (extended features)

ubizjak at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Oct 1 08:29:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77756

--- Comment #13 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Yale Zhang from comment #12)
> What's the purpose of subleaf? Is it to distinguish the capabilities of
> different cores in a heterogeneous chip (e.g. ARM big-little)?

No, it is just a value in ECX that in some cases specifies what information to
return.

> Then I would be fine with making this an extra parameter to __get_cpuid(). 

cpuid.h is exported public header and we would break backward compatibility in
this case.

> Microsoft has a __cpuidex() function that also takes subleaf, but for the
> regular __cpuid(), the subleaf default to 0. Should __get_cpuid() default to
> 0 as well?

I think there is no need for default 0. Rhere are other cases (e.g. level 13)
that uses other subleafs to get capabilites info. So, there is no rule, and
defaulting to 0 would be confusing. One should use __get_cpuid_count when
subleaf is to be specified.


More information about the Gcc-bugs mailing list