File tree 2 files changed +14
-4
lines changed
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 {
254
254
}
255
255
}
256
256
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 as usize , 21 ) {
266
+ value = set_bit ( value, __Feature:: tbm as u32 ) ;
267
+ }
259
268
}
260
269
261
270
value
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ fn works() {
24
24
assert_eq ! ( cfg_feature_enabled!( "bmi" ) , information. bmi1( ) ) ;
25
25
assert_eq ! ( cfg_feature_enabled!( "bmi2" ) , information. bmi2( ) ) ;
26
26
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
29
30
}
You can’t perform that action at this time.
0 commit comments