44use core:: arch:: x86:: * ;
55#[ cfg( target_arch = "x86_64" ) ]
66use core:: arch:: x86_64:: * ;
7-
87use core:: mem;
98
109use crate :: detect:: { Feature , bit, cache} ;
@@ -42,12 +41,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
4241 // 0x8000_0000]. - The vendor ID is stored in 12 u8 ascii chars,
4342 // returned in EBX, EDX, and ECX (in that order):
4443 let ( max_basic_leaf, vendor_id) = unsafe {
45- let CpuidResult {
46- eax : max_basic_leaf,
47- ebx,
48- ecx,
49- edx,
50- } = __cpuid ( 0 ) ;
44+ let CpuidResult { eax : max_basic_leaf, ebx, ecx, edx } = __cpuid ( 0 ) ;
5145 let vendor_id: [ [ u8 ; 4 ] ; 3 ] = [ ebx. to_ne_bytes ( ) , edx. to_ne_bytes ( ) , ecx. to_ne_bytes ( ) ] ;
5246 let vendor_id: [ u8 ; 12 ] = mem:: transmute ( vendor_id) ;
5347 ( max_basic_leaf, vendor_id)
@@ -60,11 +54,8 @@ pub(crate) fn detect_features() -> cache::Initializer {
6054
6155 // EAX = 1, ECX = 0: Queries "Processor Info and Feature Bits";
6256 // Contains information about most x86 features.
63- let CpuidResult {
64- ecx : proc_info_ecx,
65- edx : proc_info_edx,
66- ..
67- } = unsafe { __cpuid ( 0x0000_0001_u32 ) } ;
57+ let CpuidResult { ecx : proc_info_ecx, edx : proc_info_edx, .. } =
58+ unsafe { __cpuid ( 0x0000_0001_u32 ) } ;
6859
6960 // EAX = 7: Queries "Extended Features";
7061 // Contains information about bmi,bmi2, and avx2 support.
@@ -76,11 +67,8 @@ pub(crate) fn detect_features() -> cache::Initializer {
7667 extended_features_edx_leaf_1,
7768 ) = if max_basic_leaf >= 7 {
7869 let CpuidResult { ebx, ecx, edx, .. } = unsafe { __cpuid ( 0x0000_0007_u32 ) } ;
79- let CpuidResult {
80- eax : eax_1,
81- edx : edx_1,
82- ..
83- } = unsafe { __cpuid_count ( 0x0000_0007_u32 , 0x0000_0001_u32 ) } ;
70+ let CpuidResult { eax : eax_1, edx : edx_1, .. } =
71+ unsafe { __cpuid_count ( 0x0000_0007_u32 , 0x0000_0001_u32 ) } ;
8472 ( ebx, ecx, edx, eax_1, edx_1)
8573 } else {
8674 ( 0 , 0 , 0 , 0 , 0 ) // CPUID does not support "Extended Features"
@@ -89,10 +77,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
8977 // EAX = 0x8000_0000, ECX = 0: Get Highest Extended Function Supported
9078 // - EAX returns the max leaf value for extended information, that is,
9179 // `cpuid` calls in range [0x8000_0000; u32::MAX]:
92- let CpuidResult {
93- eax : extended_max_basic_leaf,
94- ..
95- } = unsafe { __cpuid ( 0x8000_0000_u32 ) } ;
80+ let CpuidResult { eax : extended_max_basic_leaf, .. } = unsafe { __cpuid ( 0x8000_0000_u32 ) } ;
9681
9782 // EAX = 0x8000_0001, ECX=0: Queries "Extended Processor Info and Feature
9883 // Bits"
@@ -208,10 +193,8 @@ pub(crate) fn detect_features() -> cache::Initializer {
208193 // Processor Extended State Enumeration Sub-leaf (EAX = 0DH,
209194 // ECX = 1):
210195 if max_basic_leaf >= 0xd {
211- let CpuidResult {
212- eax : proc_extended_state1_eax,
213- ..
214- } = unsafe { __cpuid_count ( 0xd_u32 , 1 ) } ;
196+ let CpuidResult { eax : proc_extended_state1_eax, .. } =
197+ unsafe { __cpuid_count ( 0xd_u32 , 1 ) } ;
215198 enable ( proc_extended_state1_eax, 0 , Feature :: xsaveopt) ;
216199 enable ( proc_extended_state1_eax, 1 , Feature :: xsavec) ;
217200 enable ( proc_extended_state1_eax, 3 , Feature :: xsaves) ;
@@ -269,10 +252,8 @@ pub(crate) fn detect_features() -> cache::Initializer {
269252 enable ( extended_features_edx_leaf_1, 8 , Feature :: amx_complex) ;
270253
271254 if max_basic_leaf >= 0x1e {
272- let CpuidResult {
273- eax : amx_feature_flags_eax,
274- ..
275- } = unsafe { __cpuid_count ( 0x1e_u32 , 1 ) } ;
255+ let CpuidResult { eax : amx_feature_flags_eax, .. } =
256+ unsafe { __cpuid_count ( 0x1e_u32 , 1 ) } ;
276257
277258 enable ( amx_feature_flags_eax, 4 , Feature :: amx_fp8) ;
278259 enable ( amx_feature_flags_eax, 5 , Feature :: amx_transpose) ;
0 commit comments