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