std_detect/detect/arch/
mod.rs

1#![allow(dead_code)]
2
3use cfg_if::cfg_if;
4
5// Export the macros for all supported architectures.
6#[macro_use]
7mod x86;
8#[macro_use]
9mod arm;
10#[macro_use]
11mod aarch64;
12#[macro_use]
13mod riscv;
14#[macro_use]
15mod powerpc;
16#[macro_use]
17mod powerpc64;
18#[macro_use]
19mod mips;
20#[macro_use]
21mod mips64;
22#[macro_use]
23mod loongarch;
24#[macro_use]
25mod s390x;
26
27cfg_if! {
28    if #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
29        #[stable(feature = "simd_x86", since = "1.27.0")]
30        pub use x86::*;
31    } else if #[cfg(target_arch = "arm")] {
32        #[unstable(feature = "stdarch_arm_feature_detection", issue = "111190")]
33        pub use arm::*;
34    } else if #[cfg(any(target_arch = "aarch64", target_arch = "arm64ec"))] {
35        #[stable(feature = "simd_aarch64", since = "1.60.0")]
36        pub use aarch64::*;
37    } else if #[cfg(any(target_arch = "riscv32", target_arch = "riscv64"))] {
38        #[unstable(feature = "stdarch_riscv_feature_detection", issue = "111192")]
39        pub use riscv::*;
40    } else if #[cfg(target_arch = "powerpc")] {
41        #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")]
42        pub use powerpc::*;
43    } else if #[cfg(target_arch = "powerpc64")] {
44        #[unstable(feature = "stdarch_powerpc_feature_detection", issue = "111191")]
45        pub use powerpc64::*;
46    } else if #[cfg(target_arch = "mips")] {
47        #[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")]
48        pub use mips::*;
49    } else if #[cfg(target_arch = "mips64")] {
50        #[unstable(feature = "stdarch_mips_feature_detection", issue = "111188")]
51        pub use mips64::*;
52    } else if #[cfg(target_arch = "loongarch64")] {
53        #[unstable(feature = "stdarch_loongarch_feature_detection", issue = "117425")]
54        pub use loongarch::*;
55    } else if #[cfg(target_arch = "s390x")] {
56        #[unstable(feature = "stdarch_s390x_feature_detection", issue = "135413")]
57        pub use s390x::*;
58    } else {
59        // Unimplemented architecture:
60        #[doc(hidden)]
61        pub(crate) enum Feature {
62            Null
63        }
64        #[doc(hidden)]
65        #[unstable(feature = "stdarch_internal", issue = "none")]
66        pub mod __is_feature_detected {}
67
68        impl Feature {
69            #[doc(hidden)]
70            pub(crate) fn from_str(_s: &str) -> Result<Feature, ()> { Err(()) }
71            #[doc(hidden)]
72            pub(crate) fn to_str(self) -> &'static str { "" }
73        }
74    }
75}