File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -254,8 +254,17 @@ fn detect_features() -> usize {
254254 }
255255 }
256256
257- if test_bit ( proc_info_ecx, 21 ) && is_amd ( ) {
258- value = set_bit ( value, __Feature:: tbm as u32 ) ;
257+ if is_amd ( ) {
258+ let extended_proc_info_ecx: u32 ;
259+ /// 3. EAX=80000001h: Queries "Extended Processor Info and Feature Bits"
260+ asm ! ( "cpuid"
261+ : "={ecx}" ( extended_proc_info_ecx)
262+ : "{eax}" ( 0x8000_0001_u32 ) , "{ecx}" ( 0 as u32 )
263+ : : ) ;
264+
265+ if test_bit ( extended_proc_info_ecx, 21 ) {
266+ value = set_bit ( value, __Feature:: tbm as u32 ) ;
267+ }
259268 }
260269
261270 value
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ fn works() {
2424 assert_eq ! ( cfg_feature_enabled!( "bmi" ) , information. bmi1( ) ) ;
2525 assert_eq ! ( cfg_feature_enabled!( "bmi2" ) , information. bmi2( ) ) ;
2626 assert_eq ! ( cfg_feature_enabled!( "popcnt" ) , information. popcnt( ) ) ;
27-
28- // TODO: tbm, abm, lzcnt
27+ assert_eq ! ( cfg_feature_enabled!( "tbm" ) , information. tbm( ) ) ;
28+ assert_eq ! ( cfg_feature_enabled!( "lzcnt" ) , information. lzcnt( ) ) ;
29+ // TODO: abm
2930}
You can’t perform that action at this time.
0 commit comments