Skip to main content

std_detect/detect/arch/
arm.rs

1//! Run-time feature detection on ARM Aarch32.
2
3#[doc = r" Check for the presence of a CPU feature at runtime."]
#[doc = r""]
#[doc =
r" When the feature is known to be enabled at compile time (e.g. via `-Ctarget-feature`)"]
#[doc = r" the macro expands to `true`."]
#[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")]
#[macro_export]
macro_rules! is_arm_feature_detected {
    ("neon") =>
    {
        compile_error!
        (concat!
        (r#"This macro cannot be used on the current target.
                            You can prevent it from being used in other architectures by
                            guarding it behind a cfg("#,
        stringify! (target_arch = "arm"), ")."))
    }; ("pmull") =>
    {
        compile_error!
        (concat!
        (r#"This macro cannot be used on the current target.
                            You can prevent it from being used in other architectures by
                            guarding it behind a cfg("#,
        stringify! (target_arch = "arm"), ")."))
    }; ("crc") =>
    {
        compile_error!
        (concat!
        (r#"This macro cannot be used on the current target.
                            You can prevent it from being used in other architectures by
                            guarding it behind a cfg("#,
        stringify! (target_arch = "arm"), ")."))
    }; ("aes") =>
    {
        compile_error!
        (concat!
        (r#"This macro cannot be used on the current target.
                            You can prevent it from being used in other architectures by
                            guarding it behind a cfg("#,
        stringify! (target_arch = "arm"), ")."))
    }; ("sha2") =>
    {
        compile_error!
        (concat!
        (r#"This macro cannot be used on the current target.
                            You can prevent it from being used in other architectures by
                            guarding it behind a cfg("#,
        stringify! (target_arch = "arm"), ")."))
    }; ("i8mm") =>
    {
        compile_error!
        (concat!
        (r#"This macro cannot be used on the current target.
                            You can prevent it from being used in other architectures by
                            guarding it behind a cfg("#,
        stringify! (target_arch = "arm"), ")."))
    }; ("dotprod") =>
    {
        compile_error!
        (concat!
        (r#"This macro cannot be used on the current target.
                            You can prevent it from being used in other architectures by
                            guarding it behind a cfg("#,
        stringify! (target_arch = "arm"), ")."))
    }; ("v7") =>
    {
        compile_error!
        (concat!
        (stringify! ("v7"), " feature cannot be detected at run-time"))
    }; ("vfp2") =>
    {
        compile_error!
        (concat!
        (stringify! ("vfp2"), " feature cannot be detected at run-time"))
    }; ("vfp3") =>
    {
        compile_error!
        (concat!
        (stringify! ("vfp3"), " feature cannot be detected at run-time"))
    }; ("vfp4") =>
    {
        compile_error!
        (concat!
        (stringify! ("vfp4"), " feature cannot be detected at run-time"))
    }; ($t : tt,) => { crate :: is_arm_feature_detected ! ($t); }; ($t : tt)
    =>
    {
        compile_error!
        (concat!
        (concat! ("unknown ", stringify! (arm)), concat!
        (" target feature: ", $t)))
    };
}
#[deny(unexpected_cfgs)]
#[deny(unfulfilled_lint_expectations)]
const _: () =
    {
        false;
        ;

        #[allow(unexpected_cfgs, reason = "pmull")]
        { false };
        false;
        ;
        false;
        ;
        false;
        ;
        false;
        ;
        false;
        ;
    };features! {
4    @TARGET: arm;
5    @CFG: target_arch = "arm";
6    @MACRO_NAME: is_arm_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    #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")]
13    @NO_RUNTIME_DETECTION: "v7";
14    @NO_RUNTIME_DETECTION: "vfp2";
15    @NO_RUNTIME_DETECTION: "vfp3";
16    @NO_RUNTIME_DETECTION: "vfp4";
17    @FEATURE: #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")] neon: "neon";
18    /// ARM Advanced SIMD (NEON) - Aarch32
19    @FEATURE: #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")] pmull: "pmull";
20    without cfg check: true;
21    /// Polynomial Multiply
22    @FEATURE: #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")] crc: "crc";
23    /// CRC32 (Cyclic Redundancy Check)
24    @FEATURE: #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")] aes: "aes";
25    /// FEAT_AES (AES instructions)
26    @FEATURE: #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")] sha2: "sha2";
27    /// FEAT_SHA1 & FEAT_SHA256 (SHA1 & SHA2-256 instructions)
28    @FEATURE: #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")] i8mm: "i8mm";
29    /// FEAT_I8MM (integer matrix multiplication, plus ASIMD support)
30    @FEATURE: #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")] dotprod: "dotprod";
31    /// FEAT_DotProd (Vector Dot-Product - ASIMDDP)
32}