@@ -11,6 +11,7 @@ pub(crate) fn detect_features() -> cache::Initializer {
11
11
// The following Microsoft documents isn't updated for aarch64.
12
12
// https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-isprocessorfeaturepresent
13
13
// These are defined in winnt.h of Windows SDK
14
+ const PF_ARM_VFP_32_REGISTERS_AVAILABLE : u32 = 18 ;
14
15
const PF_ARM_NEON_INSTRUCTIONS_AVAILABLE : u32 = 19 ;
15
16
const PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE : u32 = 30 ;
16
17
const PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE : u32 = 31 ;
@@ -31,10 +32,14 @@ pub(crate) fn detect_features() -> cache::Initializer {
31
32
}
32
33
} ;
33
34
34
- // Some features such Feature::fp may be supported on current CPU,
35
+ // Some features may be supported on current CPU,
35
36
// but no way to detect it by OS API.
36
37
// Also, we require unsafe block for the extern "system" calls.
37
38
unsafe {
39
+ enable_feature (
40
+ Feature :: fp,
41
+ IsProcessorFeaturePresent ( PF_ARM_VFP_32_REGISTERS_AVAILABLE ) != FALSE ,
42
+ ) ;
38
43
enable_feature (
39
44
Feature :: asimd,
40
45
IsProcessorFeaturePresent ( PF_ARM_NEON_INSTRUCTIONS_AVAILABLE ) != FALSE ,
@@ -61,18 +66,11 @@ pub(crate) fn detect_features() -> cache::Initializer {
61
66
) ;
62
67
// PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE means aes, sha1, sha2 and
63
68
// pmull support
64
- enable_feature (
65
- Feature :: aes,
66
- IsProcessorFeaturePresent ( PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE ) != FALSE ,
67
- ) ;
68
- enable_feature (
69
- Feature :: pmull,
70
- IsProcessorFeaturePresent ( PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE ) != FALSE ,
71
- ) ;
72
- enable_feature (
73
- Feature :: sha2,
74
- IsProcessorFeaturePresent ( PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE ) != FALSE ,
75
- ) ;
69
+ let crypto =
70
+ IsProcessorFeaturePresent ( PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE ) != FALSE ;
71
+ enable_feature ( Feature :: aes, crypto) ;
72
+ enable_feature ( Feature :: pmull, crypto) ;
73
+ enable_feature ( Feature :: sha2, crypto) ;
76
74
}
77
75
}
78
76
value
0 commit comments