@@ -36,3 +36,72 @@ pub use self::arch::Feature;
36
36
pub fn check_for ( x : Feature ) -> bool {
37
37
cache:: test ( x as u32 , arch:: detect_features)
38
38
}
39
+
40
+ #[ cfg( not( any( target_arch = "x86" , target_arch = "x86_64" ) ) ) ]
41
+ #[ macro_export]
42
+ #[ unstable( feature = "stdsimd" , issue = "0" ) ]
43
+ macro_rules! is_x86_feature_detected {
44
+ ( $t: tt) => {
45
+ compile_error!( r#"
46
+ is_x86_feature_detected can only be used on x86 and x86_64 targets.
47
+ You can prevent it from being used in other architectures by
48
+ guarding it behind a cfg(target_arch) as follows:
49
+
50
+ #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] {
51
+ if is_x86_feature_detected(...) { ... }
52
+ }
53
+ "# )
54
+ } ;
55
+ }
56
+
57
+ #[ cfg( not( target_arch = "arm" ) ) ]
58
+ #[ macro_export]
59
+ #[ unstable( feature = "stdsimd" , issue = "0" ) ]
60
+ macro_rules! is_arm_feature_detected {
61
+ ( $t: tt) => {
62
+ compile_error!( r#"
63
+ is_arm_feature_detected can only be used on ARM targets.
64
+ You can prevent it from being used in other architectures by
65
+ guarding it behind a cfg(target_arch) as follows:
66
+
67
+ #[cfg(target_arch = "arm")] {
68
+ if is_arm_feature_detected(...) { ... }
69
+ }
70
+ "# )
71
+ } ;
72
+ }
73
+
74
+ #[ cfg( not( target_arch = "aarch64" ) ) ]
75
+ #[ macro_export]
76
+ #[ unstable( feature = "stdsimd" , issue = "0" ) ]
77
+ macro_rules! is_aarch64_feature_detected {
78
+ ( $t: tt) => {
79
+ compile_error!( r#"
80
+ is_aarch64_feature_detected can only be used on AArch64 targets.
81
+ You can prevent it from being used in other architectures by
82
+ guarding it behind a cfg(target_arch) as follows:
83
+
84
+ #[cfg(target_arch = "aarch64")] {
85
+ if is_aarch64_feature_detected(...) { ... }
86
+ }
87
+ "# )
88
+ } ;
89
+ }
90
+
91
+ #[ cfg( not( target_arch = "powerpc64" ) ) ]
92
+ #[ macro_export]
93
+ #[ unstable( feature = "stdsimd" , issue = "0" ) ]
94
+ macro_rules! is_powerpc64_feature_detected {
95
+ ( $t: tt) => {
96
+ compile_error!( r#"
97
+ is_powerpc64_feature_detected can only be used on PowerPC64 targets.
98
+ You can prevent it from being used in other architectures by
99
+ guarding it behind a cfg(target_arch) as follows:
100
+
101
+ #[cfg(target_arch = "powerpc64")] {
102
+ if is_powerpc64_feature_detected(...) { ... }
103
+ }
104
+ "# )
105
+ } ;
106
+ }
107
+
0 commit comments