]>
Commit | Line | Data |
---|---|---|
8faf50e0 XL |
1 | //! Run-time feature detection on PowerPC. |
2 | ||
0731742a | 3 | /// Checks if `powerpc` feature is enabled. |
8faf50e0 XL |
4 | #[macro_export] |
5 | #[unstable(feature = "stdsimd", issue = "27731")] | |
9fa01778 | 6 | #[allow_internal_unstable(stdsimd_internal,stdsimd)] |
8faf50e0 XL |
7 | macro_rules! is_powerpc_feature_detected { |
8 | ("altivec") => { | |
9 | cfg!(target_feature = "altivec") || | |
9fa01778 | 10 | $crate::detect::check_for($crate::detect::Feature::altivec) |
8faf50e0 XL |
11 | }; |
12 | ("vsx") => { | |
13 | cfg!(target_feature = "vsx") || | |
9fa01778 | 14 | $crate::detect::check_for($crate::detect::Feature::vsx) |
8faf50e0 XL |
15 | }; |
16 | ("power8") => { | |
17 | cfg!(target_feature = "power8") || | |
9fa01778 XL |
18 | $crate::detect::check_for($crate::detect::Feature::power8) |
19 | }; | |
20 | ($t:tt,) => { | |
21 | is_powerpc_feature_detected!($t); | |
8faf50e0 XL |
22 | }; |
23 | ($t:tt) => { compile_error!(concat!("unknown powerpc target feature: ", $t)) }; | |
24 | } | |
25 | ||
26 | ||
27 | /// PowerPC CPU Feature enum. Each variant denotes a position in a bitset | |
28 | /// for a particular feature. | |
29 | /// | |
30 | /// PLEASE: do not use this, it is an implementation detail subject to change. | |
31 | #[doc(hidden)] | |
32 | #[allow(non_camel_case_types)] | |
33 | #[repr(u8)] | |
34 | #[unstable(feature = "stdsimd_internal", issue = "0")] | |
35 | pub enum Feature { | |
36 | /// Altivec | |
37 | altivec, | |
38 | /// VSX | |
39 | vsx, | |
40 | /// Power8 | |
41 | power8, | |
42 | } |