File tree 6 files changed +38
-2
lines changed
6 files changed +38
-2
lines changed Original file line number Diff line number Diff line change 33
33
asm_const,
34
34
target_feature_11,
35
35
generic_arg_infer,
36
- asm_experimental_arch
36
+ asm_experimental_arch,
37
+ sha512_sm_x86
37
38
) ]
38
39
#![ cfg_attr( test, feature( test, abi_vectorcall, stdarch_internal) ) ]
39
40
#![ deny( clippy:: missing_inline_in_public_items) ]
Original file line number Diff line number Diff line change @@ -325,3 +325,15 @@ mod nvptx;
325
325
#[ cfg( any( target_arch = "loongarch64" , doc) ) ]
326
326
#[ doc( cfg( target_arch = "loongarch64" ) ) ]
327
327
mod loongarch64;
328
+
329
+ // TODO: remove after merge of rustc #126704
330
+ #[ unstable( feature = "sha512_sm_x86" , issue = "126624" ) ]
331
+ unsafe fn dummy ( ) {
332
+ // This has to be here until PR #126704 gets merged into rustc,
333
+ // because otherwise rustc cannot compile because aarch64 also has
334
+ // a target feature named sm4, and that is stable. For `doc` env this
335
+ // gets compiled also in x86, but in x86 the feature sm4 is unstable
336
+ // So we need `feature(sha512_sm_x86)` somewhere, but if we place it without
337
+ // any unstable attr, rustc cannot compile stage0, because it doesn't know about
338
+ // this feature yet.
339
+ }
Original file line number Diff line number Diff line change @@ -57,6 +57,9 @@ features! {
57
57
/// * `"sha"`
58
58
/// * `"avx"`
59
59
/// * `"avx2"`
60
+ /// * `"sha512"`
61
+ /// * `"sm3"`
62
+ /// * `"sm4"`
60
63
/// * `"avx512f"`
61
64
/// * `"avx512cd"`
62
65
/// * `"avx512er"`
@@ -138,6 +141,12 @@ features! {
138
141
/// AVX (Advanced Vector Extensions)
139
142
@FEATURE : #[ stable( feature = "simd_x86" , since = "1.27.0" ) ] avx2: "avx2" ;
140
143
/// AVX2 (Advanced Vector Extensions 2)
144
+ @FEATURE : #[ unstable( feature = "sha512_sm_x86" , issue = "126624" ) ] sha512: "sha512" ;
145
+ /// SHA512
146
+ @FEATURE : #[ unstable( feature = "sha512_sm_x86" , issue = "126624" ) ] sm3: "sm3" ;
147
+ /// SM3
148
+ @FEATURE : #[ unstable( feature = "sha512_sm_x86" , issue = "126624" ) ] sm4: "sm4" ;
149
+ /// SM4
141
150
@FEATURE : #[ stable( feature = "simd_x86" , since = "1.27.0" ) ] avx512f: "avx512f" ;
142
151
/// AVX-512 F (Foundation)
143
152
@FEATURE : #[ stable( feature = "simd_x86" , since = "1.27.0" ) ] avx512cd: "avx512cd" ;
Original file line number Diff line number Diff line change @@ -217,6 +217,10 @@ pub(crate) fn detect_features() -> cache::Initializer {
217
217
enable ( extended_features_edx_leaf_1, 5 , Feature :: avxneconvert) ;
218
218
enable ( extended_features_edx_leaf_1, 10 , Feature :: avxvnniint16) ;
219
219
220
+ enable ( extended_features_eax_leaf_1, 0 , Feature :: sha512) ;
221
+ enable ( extended_features_eax_leaf_1, 1 , Feature :: sm3) ;
222
+ enable ( extended_features_eax_leaf_1, 2 , Feature :: sm4) ;
223
+
220
224
// For AVX-512 the OS also needs to support saving/restoring
221
225
// the extended state, only then we enable AVX-512 support:
222
226
if os_avx512_support {
Original file line number Diff line number Diff line change 3
3
#![ cfg_attr( target_arch = "arm" , feature( stdarch_arm_feature_detection) ) ]
4
4
#![ cfg_attr( target_arch = "powerpc" , feature( stdarch_powerpc_feature_detection) ) ]
5
5
#![ cfg_attr( target_arch = "powerpc64" , feature( stdarch_powerpc_feature_detection) ) ]
6
+ #![ cfg_attr(
7
+ any( target_arch = "x86" , target_arch = "x86_64" ) ,
8
+ feature( sha512_sm_x86)
9
+ ) ]
6
10
#![ allow( clippy:: unwrap_used, clippy:: use_debug, clippy:: print_stdout) ]
7
11
8
12
#[ cfg_attr(
@@ -210,6 +214,9 @@ fn x86_all() {
210
214
println ! ( "sha: {:?}" , is_x86_feature_detected!( "sha" ) ) ;
211
215
println ! ( "avx: {:?}" , is_x86_feature_detected!( "avx" ) ) ;
212
216
println ! ( "avx2: {:?}" , is_x86_feature_detected!( "avx2" ) ) ;
217
+ println ! ( "sha512: {:?}" , is_x86_feature_detected!( "sha512" ) ) ;
218
+ println ! ( "sm3: {:?}" , is_x86_feature_detected!( "sm3" ) ) ;
219
+ println ! ( "sm4: {:?}" , is_x86_feature_detected!( "sm4" ) ) ;
213
220
println ! ( "avx512f: {:?}" , is_x86_feature_detected!( "avx512f" ) ) ;
214
221
println ! ( "avx512cd: {:?}" , is_x86_feature_detected!( "avx512cd" ) ) ;
215
222
println ! ( "avx512er: {:?}" , is_x86_feature_detected!( "avx512er" ) ) ;
Original file line number Diff line number Diff line change 1
1
#![ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
2
2
#![ allow( internal_features) ]
3
- #![ feature( stdarch_internal, avx512_target_feature) ]
3
+ #![ feature( stdarch_internal, avx512_target_feature, sha512_sm_x86 ) ]
4
4
5
5
extern crate cupid;
6
6
#[ macro_use]
@@ -24,6 +24,9 @@ fn dump() {
24
24
println ! ( "f16c: {:?}" , is_x86_feature_detected!( "f16c" ) ) ;
25
25
println ! ( "avx: {:?}" , is_x86_feature_detected!( "avx" ) ) ;
26
26
println ! ( "avx2: {:?}" , is_x86_feature_detected!( "avx2" ) ) ;
27
+ println ! ( "sha512: {:?}" , is_x86_feature_detected!( "sha512" ) ) ;
28
+ println ! ( "sm3: {:?}" , is_x86_feature_detected!( "sm3" ) ) ;
29
+ println ! ( "sm4: {:?}" , is_x86_feature_detected!( "sm4" ) ) ;
27
30
println ! ( "avx512f {:?}" , is_x86_feature_detected!( "avx512f" ) ) ;
28
31
println ! ( "avx512cd {:?}" , is_x86_feature_detected!( "avx512cd" ) ) ;
29
32
println ! ( "avx512er {:?}" , is_x86_feature_detected!( "avx512er" ) ) ;
You can’t perform that action at this time.
0 commit comments