File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -103,6 +103,8 @@ features! {
103103 /// * `"xsaves"`
104104 /// * `"xsavec"`
105105 /// * `"cmpxchg16b"`
106+ /// * `"kl"`
107+ /// * `"widekl"`
106108 /// * `"adx"`
107109 /// * `"rtm"`
108110 /// * `"movbe"`
@@ -241,6 +243,10 @@ features! {
241243 /// XSAVEC (Save Processor Extended States Compacted)
242244 @FEATURE : #[ stable( feature = "simd_x86" , since = "1.27.0" ) ] cmpxchg16b: "cmpxchg16b" ;
243245 /// CMPXCH16B (16-byte compare-and-swap instruction)
246+ @FEATURE : #[ unstable( feature = "keylocker_x86" , issue = "134813" ) ] kl: "kl" ;
247+ /// Intel Key Locker
248+ @FEATURE : #[ unstable( feature = "keylocker_x86" , issue = "134813" ) ] widekl: "widekl" ;
249+ /// Intel Key Locker Wide
244250 @FEATURE : #[ stable( feature = "simd_x86_adx" , since = "1.33.0" ) ] adx: "adx" ;
245251 /// ADX, Intel ADX (Multi-Precision Add-Carry Instruction Extensions)
246252 @FEATURE : #[ stable( feature = "simd_x86" , since = "1.27.0" ) ] rtm: "rtm" ;
Original file line number Diff line number Diff line change @@ -141,6 +141,13 @@ pub(crate) fn detect_features() -> cache::Initializer {
141141
142142 enable ( extended_features_ebx, 9 , Feature :: ermsb) ;
143143
144+ // Detect if CPUID.19h available
145+ if bit:: test ( extended_features_ecx as usize , 23 ) {
146+ let CpuidResult { ebx, .. } = unsafe { __cpuid ( 0x19 ) } ;
147+ enable ( ebx, 0 , Feature :: kl) ;
148+ enable ( ebx, 2 , Feature :: widekl) ;
149+ }
150+
144151 // `XSAVE` and `AVX` support:
145152 let cpu_xsave = bit:: test ( proc_info_ecx as usize , 26 ) ;
146153 if cpu_xsave {
Original file line number Diff line number Diff line change 55 avx512_target_feature,
66 sha512_sm_x86,
77 x86_amx_intrinsics,
8- xop_target_feature
8+ xop_target_feature,
9+ keylocker_x86
910) ]
1011
1112extern crate cupid;
@@ -94,6 +95,8 @@ fn dump() {
9495 println ! ( "amx-fp16: {:?}" , is_x86_feature_detected!( "amx-fp16" ) ) ;
9596 println ! ( "amx-complex: {:?}" , is_x86_feature_detected!( "amx-complex" ) ) ;
9697 println ! ( "xop: {:?}" , is_x86_feature_detected!( "xop" ) ) ;
98+ println ! ( "kl: {:?}" , is_x86_feature_detected!( "kl" ) ) ;
99+ println ! ( "widekl: {:?}" , is_x86_feature_detected!( "widekl" ) ) ;
97100}
98101
99102#[ cfg( feature = "std_detect_env_override" ) ]
You can’t perform that action at this time.
0 commit comments