This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug driver/50740] CPUID leaf 7 for BMI/BMI2/AVX2 feature detection not qualified with max_level and doesn't use subleaf
- From: "warnerme at ptd dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 12 Dec 2017 20:22:18 +0000
- Subject: [Bug driver/50740] CPUID leaf 7 for BMI/BMI2/AVX2 feature detection not qualified with max_level and doesn't use subleaf
- Auto-submitted: auto-generated
- References: <bug-50740-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=50740
Mark Warner <warnerme at ptd dot net> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |warnerme at ptd dot net
--- Comment #4 from Mark Warner <warnerme at ptd dot net> ---
In the file cpuid.h, there is a problem with the definition:
#define __cpuid(level, a, b, c, d) \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level))
With the ecx undefined, the leaf 7 (Extended Features %eax == 7) can not be
accessed. Leaf 7 (%eax) can only be accessed when sub-leaf (%ecx) is 0
I suggest instead:
#define __cpuid(level, a, b, c, d) \
__asm__ ("cpuid\n\t" \
: "=a" (a), "=b" (b), "=c" (c), "=d" (d) \
: "0" (level), "2" (0))