Skip to content

aarch64-softfloat: forbid enabling the neon target feature #135160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 7 additions & 5 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -946,14 +946,16 @@ impl Target {
// the use of soft-float, so all we can do here is some crude hacks.
match &*self.abi {
"softfloat" => {
// This is not fully correct, LLVM actually doesn't let us enforce the softfloat
// ABI properly... see <https://github.com/rust-lang/rust/issues/134375>.
// FIXME: should we forbid "neon" here? But that would be a breaking change.
NOTHING
// LLVM will use float registers when `fp-armv8` is available, e.g. for
// calls to built-ins. The only way to ensure a consistent softfloat ABI
// on aarch64 is to never enable `fp-armv8`, so we enforce that.
// In Rust we tie `neon` and `fp-armv8` together, therefore `neon` is the
// feature we have to mark as incompatible.
FeatureConstraints { required: &[], incompatible: &["neon"] }
}
_ => {
// Everything else is assumed to use a hardfloat ABI. neon and fp-armv8 must be enabled.
// These are Rust feature names and we use "neon" to control both of them.
// `FeatureConstraints` uses Rust feature names, hence only "neon" shows up.
FeatureConstraints { required: &["neon"], incompatible: &[] }
}
}
Expand Down
Loading