@@ -69,13 +69,19 @@ pub(crate) fn detect_features() -> cache::Initializer {
69
69
70
70
// EAX = 7, ECX = 0: Queries "Extended Features";
71
71
// Contains information about bmi,bmi2, and avx2 support.
72
- let ( extended_features_ebx, extended_features_ecx, extended_features_edx) =
73
- if max_basic_leaf >= 7 {
74
- let CpuidResult { ebx, ecx, edx, .. } = unsafe { __cpuid ( 0x0000_0007_u32 ) } ;
75
- ( ebx, ecx, edx)
76
- } else {
77
- ( 0 , 0 , 0 ) // CPUID does not support "Extended Features"
78
- } ;
72
+ let (
73
+ extended_features_eax,
74
+ extended_features_ebx,
75
+ extended_features_ecx,
76
+ extended_features_edx,
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)
82
+ } else {
83
+ ( 0 , 0 , 0 , 0 ) // CPUID does not support "Extended Features"
84
+ } ;
79
85
80
86
// EAX = 0x8000_0000, ECX = 0: Get Highest Extended Function Supported
81
87
// - EAX returns the max leaf value for extended information, that is,
@@ -200,6 +206,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
200
206
// For AVX-512 the OS also needs to support saving/restoring
201
207
// the extended state, only then we enable AVX-512 support:
202
208
if os_avx512_support {
209
+ enable ( extended_features_eax, 5 , Feature :: avx512bf16) ;
203
210
enable ( extended_features_ebx, 16 , Feature :: avx512f) ;
204
211
enable ( extended_features_ebx, 17 , Feature :: avx512dq) ;
205
212
enable ( extended_features_ebx, 21 , Feature :: avx512ifma) ;
@@ -209,15 +216,14 @@ pub(crate) fn detect_features() -> cache::Initializer {
209
216
enable ( extended_features_ebx, 30 , Feature :: avx512bw) ;
210
217
enable ( extended_features_ebx, 31 , Feature :: avx512vl) ;
211
218
enable ( extended_features_ecx, 1 , Feature :: avx512vbmi) ;
212
- enable ( extended_features_ecx, 5 , Feature :: avx512bf16) ;
213
219
enable ( extended_features_ecx, 6 , Feature :: avx512vbmi2) ;
214
220
enable ( extended_features_ecx, 8 , Feature :: gfni) ;
215
- enable ( extended_features_ecx, 8 , Feature :: avx512vp2intersect) ;
216
221
enable ( extended_features_ecx, 9 , Feature :: vaes) ;
217
222
enable ( extended_features_ecx, 10 , Feature :: vpclmulqdq) ;
218
223
enable ( extended_features_ecx, 11 , Feature :: avx512vnni) ;
219
224
enable ( extended_features_ecx, 12 , Feature :: avx512bitalg) ;
220
225
enable ( extended_features_ecx, 14 , Feature :: avx512vpopcntdq) ;
226
+ enable ( extended_features_edx, 8 , Feature :: avx512vp2intersect) ;
221
227
enable ( extended_features_edx, 23 , Feature :: avx512fp16) ;
222
228
}
223
229
}
0 commit comments