]>
git.proxmox.com Git - rustc.git/blob - tests/ui/target-feature/feature-hierarchy.rs
1 // revisions: aarch64-neon aarch64-sve2
2 // [aarch64-neon] compile-flags: -Ctarget-feature=+neon --target=aarch64-unknown-linux-gnu
3 // [aarch64-neon] needs-llvm-components: aarch64
4 // [aarch64-sve2] compile-flags: -Ctarget-feature=-neon,+sve2 --target=aarch64-unknown-linux-gnu
5 // [aarch64-sve2] needs-llvm-components: aarch64
8 #![crate_type = "rlib"]
9 #![feature(intrinsics, rustc_attrs, no_core, lang_items, staged_api)]
10 #![stable(feature = "test", since = "1.0.0")]
12 // Tests vetting "feature hierarchies" in the cases where we impose them.
14 // Supporting minimal rust core code
21 extern "rust-intrinsic" {
22 #[rustc_const_stable(feature = "test", since = "1.0.0")]
23 fn unreachable() -> !;
26 #[rustc_builtin_macro]
32 const fn do_or_die(cond
: bool
) {
35 unsafe { unreachable() }
41 const _
: () = do_or_die($x
);
47 fn check_neon_not_sve2() {
48 // This checks that a normal aarch64 target doesn't suddenly jump up the feature hierarchy.
49 assert
!(cfg
!(target_feature
= "neon"));
50 assert
!(cfg
!(not(target_feature
= "sve2")));
54 fn check_sve2_includes_neon() {
55 // This checks that aarch64's sve2 includes neon
56 assert
!(cfg
!(target_feature
= "neon"));
57 assert
!(cfg
!(target_feature
= "sve2"));