1 | //! Aarch64 run-time features. |
2 | |
3 | features! { |
4 | @TARGET: aarch64; |
5 | @CFG: target_arch = "aarch64" ; |
6 | @MACRO_NAME: is_aarch64_feature_detected; |
7 | @MACRO_ATTRS: |
8 | /// This macro tests, at runtime, whether an `aarch64` feature is enabled on aarch64 platforms. |
9 | /// Currently most features are only supported on linux-based platforms. |
10 | /// |
11 | /// This macro takes one argument which is a string literal of the feature being tested for. |
12 | /// The feature names are mostly taken from their FEAT_* definitions in the [ARM Architecture |
13 | /// Reference Manual][docs]. |
14 | /// |
15 | /// ## Supported arguments |
16 | /// |
17 | /// * `"asimd"` or "neon" - FEAT_AdvSIMD |
18 | /// * `"pmull"` - FEAT_PMULL |
19 | /// * `"fp"` - FEAT_FP |
20 | /// * `"fp16"` - FEAT_FP16 |
21 | /// * `"sve"` - FEAT_SVE |
22 | /// * `"crc"` - FEAT_CRC |
23 | /// * `"lse"` - FEAT_LSE |
24 | /// * `"lse2"` - FEAT_LSE2 |
25 | /// * `"rdm"` - FEAT_RDM |
26 | /// * `"rcpc"` - FEAT_LRCPC |
27 | /// * `"rcpc2"` - FEAT_LRCPC2 |
28 | /// * `"dotprod"` - FEAT_DotProd |
29 | /// * `"tme"` - FEAT_TME |
30 | /// * `"fhm"` - FEAT_FHM |
31 | /// * `"dit"` - FEAT_DIT |
32 | /// * `"flagm"` - FEAT_FLAGM |
33 | /// * `"ssbs"` - FEAT_SSBS |
34 | /// * `"sb"` - FEAT_SB |
35 | /// * `"paca"` - FEAT_PAuth (address authentication) |
36 | /// * `"pacg"` - FEAT_Pauth (generic authentication) |
37 | /// * `"dpb"` - FEAT_DPB |
38 | /// * `"dpb2"` - FEAT_DPB2 |
39 | /// * `"sve2"` - FEAT_SVE2 |
40 | /// * `"sve2-aes"` - FEAT_SVE2_AES |
41 | /// * `"sve2-sm4"` - FEAT_SVE2_SM4 |
42 | /// * `"sve2-sha3"` - FEAT_SVE2_SHA3 |
43 | /// * `"sve2-bitperm"` - FEAT_SVE2_BitPerm |
44 | /// * `"frintts"` - FEAT_FRINTTS |
45 | /// * `"i8mm"` - FEAT_I8MM |
46 | /// * `"f32mm"` - FEAT_F32MM |
47 | /// * `"f64mm"` - FEAT_F64MM |
48 | /// * `"bf16"` - FEAT_BF16 |
49 | /// * `"rand"` - FEAT_RNG |
50 | /// * `"bti"` - FEAT_BTI |
51 | /// * `"mte"` - FEAT_MTE |
52 | /// * `"jsconv"` - FEAT_JSCVT |
53 | /// * `"fcma"` - FEAT_FCMA |
54 | /// * `"aes"` - FEAT_AES |
55 | /// * `"sha2"` - FEAT_SHA1 & FEAT_SHA256 |
56 | /// * `"sha3"` - FEAT_SHA512 & FEAT_SHA3 |
57 | /// * `"sm4"` - FEAT_SM3 & FEAT_SM4 |
58 | /// |
59 | /// [docs]: https://developer.arm.com/documentation/ddi0487/latest |
60 | #[stable (feature = "simd_aarch64" , since = "1.60.0" )] |
61 | @BIND_FEATURE_NAME: "asimd" ; "neon" ; |
62 | @NO_RUNTIME_DETECTION: "ras" ; |
63 | @NO_RUNTIME_DETECTION: "v8.1a" ; |
64 | @NO_RUNTIME_DETECTION: "v8.2a" ; |
65 | @NO_RUNTIME_DETECTION: "v8.3a" ; |
66 | @NO_RUNTIME_DETECTION: "v8.4a" ; |
67 | @NO_RUNTIME_DETECTION: "v8.5a" ; |
68 | @NO_RUNTIME_DETECTION: "v8.6a" ; |
69 | @NO_RUNTIME_DETECTION: "v8.7a" ; |
70 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] asimd: "neon" ; |
71 | /// FEAT_AdvSIMD (Advanced SIMD/NEON) |
72 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] pmull: "pmull" ; |
73 | /// FEAT_PMULL (Polynomial Multiply) |
74 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] fp: "fp" ; |
75 | implied by target_features: ["neon" ]; |
76 | /// FEAT_FP (Floating point support) - Implied by `neon` target_feature |
77 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] fp16: "fp16" ; |
78 | /// FEAT_FP16 (Half-float support) |
79 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sve: "sve" ; |
80 | /// FEAT_SVE (Scalable Vector Extension) |
81 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] crc: "crc" ; |
82 | /// FEAT_CRC32 (Cyclic Redundancy Check) |
83 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] lse: "lse" ; |
84 | /// FEAT_LSE (Large System Extension - atomics) |
85 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] lse2: "lse2" ; |
86 | /// FEAT_LSE2 (unaligned and register-pair atomics) |
87 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] rdm: "rdm" ; |
88 | /// FEAT_RDM (Rounding Doubling Multiply - ASIMDRDM) |
89 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] rcpc: "rcpc" ; |
90 | /// FEAT_LRCPC (Release consistent Processor consistent) |
91 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] rcpc2: "rcpc2" ; |
92 | /// FEAT_LRCPC2 (RCPC with immediate offsets) |
93 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] dotprod: "dotprod" ; |
94 | /// FEAT_DotProd (Vector Dot-Product - ASIMDDP) |
95 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] tme: "tme" ; |
96 | /// FEAT_TME (Transactional Memory Extensions) |
97 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] fhm: "fhm" ; |
98 | /// FEAT_FHM (fp16 multiplication instructions) |
99 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] dit: "dit" ; |
100 | /// FEAT_DIT (Data Independent Timing instructions) |
101 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] flagm: "flagm" ; |
102 | /// FEAT_FLAGM (flag manipulation instructions) |
103 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] ssbs: "ssbs" ; |
104 | /// FEAT_SSBS (speculative store bypass safe) |
105 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sb: "sb" ; |
106 | /// FEAT_SB (speculation barrier) |
107 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] paca: "paca" ; |
108 | /// FEAT_PAuth (address authentication) |
109 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] pacg: "pacg" ; |
110 | /// FEAT_PAuth (generic authentication) |
111 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] dpb: "dpb" ; |
112 | /// FEAT_DPB (aka dcpop - data cache clean to point of persistence) |
113 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] dpb2: "dpb2" ; |
114 | /// FEAT_DPB2 (aka dcpodp - data cache clean to point of deep persistence) |
115 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sve2: "sve2" ; |
116 | /// FEAT_SVE2 (Scalable Vector Extension 2) |
117 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sve2_aes: "sve2-aes" ; |
118 | /// FEAT_SVE_AES (SVE2 AES crypto) |
119 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sve2_sm4: "sve2-sm4" ; |
120 | /// FEAT_SVE_SM4 (SVE2 SM4 crypto) |
121 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sve2_sha3: "sve2-sha3" ; |
122 | /// FEAT_SVE_SHA3 (SVE2 SHA3 crypto) |
123 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sve2_bitperm: "sve2-bitperm" ; |
124 | /// FEAT_SVE_BitPerm (SVE2 bit permutation instructions) |
125 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] frintts: "frintts" ; |
126 | /// FEAT_FRINTTS (float to integer rounding instructions) |
127 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] i8mm: "i8mm" ; |
128 | /// FEAT_I8MM (integer matrix multiplication, plus ASIMD support) |
129 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] f32mm: "f32mm" ; |
130 | /// FEAT_F32MM (single-precision matrix multiplication) |
131 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] f64mm: "f64mm" ; |
132 | /// FEAT_F64MM (double-precision matrix multiplication) |
133 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] bf16: "bf16" ; |
134 | /// FEAT_BF16 (BFloat16 type, plus MM instructions, plus ASIMD support) |
135 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] rand: "rand" ; |
136 | /// FEAT_RNG (Random Number Generator) |
137 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] bti: "bti" ; |
138 | /// FEAT_BTI (Branch Target Identification) |
139 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] mte: "mte" ; |
140 | /// FEAT_MTE (Memory Tagging Extension) |
141 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] jsconv: "jsconv" ; |
142 | /// FEAT_JSCVT (JavaScript float conversion instructions) |
143 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] fcma: "fcma" ; |
144 | /// FEAT_FCMA (float complex number operations) |
145 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] aes: "aes" ; |
146 | /// FEAT_AES (AES instructions) |
147 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sha2: "sha2" ; |
148 | /// FEAT_SHA1 & FEAT_SHA256 (SHA1 & SHA2-256 instructions) |
149 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sha3: "sha3" ; |
150 | /// FEAT_SHA512 & FEAT_SHA3 (SHA2-512 & SHA3 instructions) |
151 | @FEATURE: #[stable (feature = "simd_aarch64" , since = "1.60.0" )] sm4: "sm4" ; |
152 | /// FEAT_SM3 & FEAT_SM4 (SM3 & SM4 instructions) |
153 | } |
154 | |