@@ -67,18 +67,18 @@ pub(crate) fn detect_features() -> cache::Initializer {
67
67
..
68
68
} = unsafe { __cpuid ( 0x0000_0001_u32 ) } ;
69
69
70
- // EAX = 7, ECX = 0 : Queries "Extended Features";
70
+ // EAX = 7: Queries "Extended Features";
71
71
// Contains information about bmi,bmi2, and avx2 support.
72
72
let (
73
- extended_features_eax,
74
73
extended_features_ebx,
75
74
extended_features_ecx,
76
75
extended_features_edx,
76
+ extended_features_eax_leaf_1,
77
77
) = if max_basic_leaf >= 7 {
78
- let CpuidResult {
79
- eax, ebx , ecx , edx , ..
80
- } = unsafe { __cpuid ( 0x0000_0007_u32 ) } ;
81
- ( eax , ebx, ecx, edx)
78
+ let CpuidResult { ebx , ecx , edx , .. } = unsafe { __cpuid ( 0x0000_0007_u32 ) } ;
79
+ let CpuidResult { eax : eax_1 , .. } =
80
+ unsafe { __cpuid_count ( 0x0000_0007_u32 , 0x0000_0001_u32 ) } ;
81
+ ( ebx, ecx, edx, eax_1 )
82
82
} else {
83
83
( 0 , 0 , 0 , 0 ) // CPUID does not support "Extended Features"
84
84
} ;
@@ -206,7 +206,6 @@ pub(crate) fn detect_features() -> cache::Initializer {
206
206
// For AVX-512 the OS also needs to support saving/restoring
207
207
// the extended state, only then we enable AVX-512 support:
208
208
if os_avx512_support {
209
- enable ( extended_features_eax, 5 , Feature :: avx512bf16) ;
210
209
enable ( extended_features_ebx, 16 , Feature :: avx512f) ;
211
210
enable ( extended_features_ebx, 17 , Feature :: avx512dq) ;
212
211
enable ( extended_features_ebx, 21 , Feature :: avx512ifma) ;
@@ -225,6 +224,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
225
224
enable ( extended_features_ecx, 14 , Feature :: avx512vpopcntdq) ;
226
225
enable ( extended_features_edx, 8 , Feature :: avx512vp2intersect) ;
227
226
enable ( extended_features_edx, 23 , Feature :: avx512fp16) ;
227
+ enable ( extended_features_eax_leaf_1, 5 , Feature :: avx512bf16) ;
228
228
}
229
229
}
230
230
}
0 commit comments