]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/tests/target/cfg_if/detect/arch/powerpc.rs
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / rustfmt / tests / target / cfg_if / detect / arch / powerpc.rs
CommitLineData
f20569fa
XL
1//! Run-time feature detection on PowerPC.
2
3/// Checks if `powerpc` feature is enabled.
4#[macro_export]
5#[unstable(feature = "stdsimd", issue = "27731")]
6#[allow_internal_unstable(stdsimd_internal, stdsimd)]
7macro_rules! is_powerpc_feature_detected {
8 ("altivec") => {
9 cfg!(target_feature = "altivec")
10 || $crate::detect::check_for($crate::detect::Feature::altivec)
11 };
12 ("vsx") => {
13 cfg!(target_feature = "vsx") || $crate::detect::check_for($crate::detect::Feature::vsx)
14 };
15 ("power8") => {
16 cfg!(target_feature = "power8")
17 || $crate::detect::check_for($crate::detect::Feature::power8)
18 };
19 ($t:tt,) => {
20 is_powerpc_feature_detected!($t);
21 };
22 ($t:tt) => {
23 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")]
35pub enum Feature {
36 /// Altivec
37 altivec,
38 /// VSX
39 vsx,
40 /// Power8
41 power8,
42}