Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 0ee99cf

Browse files
committedMar 17, 2025
rustc_target: Add target feature constraints for LoongArch
Part of #116344
1 parent c3dd4ee commit 0ee99cf

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
 

‎compiler/rustc_target/src/target_features.rs

+22
Original file line numberDiff line numberDiff line change
@@ -923,6 +923,28 @@ impl Target {
923923
_ => unreachable!(),
924924
}
925925
}
926+
"loongarch64" => {
927+
// LoongArch handles ABI in a very sane way, being fully explicit via `llvm_abiname`
928+
// about what the intended ABI is.
929+
match &*self.llvm_abiname {
930+
"ilp32d" | "lp64d" => {
931+
// Requires d (which implies f), incompatible with nothing.
932+
FeatureConstraints { required: &["d"], incompatible: &[] }
933+
}
934+
"ilp32f" | "lp64f" => {
935+
// Requires f, incompatible with nothing.
936+
FeatureConstraints { required: &["f"], incompatible: &[] }
937+
}
938+
"ilp32s" | "lp64s" => {
939+
// The soft-float ABI does not require any features and is also not
940+
// incompatible with any features. Rust targets explicitly specify the
941+
// LLVM ABI names, which allows for enabling hard-float support even on
942+
// soft-float targets, and ensures that the ABI behavior is as expected.
943+
NOTHING
944+
}
945+
_ => unreachable!(),
946+
}
947+
}
926948
_ => NOTHING,
927949
}
928950
}

0 commit comments

Comments
 (0)
Failed to load comments.