1//! Aarch64 run-time features.
2
3features! {
4 @TARGET: aarch64;
5 @CFG: any(target_arch = "aarch64", target_arch = "arm64ec");
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 & FEAT_SSBS2
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 & FEAT_MTE2
52 /// * `"jsconv"` - FEAT_JSCVT
53 /// * `"fcma"` - FEAT_FCMA
54 /// * `"aes"` - FEAT_AES & FEAT_PMULL
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 implied by target_features: ["aes"];
74 /// FEAT_PMULL (Polynomial Multiply) - Implied by `aes` target_feature
75 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fp: "fp";
76 implied by target_features: ["neon"];
77 /// FEAT_FP (Floating point support) - Implied by `neon` target_feature
78 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fp16: "fp16";
79 /// FEAT_FP16 (Half-float support)
80 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve: "sve";
81 /// FEAT_SVE (Scalable Vector Extension)
82 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] crc: "crc";
83 /// FEAT_CRC32 (Cyclic Redundancy Check)
84 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] lse: "lse";
85 /// FEAT_LSE (Large System Extension - atomics)
86 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] lse2: "lse2";
87 /// FEAT_LSE2 (unaligned and register-pair atomics)
88 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rdm: "rdm";
89 /// FEAT_RDM (Rounding Doubling Multiply - ASIMDRDM)
90 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rcpc: "rcpc";
91 /// FEAT_LRCPC (Release consistent Processor consistent)
92 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rcpc2: "rcpc2";
93 /// FEAT_LRCPC2 (RCPC with immediate offsets)
94 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] dotprod: "dotprod";
95 /// FEAT_DotProd (Vector Dot-Product - ASIMDDP)
96 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] tme: "tme";
97 /// FEAT_TME (Transactional Memory Extensions)
98 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fhm: "fhm";
99 /// FEAT_FHM (fp16 multiplication instructions)
100 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] dit: "dit";
101 /// FEAT_DIT (Data Independent Timing instructions)
102 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] flagm: "flagm";
103 /// FEAT_FLAGM (flag manipulation instructions)
104 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] ssbs: "ssbs";
105 /// FEAT_SSBS & FEAT_SSBS2 (speculative store bypass safe)
106 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sb: "sb";
107 /// FEAT_SB (speculation barrier)
108 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] paca: "paca";
109 /// FEAT_PAuth (address authentication)
110 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] pacg: "pacg";
111 /// FEAT_PAuth (generic authentication)
112 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] dpb: "dpb";
113 /// FEAT_DPB (aka dcpop - data cache clean to point of persistence)
114 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] dpb2: "dpb2";
115 /// FEAT_DPB2 (aka dcpodp - data cache clean to point of deep persistence)
116 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2: "sve2";
117 /// FEAT_SVE2 (Scalable Vector Extension 2)
118 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_aes: "sve2-aes";
119 /// FEAT_SVE_AES (SVE2 AES crypto)
120 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_sm4: "sve2-sm4";
121 /// FEAT_SVE_SM4 (SVE2 SM4 crypto)
122 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_sha3: "sve2-sha3";
123 /// FEAT_SVE_SHA3 (SVE2 SHA3 crypto)
124 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_bitperm: "sve2-bitperm";
125 /// FEAT_SVE_BitPerm (SVE2 bit permutation instructions)
126 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] frintts: "frintts";
127 /// FEAT_FRINTTS (float to integer rounding instructions)
128 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] i8mm: "i8mm";
129 /// FEAT_I8MM (integer matrix multiplication, plus ASIMD support)
130 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] f32mm: "f32mm";
131 /// FEAT_F32MM (single-precision matrix multiplication)
132 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] f64mm: "f64mm";
133 /// FEAT_F64MM (double-precision matrix multiplication)
134 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] bf16: "bf16";
135 /// FEAT_BF16 (BFloat16 type, plus MM instructions, plus ASIMD support)
136 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rand: "rand";
137 /// FEAT_RNG (Random Number Generator)
138 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] bti: "bti";
139 /// FEAT_BTI (Branch Target Identification)
140 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] mte: "mte";
141 /// FEAT_MTE & FEAT_MTE2 (Memory Tagging Extension)
142 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] jsconv: "jsconv";
143 /// FEAT_JSCVT (JavaScript float conversion instructions)
144 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fcma: "fcma";
145 /// FEAT_FCMA (float complex number operations)
146 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] aes: "aes";
147 /// FEAT_AES (AES SIMD instructions) & FEAT_PMULL (PMULL{2}, 64-bit operand variants)
148 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sha2: "sha2";
149 /// FEAT_SHA1 & FEAT_SHA256 (SHA1 & SHA2-256 instructions)
150 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sha3: "sha3";
151 /// FEAT_SHA512 & FEAT_SHA3 (SHA2-512 & SHA3 instructions)
152 @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sm4: "sm4";
153 /// FEAT_SM3 & FEAT_SM4 (SM3 & SM4 instructions)
154}
155