Skip to content
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

rustc_target: Add target feature constraints for LoongArch #138608

Merged
merged 1 commit into from
Mar 18, 2025
Merged
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
22 changes: 22 additions & 0 deletions compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
@@ -923,6 +923,28 @@ impl Target {
_ => unreachable!(),
}
}
"loongarch64" => {
// LoongArch handles ABI in a very sane way, being fully explicit via `llvm_abiname`
// about what the intended ABI is.
match &*self.llvm_abiname {
"ilp32d" | "lp64d" => {
// Requires d (which implies f), incompatible with nothing.
FeatureConstraints { required: &["d"], incompatible: &[] }
}
"ilp32f" | "lp64f" => {
// Requires f, incompatible with nothing.
FeatureConstraints { required: &["f"], incompatible: &[] }
}
"ilp32s" | "lp64s" => {
// The soft-float ABI does not require any features and is also not
// incompatible with any features. Rust targets explicitly specify the
// LLVM ABI names, which allows for enabling hard-float support even on
// soft-float targets, and ensures that the ABI behavior is as expected.
NOTHING
}
_ => unreachable!(),
}
}
_ => NOTHING,
}
}
Loading