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

--- Comment #8 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to H.J. Lu from comment #7)
> Level 7 returns the maximum input value in EAX with ECX == 0.
> Level 9 and 10 don't use ECX as input.
> Level 11 takes ECX[7:0] as input level number.
> Level 13 takes many values in ECX as input.
> ....
> 
> There is no fixed rule of ECX input for level >= 7.

Thanks for clarifying - so, we should have simply:

static __inline int
__get_cpuid_subleaf (unsigned int __level, unsigned int __subleaf,
                     unsigned int *__eax, unsigned int *__ebx,
                     unsigned int *__ecx, unsigned int *__edx)
{
  unsigned int __ext = __level & 0x80000000;

  if (__get_cpuid_max (__ext, 0) < __level)
    return 0;

  if (__ext)
    __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);
  else if (__level >= 7)
    __cpuid_count (__level, __subleaf, *__eax, *__ebx, *__ecx, *__edx);
  else
    __cpuid (__level, *__eax, *__ebx, *__ecx, *__edx);

  return 1;
}

Reply via email to