Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ static X86_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[

const HEXAGON_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
// tidy-alphabetical-start
("audio", Unstable(sym::hexagon_target_feature), &[]),
("hvx", Unstable(sym::hexagon_target_feature), &[]),
("hvx-ieee-fp", Unstable(sym::hexagon_target_feature), &["hvx"]),
("hvx-length64b", Unstable(sym::hexagon_target_feature), &["hvx"]),
Expand All @@ -493,6 +494,17 @@ const HEXAGON_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
("hvxv73", Unstable(sym::hexagon_target_feature), &["hvxv71"]),
("hvxv75", Unstable(sym::hexagon_target_feature), &["hvxv73"]),
("hvxv79", Unstable(sym::hexagon_target_feature), &["hvxv75"]),
("v60", Unstable(sym::hexagon_target_feature), &[]),
("v62", Unstable(sym::hexagon_target_feature), &["v60"]),
("v65", Unstable(sym::hexagon_target_feature), &["v62"]),
("v66", Unstable(sym::hexagon_target_feature), &["v65"]),
("v67", Unstable(sym::hexagon_target_feature), &["v66"]),
("v68", Unstable(sym::hexagon_target_feature), &["v67"]),
("v69", Unstable(sym::hexagon_target_feature), &["v68"]),
("v71", Unstable(sym::hexagon_target_feature), &["v69"]),
("v73", Unstable(sym::hexagon_target_feature), &["v71"]),
("v75", Unstable(sym::hexagon_target_feature), &["v73"]),
("v79", Unstable(sym::hexagon_target_feature), &["v75"]),
("zreg", Unstable(sym::hexagon_target_feature), &[]),
// tidy-alphabetical-end
];
Expand Down
12 changes: 12 additions & 0 deletions tests/ui/check-cfg/target_feature.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
`amx-tile`
`apxf`
`atomics`
`audio`
`avx`
`avx10.1`
`avx10.2`
Expand Down Expand Up @@ -359,9 +360,20 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
`v`
`v5te`
`v6`
`v60`
`v62`
`v65`
`v66`
`v67`
`v68`
`v69`
`v6k`
`v6t2`
`v7`
`v71`
`v73`
`v75`
`v79`
`v8`
`v8.1a`
`v8.2a`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
warning: unstable feature specified for `-Ctarget-feature`: `hvxv66`
|
= note: this feature is not stably supported; its behavior can change in the future

warning: 1 warning emitted

6 changes: 6 additions & 0 deletions tests/ui/target-feature/feature-hierarchy.hexagon-v60.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
warning: unstable feature specified for `-Ctarget-feature`: `v60`
|
= note: this feature is not stably supported; its behavior can change in the future

warning: 1 warning emitted

6 changes: 6 additions & 0 deletions tests/ui/target-feature/feature-hierarchy.hexagon-v68.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
warning: unstable feature specified for `-Ctarget-feature`: `v68`
|
= note: this feature is not stably supported; its behavior can change in the future

warning: 1 warning emitted

44 changes: 44 additions & 0 deletions tests/ui/target-feature/feature-hierarchy.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
//@ revisions: aarch64-neon aarch64-sve2
//@ revisions: hexagon-v60 hexagon-v68 hexagon-hvxv66
//@ [aarch64-neon] compile-flags: -Ctarget-feature=+neon --target=aarch64-unknown-linux-gnu
//@ [aarch64-neon] needs-llvm-components: aarch64
//@ [aarch64-sve2] compile-flags: -Ctarget-feature=-neon,+sve2 --target=aarch64-unknown-linux-gnu
//@ [aarch64-sve2] needs-llvm-components: aarch64
//@ [hexagon-v60] compile-flags: -Ctarget-feature=+v60 --target=hexagon-unknown-linux-musl
//@ [hexagon-v60] needs-llvm-components: hexagon
//@ [hexagon-v68] compile-flags: -Ctarget-feature=+v68 --target=hexagon-unknown-linux-musl
//@ [hexagon-v68] needs-llvm-components: hexagon
//@ [hexagon-hvxv66] compile-flags: -Ctarget-feature=+hvxv66 --target=hexagon-unknown-linux-musl
//@ [hexagon-hvxv66] needs-llvm-components: hexagon
//@ build-pass
//@ add-minicore
//@ ignore-backends: gcc
#![no_core]
#![crate_type = "rlib"]
#![feature(intrinsics, rustc_attrs, no_core, staged_api)]
#![cfg_attr(any(hexagon_v60, hexagon_v68, hexagon_hvxv66), feature(hexagon_target_feature))]
#![stable(feature = "test", since = "1.0.0")]

// Tests vetting "feature hierarchies" in the cases where we impose them.
Expand Down Expand Up @@ -54,3 +62,39 @@ fn check_sve2_includes_neon() {
assert!(cfg!(target_feature = "neon"));
assert!(cfg!(target_feature = "sve2"));
}

//[hexagon-v60]~? WARN unstable feature specified for `-Ctarget-feature`: `v60`
//[hexagon-v68]~? WARN unstable feature specified for `-Ctarget-feature`: `v68`
//[hexagon-hvxv66]~? WARN unstable feature specified for `-Ctarget-feature`: `hvxv66`

#[cfg(hexagon_v60)]
fn check_v60_not_v68() {
// Enabling v60 should not jump up the scalar feature hierarchy.
assert!(cfg!(target_feature = "v60"));
assert!(cfg!(not(target_feature = "v62")));
assert!(cfg!(not(target_feature = "v68")));
}

#[cfg(hexagon_v68)]
fn check_v68_implies_v60() {
// v68 implies all lower scalar arch versions.
assert!(cfg!(target_feature = "v60"));
assert!(cfg!(target_feature = "v62"));
assert!(cfg!(target_feature = "v65"));
assert!(cfg!(target_feature = "v66"));
assert!(cfg!(target_feature = "v67"));
assert!(cfg!(target_feature = "v68"));
assert!(cfg!(not(target_feature = "v69")));
}

#[cfg(hexagon_hvxv66)]
fn check_hvxv66_implies_hvx_and_zreg() {
// hvxv66 implies hvx, hvxv60..v65, and zreg.
assert!(cfg!(target_feature = "hvx"));
assert!(cfg!(target_feature = "hvxv60"));
assert!(cfg!(target_feature = "hvxv62"));
assert!(cfg!(target_feature = "hvxv65"));
assert!(cfg!(target_feature = "hvxv66"));
assert!(cfg!(target_feature = "zreg"));
assert!(cfg!(not(target_feature = "hvxv67")));
}
Loading