aarch64.rs - source
Description: Source of the Rust file `library/std_detect/src/detect/arch/aarch64.rs`.

#
std_detect/detect/arch/
aarch64.rs

    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    /// Check for the presence of a CPU feature at runtime.
    9    ///
    10    /// When the feature is known to be enabled at compile time (e.g. via `-Ctarget-feature`)
    11    /// the macro expands to `true`.
    12    ///
    13    /// This macro takes one argument which is a string literal of the feature being tested for.
    14    /// The feature names are mostly taken from their FEAT_* definitions in the [ARM Architecture
    15    /// Reference Manual][docs].
    16    ///
    17    /// Currently most features are only supported on linux-based platforms: on other platforms the
    18    /// runtime check will always return `false`.
    19    ///
    20    /// ## Supported arguments
    21    ///
    22    /// * `"aes"` - FEAT_AES & FEAT_PMULL
    23    /// * `"asimd"` or "neon" - FEAT_AdvSIMD
    24    /// * `"bf16"` - FEAT_BF16
    25    /// * `"bti"` - FEAT_BTI
    26    /// * `"crc"` - FEAT_CRC
    27    /// * `"cssc"` - FEAT_CSSC
    28    /// * `"dit"` - FEAT_DIT
    29    /// * `"dotprod"` - FEAT_DotProd
    30    /// * `"dpb"` - FEAT_DPB
    31    /// * `"dpb2"` - FEAT_DPB2
    32    /// * `"ecv"` - FEAT_ECV
    33    /// * `"f32mm"` - FEAT_F32MM
    34    /// * `"f64mm"` - FEAT_F64MM
    35    /// * `"faminmax"` - FEAT_FAMINMAX
    36    /// * `"fcma"` - FEAT_FCMA
    37    /// * `"fhm"` - FEAT_FHM
    38    /// * `"flagm"` - FEAT_FLAGM
    39    /// * `"flagm2"` - FEAT_FLAGM2
    40    /// * `"fp"` - FEAT_FP
    41    /// * `"fp16"` - FEAT_FP16
    42    /// * `"fp8"` - FEAT_FP8
    43    /// * `"fp8dot2"` - FEAT_FP8DOT2
    44    /// * `"fp8dot4"` - FEAT_FP8DOT4
    45    /// * `"fp8fma"` - FEAT_FP8FMA
    46    /// * `"fpmr"` - FEAT_FPMR
    47    /// * `"frintts"` - FEAT_FRINTTS
    48    /// * `"hbc"` - FEAT_HBC
    49    /// * `"i8mm"` - FEAT_I8MM
    50    /// * `"jsconv"` - FEAT_JSCVT
    51    /// * `"lse"` - FEAT_LSE
    52    /// * `"lse128"` - FEAT_LSE128
    53    /// * `"lse2"` - FEAT_LSE2
    54    /// * `"lut"` - FEAT_LUT
    55    /// * `"mops"` - FEAT_MOPS
    56    /// * `"mte"` - FEAT_MTE & FEAT_MTE2
    57    /// * `"paca"` - FEAT_PAuth (address authentication)
    58    /// * `"pacg"` - FEAT_Pauth (generic authentication)
    59    /// * `"pauth-lr"` - FEAT_PAuth_LR
    60    /// * `"pmull"` - FEAT_PMULL
    61    /// * `"rand"` - FEAT_RNG
    62    /// * `"rcpc"` - FEAT_LRCPC
    63    /// * `"rcpc2"` - FEAT_LRCPC2
    64    /// * `"rcpc3"` - FEAT_LRCPC3
    65    /// * `"rdm"` - FEAT_RDM
    66    /// * `"sb"` - FEAT_SB
    67    /// * `"sha2"` - FEAT_SHA1 & FEAT_SHA256
    68    /// * `"sha3"` - FEAT_SHA512 & FEAT_SHA3
    69    /// * `"sm4"` - FEAT_SM3 & FEAT_SM4
    70    /// * `"sme"` - FEAT_SME
    71    /// * `"sme-b16b16"` - FEAT_SME_B16B16
    72    /// * `"sme-f16f16"` - FEAT_SME_F16F16
    73    /// * `"sme-f64f64"` - FEAT_SME_F64F64
    74    /// * `"sme-f8f16"` - FEAT_SME_F8F16
    75    /// * `"sme-f8f32"` - FEAT_SME_F8F32
    76    /// * `"sme-fa64"` - FEAT_SME_FA64
    77    /// * `"sme-i16i64"` - FEAT_SME_I16I64
    78    /// * `"sme-lutv2"` - FEAT_SME_LUTv2
    79    /// * `"sme2"` - FEAT_SME2
    80    /// * `"sme2p1"` - FEAT_SME2p1
    81    /// * `"ssbs"` - FEAT_SSBS & FEAT_SSBS2
    82    /// * `"ssve-fp8dot2"` - FEAT_SSVE_FP8DOT2
    83    /// * `"ssve-fp8dot4"` - FEAT_SSVE_FP8DOT4
    84    /// * `"ssve-fp8fma"` - FEAT_SSVE_FP8FMA
    85    /// * `"sve"` - FEAT_SVE
    86    /// * `"sve-b16b16"` - FEAT_SVE_B16B16 (SVE or SME Z-targeting instructions)
    87    /// * `"sve2"` - FEAT_SVE2
    88    /// * `"sve2-aes"` - FEAT_SVE_AES & FEAT_SVE_PMULL128 (SVE2 AES crypto)
    89    /// * `"sve2-bitperm"` - FEAT_SVE2_BitPerm
    90    /// * `"sve2-sha3"` - FEAT_SVE2_SHA3
    91    /// * `"sve2-sm4"` - FEAT_SVE2_SM4
    92    /// * `"sve2p1"` - FEAT_SVE2p1
    93    /// * `"tme"` - FEAT_TME
    94    /// * `"wfxt"` - FEAT_WFxT
    95    ///
    96    /// [docs]: https://developer.arm.com/documentation/ddi0487/latest
    97    #[stable(feature = "simd_aarch64", since = "1.60.0")]
    98    @BIND_FEATURE_NAME: "asimd"; "neon";
    99    @NO_RUNTIME_DETECTION: "ras";
    100    @NO_RUNTIME_DETECTION: "v8.1a";
    101    @NO_RUNTIME_DETECTION: "v8.2a";
    102    @NO_RUNTIME_DETECTION: "v8.3a";
    103    @NO_RUNTIME_DETECTION: "v8.4a";
    104    @NO_RUNTIME_DETECTION: "v8.5a";
    105    @NO_RUNTIME_DETECTION: "v8.6a";
    106    @NO_RUNTIME_DETECTION: "v8.7a";
    107    @NO_RUNTIME_DETECTION: "v8.8a";
    108    @NO_RUNTIME_DETECTION: "v8.9a";
    109    @NO_RUNTIME_DETECTION: "v9.1a";
    110    @NO_RUNTIME_DETECTION: "v9.2a";
    111    @NO_RUNTIME_DETECTION: "v9.3a";
    112    @NO_RUNTIME_DETECTION: "v9.4a";
    113    @NO_RUNTIME_DETECTION: "v9.5a";
    114    @NO_RUNTIME_DETECTION: "v9a";
    115    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] asimd: "neon";
    116    /// FEAT_AdvSIMD (Advanced SIMD/NEON)
    117    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] pmull: "pmull";
    118    implied by target_features: ["aes"];
    119    /// FEAT_PMULL (Polynomial Multiply) - Implied by `aes` target_feature
    120    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fp: "fp";
    121    implied by target_features: ["neon"];
    122    /// FEAT_FP (Floating point support) - Implied by `neon` target_feature
    123    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] aes: "aes";
    124    /// FEAT_AES (AES SIMD instructions) & FEAT_PMULL (PMULL{2}, 64-bit operand variants)
    125    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] bf16: "bf16";
    126    /// FEAT_BF16 (BFloat16 type, plus MM instructions, plus ASIMD support)
    127    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] bti: "bti";
    128    /// FEAT_BTI (Branch Target Identification)
    129    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] crc: "crc";
    130    /// FEAT_CRC32 (Cyclic Redundancy Check)
    131    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] cssc: "cssc";
    132    /// FEAT_CSSC (Common Short Sequence Compression instructions)
    133    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] dit: "dit";
    134    /// FEAT_DIT (Data Independent Timing instructions)
    135    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] dpb: "dpb";
    136    /// FEAT_DPB (aka dcpop - data cache clean to point of persistence)
    137    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] dpb2: "dpb2";
    138    /// FEAT_DPB2 (aka dcpodp - data cache clean to point of deep persistence)
    139    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] dotprod: "dotprod";
    140    /// FEAT_DotProd (Vector Dot-Product - ASIMDDP)
    141    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] ecv: "ecv";
    142    /// FEAT_ECV (Enhanced Counter Virtualization)
    143    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] f32mm: "f32mm";
    144    /// FEAT_F32MM (single-precision matrix multiplication)
    145    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] f64mm: "f64mm";
    146    /// FEAT_F64MM (double-precision matrix multiplication)
    147    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] faminmax: "faminmax";
    148    /// FEAT_FAMINMAX (FAMIN and FAMAX SIMD/SVE/SME instructions)
    149    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fcma: "fcma";
    150    /// FEAT_FCMA (float complex number operations)
    151    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fhm: "fhm";
    152    /// FEAT_FHM (fp16 multiplication instructions)
    153    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] flagm: "flagm";
    154    /// FEAT_FLAGM (flag manipulation instructions)
    155    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] flagm2: "flagm2";
    156    /// FEAT_FLAGM2 (flag manipulation instructions)
    157    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] fp16: "fp16";
    158    /// FEAT_FP16 (Half-float support)
    159    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] fp8: "fp8";
    160    /// FEAT_FP8 (F8CVT Instructions)
    161    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] fp8dot2: "fp8dot2";
    162    /// FEAT_FP8DOT2 (F8DP2 Instructions)
    163    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] fp8dot4: "fp8dot4";
    164    /// FEAT_FP8DOT4 (F8DP4 Instructions)
    165    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] fp8fma: "fp8fma";
    166    /// FEAT_FP8FMA (F8FMA Instructions)
    167    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] fpmr: "fpmr";
    168    without cfg check: true;
    169    /// FEAT_FPMR (Special-purpose AArch64-FPMR register)
    170    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] frintts: "frintts";
    171    /// FEAT_FRINTTS (float to integer rounding instructions)
    172    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] hbc: "hbc";
    173    /// FEAT_HBC (Hinted conditional branches)
    174    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] i8mm: "i8mm";
    175    /// FEAT_I8MM (integer matrix multiplication, plus ASIMD support)
    176    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] jsconv: "jsconv";
    177    /// FEAT_JSCVT (JavaScript float conversion instructions)
    178    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] lse: "lse";
    179    /// FEAT_LSE (Large System Extension - atomics)
    180    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] lse128: "lse128";
    181    /// FEAT_LSE128 (128-bit atomics)
    182    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] lse2: "lse2";
    183    /// FEAT_LSE2 (unaligned and register-pair atomics)
    184    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] lut: "lut";
    185    /// FEAT_LUT (Lookup Table Instructions)
    186    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] mops: "mops";
    187    /// FEAT_MOPS (Standardization of memory operations)
    188    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] mte: "mte";
    189    /// FEAT_MTE & FEAT_MTE2 (Memory Tagging Extension)
    190    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] paca: "paca";
    191    /// FEAT_PAuth (address authentication)
    192    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] pacg: "pacg";
    193    /// FEAT_PAuth (generic authentication)
    194    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] pauth_lr: "pauth-lr";
    195    /// FEAT_PAuth_LR
    196    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rand: "rand";
    197    /// FEAT_RNG (Random Number Generator)
    198    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rcpc: "rcpc";
    199    /// FEAT_LRCPC (Release consistent Processor consistent)
    200    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rcpc2: "rcpc2";
    201    /// FEAT_LRCPC2 (RCPC with immediate offsets)
    202    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] rcpc3: "rcpc3";
    203    /// FEAT_LRCPC3 (RCPC Instructions v3)
    204    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] rdm: "rdm";
    205    /// FEAT_RDM (Rounding Doubling Multiply - ASIMDRDM)
    206    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sb: "sb";
    207    /// FEAT_SB (speculation barrier)
    208    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sha2: "sha2";
    209    /// FEAT_SHA1 & FEAT_SHA256 (SHA1 & SHA2-256 instructions)
    210    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sha3: "sha3";
    211    /// FEAT_SHA512 & FEAT_SHA3 (SHA2-512 & SHA3 instructions)
    212    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sm4: "sm4";
    213    /// FEAT_SM3 & FEAT_SM4 (SM3 & SM4 instructions)
    214    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme: "sme";
    215    /// FEAT_SME (Scalable Matrix Extension)
    216    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme2: "sme2";
    217    /// FEAT_SME2 (SME Version 2)
    218    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme2p1: "sme2p1";
    219    /// FEAT_SME2p1 (SME Version 2.1)
    220    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_b16b16: "sme-b16b16";
    221    /// FEAT_SME_B16B16
    222    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_f16f16: "sme-f16f16";
    223    /// FEAT_SME_F16F16 (Non-widening half-precision FP16 to FP16 arithmetic for SME2)
    224    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_f64f64: "sme-f64f64";
    225    /// FEAT_SME_F64F64 (Double-precision floating-point outer product instructions)
    226    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_f8f16: "sme-f8f16";
    227    /// FEAT_SME_F8F16
    228    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_f8f32: "sme-f8f32";
    229    /// FEAT_SME_F8F32
    230    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_fa64: "sme-fa64";
    231    /// FEAT_SME_FA64 (Full A64 instruction set support in Streaming SVE mode)
    232    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_i16i64: "sme-i16i64";
    233    /// FEAT_SME_I16I64 (16-bit to 64-bit integer widening outer product instructions)
    234    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sme_lutv2: "sme-lutv2";
    235    /// FEAT_SME_LUTv2 (LUTI4 Instruction)
    236    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] ssbs: "ssbs";
    237    /// FEAT_SSBS & FEAT_SSBS2 (speculative store bypass safe)
    238    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] ssve_fp8dot2: "ssve-fp8dot2";
    239    /// FEAT_SSVE_FP8DOT2
    240    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] ssve_fp8dot4: "ssve-fp8dot4";
    241    /// FEAT_SSVE_FP8DOT4
    242    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] ssve_fp8fma: "ssve-fp8fma";
    243    /// FEAT_SSVE_FP8FMA
    244    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve: "sve";
    245    /// FEAT_SVE (Scalable Vector Extension)
    246    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2: "sve2";
    247    /// FEAT_SVE2 (Scalable Vector Extension 2)
    248    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sve2p1: "sve2p1";
    249    /// FEAT_SVE2p1 (Scalable Vector Extension 2.1)
    250    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_aes: "sve2-aes";
    251    /// FEAT_SVE_AES & FEAT_SVE_PMULL128 (SVE2 AES crypto)
    252    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] sve_b16b16: "sve-b16b16";
    253    /// FEAT_SVE_B16B16 (SVE or SME Z-targeting instructions)
    254    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_bitperm: "sve2-bitperm";
    255    /// FEAT_SVE_BitPerm (SVE2 bit permutation instructions)
    256    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_sha3: "sve2-sha3";
    257    /// FEAT_SVE_SHA3 (SVE2 SHA3 crypto)
    258    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] sve2_sm4: "sve2-sm4";
    259    /// FEAT_SVE_SM4 (SVE2 SM4 crypto)
    260    @FEATURE: #[stable(feature = "simd_aarch64", since = "1.60.0")] tme: "tme";
    261    /// FEAT_TME (Transactional Memory Extensions)
    262    @FEATURE: #[unstable(feature = "stdarch_aarch64_feature_detection", issue = "127764")] wfxt: "wfxt";
    263    /// FEAT_WFxT (WFET and WFIT Instructions)
    264}