File tree 1 file changed +8
-1
lines changed
crates/std_detect/src/detect/os
1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -233,9 +233,16 @@ pub(crate) fn detect_features() -> cache::Initializer {
233
233
enable ( extended_features_eax_leaf_1, 1 , Feature :: sm3) ;
234
234
enable ( extended_features_eax_leaf_1, 2 , Feature :: sm4) ;
235
235
236
+ let f16c = bit:: test ( proc_info_ecx as usize , 29 ) ;
237
+ let fma = bit:: test ( proc_info_ecx as usize , 12 ) ;
238
+
236
239
// For AVX-512 the OS also needs to support saving/restoring
237
240
// the extended state, only then we enable AVX-512 support:
238
- if os_avx512_support {
241
+ // Also, Rust makes `avx512f` imply `fma` and `f16c`, because
242
+ // otherwise the assembler is broken. But Intel doesn't guarantee
243
+ // that `fma` and `f16c` are available with `avx512f`, so we
244
+ // need to check for them separately.
245
+ if os_avx512_support && f16c && fma {
239
246
enable ( extended_features_ebx, 16 , Feature :: avx512f) ;
240
247
enable ( extended_features_ebx, 17 , Feature :: avx512dq) ;
241
248
enable ( extended_features_ebx, 21 , Feature :: avx512ifma) ;
You can’t perform that action at this time.
0 commit comments