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