]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/tests/source/cfg_if/detect/arch/arm.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / rustfmt / tests / source / cfg_if / detect / arch / arm.rs
CommitLineData
f20569fa
XL
1//! Run-time feature detection on ARM Aarch32.
2
3/// Checks if `arm` feature is enabled.
4#[macro_export]
5#[unstable(feature = "stdsimd", issue = "27731")]
6#[allow_internal_unstable(stdsimd_internal,stdsimd)]
7macro_rules! is_arm_feature_detected {
8 ("neon") => {
9 cfg!(target_feature = "neon") ||
10 $crate::detect::check_for($crate::detect::Feature::neon)
11 };
12 ("pmull") => {
13 cfg!(target_feature = "pmull") ||
14 $crate::detect::check_for($crate::detect::Feature::pmull)
15 };
16 ("v7") => { compile_error!("\"v7\" feature cannot be detected at run-time") };
17 ("vfp2") => { compile_error!("\"vfp2\" feature cannot be detected at run-time") };
18 ("vfp3") => { compile_error!("\"vfp3\" feature cannot be detected at run-time") };
19 ("vfp4") => { compile_error!("\"vfp4\" feature cannot be detected at run-time") };
20 ($t:tt,) => {
21 is_arm_feature_detected!($t);
22 };
23 ($t:tt) => { compile_error!(concat!("unknown arm target feature: ", $t)) };
24}
25
26/// ARM CPU Feature enum. Each variant denotes a position in a bitset for a
27/// particular feature.
28///
29/// PLEASE: do not use this, it is an implementation detail subject to change.
30#[doc(hidden)]
31#[allow(non_camel_case_types)]
32#[repr(u8)]
33#[unstable(feature = "stdsimd_internal", issue = "0")]
34pub enum Feature {
35 /// ARM Advanced SIMD (NEON) - Aarch32
36 neon,
37 /// Polynomial Multiply
38 pmull,
39}