diff options
| author | Mingzhuo Yin <yinmingzhuo@gmail.com> | 2024-03-03 09:54:10 +0800 |
|---|---|---|
| committer | Amanieu d'Antras <amanieu@gmail.com> | 2024-03-05 23:16:09 +0000 |
| commit | 012e4ce580a9024040bab39dcdaef396ac3fa681 (patch) | |
| tree | 9fa2dcf61fa6b8123cab9038e12d476ce04d9449 /library/stdarch/crates/std_detect | |
| parent | 210913f1c4d46e33f5a18a7105b15371ca24ece0 (diff) | |
| download | rust-012e4ce580a9024040bab39dcdaef396ac3fa681.tar.gz rust-012e4ce580a9024040bab39dcdaef396ac3fa681.zip | |
check sub-leaf to detect avx512bf16
Signed-off-by: Mingzhuo Yin <yinmingzhuo@gmail.com>
Diffstat (limited to 'library/stdarch/crates/std_detect')
| -rw-r--r-- | library/stdarch/crates/std_detect/src/detect/os/x86.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/library/stdarch/crates/std_detect/src/detect/os/x86.rs b/library/stdarch/crates/std_detect/src/detect/os/x86.rs index 971e56c1403..3e55baa7d8c 100644 --- a/library/stdarch/crates/std_detect/src/detect/os/x86.rs +++ b/library/stdarch/crates/std_detect/src/detect/os/x86.rs @@ -67,18 +67,18 @@ pub(crate) fn detect_features() -> cache::Initializer { .. } = unsafe { __cpuid(0x0000_0001_u32) }; - // EAX = 7, ECX = 0: Queries "Extended Features"; + // EAX = 7: Queries "Extended Features"; // Contains information about bmi,bmi2, and avx2 support. let ( - extended_features_eax, extended_features_ebx, extended_features_ecx, extended_features_edx, + extended_features_eax_leaf_1, ) = if max_basic_leaf >= 7 { - let CpuidResult { - eax, ebx, ecx, edx, .. - } = unsafe { __cpuid(0x0000_0007_u32) }; - (eax, ebx, ecx, edx) + let CpuidResult { ebx, ecx, edx, .. } = unsafe { __cpuid(0x0000_0007_u32) }; + let CpuidResult { eax: eax_1, .. } = + unsafe { __cpuid_count(0x0000_0007_u32, 0x0000_0001_u32) }; + (ebx, ecx, edx, eax_1) } else { (0, 0, 0, 0) // CPUID does not support "Extended Features" }; @@ -206,7 +206,6 @@ pub(crate) fn detect_features() -> cache::Initializer { // For AVX-512 the OS also needs to support saving/restoring // the extended state, only then we enable AVX-512 support: if os_avx512_support { - enable(extended_features_eax, 5, Feature::avx512bf16); enable(extended_features_ebx, 16, Feature::avx512f); enable(extended_features_ebx, 17, Feature::avx512dq); enable(extended_features_ebx, 21, Feature::avx512ifma); @@ -225,6 +224,7 @@ pub(crate) fn detect_features() -> cache::Initializer { enable(extended_features_ecx, 14, Feature::avx512vpopcntdq); enable(extended_features_edx, 8, Feature::avx512vp2intersect); enable(extended_features_edx, 23, Feature::avx512fp16); + enable(extended_features_eax_leaf_1, 5, Feature::avx512bf16); } } } |
