File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ maintenance = { status = "experimental" }
25
25
libc = { version = " 0.2" , optional = true , default-features = false }
26
26
cfg-if = " 0.1.10"
27
27
28
+ [target .'cfg(target_os="windows")' .dependencies ]
29
+ winapi = {version = " 0.3.8" , features = [" processthreadsapi" ]}
30
+
28
31
[dev-dependencies ]
29
32
auxv = " 0.3.3"
30
33
cupid = " 0.6.0"
Original file line number Diff line number Diff line change @@ -106,6 +106,9 @@ cfg_if! {
106
106
mod aarch64;
107
107
#[ path = "os/freebsd/mod.rs" ]
108
108
mod os;
109
+ } else if #[ cfg( all( target_os = "windows" , target_arch = "aarch64" ) ) ] {
110
+ #[ path = "os/windows/aarch64.rs" ]
111
+ mod os;
109
112
} else {
110
113
#[ path = "os/other.rs" ]
111
114
mod os;
Original file line number Diff line number Diff line change
1
+ //! Run-time feature detection for Aarch64 on Windows.
2
+
3
+ use crate :: detect:: { cache, Feature } ;
4
+ use winapi:: um:: processthreadsapi:: IsProcessorFeaturePresent ;
5
+ use winapi:: um:: winnt:: * ;
6
+
7
+ /// Try to read the features from OS API.
8
+ pub ( crate ) fn detect_features ( ) -> cache:: Initializer {
9
+ let mut value = cache:: Initializer :: default ( ) ;
10
+ {
11
+ let mut enable_feature = |f, enable| {
12
+ if enable {
13
+ value. set ( f as u32 ) ;
14
+ }
15
+ } ;
16
+ enable_feature ( Feature :: asimd, unsafe {
17
+ IsProcessorFeaturePresent ( PF_ARM_NEON_INSTRUCTIONS_AVAILABLE ) != 0
18
+ } ) ;
19
+ enable_feature ( Feature :: crc, unsafe {
20
+ IsProcessorFeaturePresent ( PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE ) != 0
21
+ } ) ;
22
+ enable_feature ( Feature :: crypto, unsafe {
23
+ IsProcessorFeaturePresent ( PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE ) != 0
24
+ } ) ;
25
+ enable_feature ( Feature :: pmull, unsafe {
26
+ IsProcessorFeaturePresent ( PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE ) != 0
27
+ } ) ;
28
+ }
29
+ value
30
+ }
You can’t perform that action at this time.
0 commit comments