http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50740
Bug #: 50740
Summary: CPUID leaf 7 for BMI/BMI2/AVX2 feature detection not
qualified with max_level and doesn't use subleaf
Classification: Unclassified
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: driver
AssignedTo: [email protected]
ReportedBy: [email protected]
The cpuid code for detecting BMI, BMI2, and AVX2 support needs to be qualified
with max_level >= 7. Additionally, it should use __cpuid_count instead of
__cpuid because leaf 7 uses subleafs just like leaf 4.
Relevant code from i386-driver.c
__cpuid (0x7, eax, ebx, ecx, edx);
has_bmi = ebx & bit_BMI;
has_avx2 = ebx & bit_AVX2;
has_bmi2 = ebx & bit_BMI2;