1 //! These tests just check that the macros are available in std.
5 all(target_arch = "arm", any(target_os = "linux", target_os = "android")),
6 all(target_arch = "powerpc", target_os = "linux"),
7 all(target_arch = "powerpc64", target_os = "linux"),
13 #[cfg(all(target_arch = "arm", any(target_os = "linux", target_os = "android")))]
15 use std::arch::is_arm_feature_detected;
16 // tidy-alphabetical-start
17 println!("aes: {}", is_arm_feature_detected!("aes"));
18 println!("crc: {}", is_arm_feature_detected!("crc"));
19 println!("crypto: {}", is_arm_feature_detected!("crypto"));
20 println!("neon: {}", is_arm_feature_detected!("neon"));
21 println!("pmull: {}", is_arm_feature_detected!("pmull"));
22 println!("sha2: {}", is_arm_feature_detected!("sha2"));
23 // tidy-alphabetical-end
27 #[cfg(all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")))]
29 use std::arch::is_aarch64_feature_detected;
30 // tidy-alphabetical-start
31 println!("aes: {}", is_aarch64_feature_detected!("aes"));
32 println!("asimd: {}", is_aarch64_feature_detected!("asimd"));
33 println!("bf16: {}", is_aarch64_feature_detected!("bf16"));
34 println!("bti: {}", is_aarch64_feature_detected!("bti"));
35 println!("crc: {}", is_aarch64_feature_detected!("crc"));
36 println!("dit: {}", is_aarch64_feature_detected!("dit"));
37 println!("dotprod: {}", is_aarch64_feature_detected!("dotprod"));
38 println!("dpb2: {}", is_aarch64_feature_detected!("dpb2"));
39 println!("dpb: {}", is_aarch64_feature_detected!("dpb"));
40 println!("f32mm: {}", is_aarch64_feature_detected!("f32mm"));
41 println!("f64mm: {}", is_aarch64_feature_detected!("f64mm"));
42 println!("fcma: {}", is_aarch64_feature_detected!("fcma"));
43 println!("fhm: {}", is_aarch64_feature_detected!("fhm"));
44 println!("flagm: {}", is_aarch64_feature_detected!("flagm"));
45 println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
46 println!("frintts: {}", is_aarch64_feature_detected!("frintts"));
47 println!("i8mm: {}", is_aarch64_feature_detected!("i8mm"));
48 println!("jsconv: {}", is_aarch64_feature_detected!("jsconv"));
49 println!("lse2: {}", is_aarch64_feature_detected!("lse2"));
50 println!("lse: {}", is_aarch64_feature_detected!("lse"));
51 println!("mte: {}", is_aarch64_feature_detected!("mte"));
52 println!("neon: {}", is_aarch64_feature_detected!("neon"));
53 println!("paca: {}", is_aarch64_feature_detected!("paca"));
54 println!("pacg: {}", is_aarch64_feature_detected!("pacg"));
55 println!("pmull: {}", is_aarch64_feature_detected!("pmull"));
56 println!("rand: {}", is_aarch64_feature_detected!("rand"));
57 println!("rcpc2: {}", is_aarch64_feature_detected!("rcpc2"));
58 println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
59 println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
60 println!("sb: {}", is_aarch64_feature_detected!("sb"));
61 println!("sha2: {}", is_aarch64_feature_detected!("sha2"));
62 println!("sha3: {}", is_aarch64_feature_detected!("sha3"));
63 println!("sm4: {}", is_aarch64_feature_detected!("sm4"));
64 println!("ssbs: {}", is_aarch64_feature_detected!("ssbs"));
65 println!("sve2-aes: {}", is_aarch64_feature_detected!("sve2-aes"));
66 println!("sve2-bitperm: {}", is_aarch64_feature_detected!("sve2-bitperm"));
67 println!("sve2-sha3: {}", is_aarch64_feature_detected!("sve2-sha3"));
68 println!("sve2-sm4: {}", is_aarch64_feature_detected!("sve2-sm4"));
69 println!("sve2: {}", is_aarch64_feature_detected!("sve2"));
70 println!("sve: {}", is_aarch64_feature_detected!("sve"));
71 println!("tme: {}", is_aarch64_feature_detected!("tme"));
72 // tidy-alphabetical-end
76 #[cfg(all(target_arch = "powerpc", target_os = "linux"))]
78 use std::arch::is_powerpc_feature_detected;
79 // tidy-alphabetical-start
80 println!("altivec: {}", is_powerpc_feature_detected!("altivec"));
81 println!("power8: {}", is_powerpc_feature_detected!("power8"));
82 println!("vsx: {}", is_powerpc_feature_detected!("vsx"));
83 // tidy-alphabetical-end
87 #[cfg(all(target_arch = "powerpc64", target_os = "linux"))]
88 fn powerpc64_linux() {
89 use std::arch::is_powerpc64_feature_detected;
90 // tidy-alphabetical-start
91 println!("altivec: {}", is_powerpc64_feature_detected!("altivec"));
92 println!("power8: {}", is_powerpc64_feature_detected!("power8"));
93 println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
94 // tidy-alphabetical-end
98 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
100 use std::arch::is_x86_feature_detected;
102 // the below is the set of features we can test at runtime, but don't actually
103 // use to gate anything and are thus not part of the X86_ALLOWED_FEATURES list
105 println!("abm: {:?}", is_x86_feature_detected!("abm")); // this is a synonym for lzcnt but we test it anyways
106 println!("mmx: {:?}", is_x86_feature_detected!("mmx"));
107 println!("tsc: {:?}", is_x86_feature_detected!("tsc"));
109 // the below is in alphabetical order and matches
110 // the order of X86_ALLOWED_FEATURES in rustc_codegen_ssa's target_features.rs
112 // tidy-alphabetical-start
113 println!("adx: {:?}", is_x86_feature_detected!("adx"));
114 println!("aes: {:?}", is_x86_feature_detected!("aes"));
115 println!("avx2: {:?}", is_x86_feature_detected!("avx2"));
116 println!("avx512bf16: {:?}", is_x86_feature_detected!("avx512bf16"));
117 println!("avx512bitalg: {:?}", is_x86_feature_detected!("avx512bitalg"));
118 println!("avx512bw: {:?}", is_x86_feature_detected!("avx512bw"));
119 println!("avx512cd: {:?}", is_x86_feature_detected!("avx512cd"));
120 println!("avx512dq: {:?}", is_x86_feature_detected!("avx512dq"));
121 println!("avx512er: {:?}", is_x86_feature_detected!("avx512er"));
122 println!("avx512f: {:?}", is_x86_feature_detected!("avx512f"));
123 println!("avx512gfni: {:?}", is_x86_feature_detected!("avx512gfni"));
124 println!("avx512ifma: {:?}", is_x86_feature_detected!("avx512ifma"));
125 println!("avx512pf: {:?}", is_x86_feature_detected!("avx512pf"));
126 println!("avx512vaes: {:?}", is_x86_feature_detected!("avx512vaes"));
127 println!("avx512vbmi2: {:?}", is_x86_feature_detected!("avx512vbmi2"));
128 println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi"));
129 println!("avx512vl: {:?}", is_x86_feature_detected!("avx512vl"));
130 println!("avx512vnni: {:?}", is_x86_feature_detected!("avx512vnni"));
131 println!("avx512vp2intersect: {:?}", is_x86_feature_detected!("avx512vp2intersect"));
132 println!("avx512vpclmulqdq: {:?}", is_x86_feature_detected!("avx512vpclmulqdq"));
133 println!("avx512vpopcntdq: {:?}", is_x86_feature_detected!("avx512vpopcntdq"));
134 println!("avx: {:?}", is_x86_feature_detected!("avx"));
135 println!("bmi1: {:?}", is_x86_feature_detected!("bmi1"));
136 println!("bmi2: {:?}", is_x86_feature_detected!("bmi2"));
137 println!("cmpxchg16b: {:?}", is_x86_feature_detected!("cmpxchg16b"));
138 println!("f16c: {:?}", is_x86_feature_detected!("f16c"));
139 println!("fma: {:?}", is_x86_feature_detected!("fma"));
140 println!("fxsr: {:?}", is_x86_feature_detected!("fxsr"));
141 println!("lzcnt: {:?}", is_x86_feature_detected!("lzcnt"));
142 //println!("movbe: {:?}", is_x86_feature_detected!("movbe")); // movbe is unsupported as a target feature
143 println!("pclmulqdq: {:?}", is_x86_feature_detected!("pclmulqdq"));
144 println!("popcnt: {:?}", is_x86_feature_detected!("popcnt"));
145 println!("rdrand: {:?}", is_x86_feature_detected!("rdrand"));
146 println!("rdseed: {:?}", is_x86_feature_detected!("rdseed"));
147 println!("rtm: {:?}", is_x86_feature_detected!("rtm"));
148 println!("sha: {:?}", is_x86_feature_detected!("sha"));
149 println!("sse2: {:?}", is_x86_feature_detected!("sse2"));
150 println!("sse3: {:?}", is_x86_feature_detected!("sse3"));
151 println!("sse4.1: {:?}", is_x86_feature_detected!("sse4.1"));
152 println!("sse4.2: {:?}", is_x86_feature_detected!("sse4.2"));
153 println!("sse4a: {:?}", is_x86_feature_detected!("sse4a"));
154 println!("sse: {:?}", is_x86_feature_detected!("sse"));
155 println!("ssse3: {:?}", is_x86_feature_detected!("ssse3"));
156 println!("tbm: {:?}", is_x86_feature_detected!("tbm"));
157 println!("xsave: {:?}", is_x86_feature_detected!("xsave"));
158 println!("xsavec: {:?}", is_x86_feature_detected!("xsavec"));
159 println!("xsaveopt: {:?}", is_x86_feature_detected!("xsaveopt"));
160 println!("xsaves: {:?}", is_x86_feature_detected!("xsaves"));
161 // tidy-alphabetical-end