1 // revisions: aarch64 x86-64
2 // [aarch64] compile-flags: -Ctarget-feature=+neon,+fp16,+fhm --target=aarch64-unknown-linux-gnu
3 // [aarch64] needs-llvm-components: aarch64
4 // [x86-64] compile-flags: -Ctarget-feature=+sse4.2,+rdrand --target=x86_64-unknown-linux-gnu
5 // [x86-64] needs-llvm-components: x86
8 #![crate_type = "rlib"]
9 #![feature(intrinsics, rustc_attrs, no_core, lang_items, staged_api)]
10 #![stable(feature = "test", since = "1.0.0")]
12 // Supporting minimal rust core code
19 extern "rust-intrinsic" {
20 #[rustc_const_stable(feature = "test", since = "1.0.0")]
21 fn unreachable() -> !;
24 #[rustc_builtin_macro]
30 const fn do_or_die(cond: bool) {
33 unsafe { unreachable() }
39 const _: () = do_or_die($x);
44 #[cfg(target_arch = "aarch64")]
46 // This checks that the rustc feature name is used, not the LLVM feature.
47 assert!(cfg!(target_feature = "neon"));
48 assert!(cfg!(not(target_feature = "fp-armv8")));
49 assert!(cfg!(target_feature = "fhm"));
50 assert!(cfg!(not(target_feature = "fp16fml")));
51 assert!(cfg!(target_feature = "fp16"));
52 assert!(cfg!(not(target_feature = "fullfp16")));
55 #[cfg(target_arch = "x86_64")]
57 // This checks that the rustc feature name is used, not the LLVM feature.
58 assert!(cfg!(target_feature = "rdrand"));
59 assert!(cfg!(not(target_feature = "rdrnd")));
61 // Likewise: We enable LLVM's crc32 feature with SSE4.2, but Rust says it's just SSE4.2
62 assert!(cfg!(target_feature = "sse4.2"));
63 assert!(cfg!(not(target_feature = "crc32")));