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"));
22 #[cfg(all(target_arch = "aarch64", any(target_os = "linux", target_os = "android")))]
24 println!("fp: {}", is_aarch64_feature_detected!("fp"));
25 println!("fp16: {}", is_aarch64_feature_detected!("fp16"));
26 println!("neon: {}", is_aarch64_feature_detected!("neon"));
27 println!("asimd: {}", is_aarch64_feature_detected!("asimd"));
28 println!("sve: {}", is_aarch64_feature_detected!("sve"));
29 println!("crc: {}", is_aarch64_feature_detected!("crc"));
30 println!("crypto: {}", is_aarch64_feature_detected!("crypto"));
31 println!("lse: {}", is_aarch64_feature_detected!("lse"));
32 println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
33 println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));
34 println!("dotprod: {}", is_aarch64_feature_detected!("dotprod"));
35 println!("tme: {}", is_aarch64_feature_detected!("tme"));
39 #[cfg(all(target_arch = "powerpc", target_os = "linux"))]
41 println!("altivec: {}", is_powerpc_feature_detected!("altivec"));
42 println!("vsx: {}", is_powerpc_feature_detected!("vsx"));
43 println!("power8: {}", is_powerpc_feature_detected!("power8"));
47 #[cfg(all(target_arch = "powerpc64", target_os = "linux"))]
48 fn powerpc64_linux() {
49 println!("altivec: {}", is_powerpc64_feature_detected!("altivec"));
50 println!("vsx: {}", is_powerpc64_feature_detected!("vsx"));
51 println!("power8: {}", is_powerpc64_feature_detected!("power8"));
55 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
57 // the below is the set of features we can test at runtime, but don't actually
58 // use to gate anything and are thus not part of the X86_ALLOWED_FEATURES list
60 println!("abm: {:?}", is_x86_feature_detected!("abm")); // this is a synonym for lzcnt but we test it anyways
61 println!("mmx: {:?}", is_x86_feature_detected!("mmx"));
62 println!("tsc: {:?}", is_x86_feature_detected!("tsc"));
64 // the below is in alphabetical order and matches
65 // the order of X86_ALLOWED_FEATURES in rustc_codegen_ssa's target_features.rs
67 println!("adx: {:?}", is_x86_feature_detected!("adx"));
68 println!("aes: {:?}", is_x86_feature_detected!("aes"));
69 println!("avx: {:?}", is_x86_feature_detected!("avx"));
70 println!("avx2: {:?}", is_x86_feature_detected!("avx2"));
71 println!("avx512bf16: {:?}", is_x86_feature_detected!("avx512bf16"));
72 println!("avx512bitalg: {:?}", is_x86_feature_detected!("avx512bitalg"));
73 println!("avx512bw: {:?}", is_x86_feature_detected!("avx512bw"));
74 println!("avx512cd: {:?}", is_x86_feature_detected!("avx512cd"));
75 println!("avx512dq: {:?}", is_x86_feature_detected!("avx512dq"));
76 println!("avx512er: {:?}", is_x86_feature_detected!("avx512er"));
77 println!("avx512f: {:?}", is_x86_feature_detected!("avx512f"));
78 println!("avx512gfni: {:?}", is_x86_feature_detected!("avx512gfni"));
79 println!("avx512ifma: {:?}", is_x86_feature_detected!("avx512ifma"));
80 println!("avx512pf: {:?}", is_x86_feature_detected!("avx512pf"));
81 println!("avx512vaes: {:?}", is_x86_feature_detected!("avx512vaes"));
82 println!("avx512vbmi: {:?}", is_x86_feature_detected!("avx512vbmi"));
83 println!("avx512vbmi2: {:?}", is_x86_feature_detected!("avx512vbmi2"));
84 println!("avx512vl: {:?}", is_x86_feature_detected!("avx512vl"));
85 println!("avx512vnni: {:?}", is_x86_feature_detected!("avx512vnni"));
86 println!("avx512vp2intersect: {:?}", is_x86_feature_detected!("avx512vp2intersect"));
87 println!("avx512vpclmulqdq: {:?}", is_x86_feature_detected!("avx512vpclmulqdq"));
88 println!("avx512vpopcntdq: {:?}", is_x86_feature_detected!("avx512vpopcntdq"));
89 println!("bmi1: {:?}", is_x86_feature_detected!("bmi1"));
90 println!("bmi2: {:?}", is_x86_feature_detected!("bmi2"));
91 println!("cmpxchg16b: {:?}", is_x86_feature_detected!("cmpxchg16b"));
92 println!("f16c: {:?}", is_x86_feature_detected!("f16c"));
93 println!("fma: {:?}", is_x86_feature_detected!("fma"));
94 println!("fxsr: {:?}", is_x86_feature_detected!("fxsr"));
95 println!("lzcnt: {:?}", is_x86_feature_detected!("lzcnt"));
96 //println!("movbe: {:?}", is_x86_feature_detected!("movbe")); // movbe is unsupported as a target feature
97 println!("pclmulqdq: {:?}", is_x86_feature_detected!("pclmulqdq"));
98 println!("popcnt: {:?}", is_x86_feature_detected!("popcnt"));
99 println!("rdrand: {:?}", is_x86_feature_detected!("rdrand"));
100 println!("rdseed: {:?}", is_x86_feature_detected!("rdseed"));
101 println!("rtm: {:?}", is_x86_feature_detected!("rtm"));
102 println!("sha: {:?}", is_x86_feature_detected!("sha"));
103 println!("sse: {:?}", is_x86_feature_detected!("sse"));
104 println!("sse2: {:?}", is_x86_feature_detected!("sse2"));
105 println!("sse3: {:?}", is_x86_feature_detected!("sse3"));
106 println!("sse4.1: {:?}", is_x86_feature_detected!("sse4.1"));
107 println!("sse4.2: {:?}", is_x86_feature_detected!("sse4.2"));
108 println!("sse4a: {:?}", is_x86_feature_detected!("sse4a"));
109 println!("ssse3: {:?}", is_x86_feature_detected!("ssse3"));
110 println!("tbm: {:?}", is_x86_feature_detected!("tbm"));
111 println!("xsave: {:?}", is_x86_feature_detected!("xsave"));
112 println!("xsavec: {:?}", is_x86_feature_detected!("xsavec"));
113 println!("xsaveopt: {:?}", is_x86_feature_detected!("xsaveopt"));
114 println!("xsaves: {:?}", is_x86_feature_detected!("xsaves"));