Rollup merge of #132552 - taiki-e:sparc-target-feature, r=workingjubilee
Add v9, v8plus, and leoncasa target feature to sparc and use v8plus in create_object_file This adds the following three unstable target features: - `v9`: SPARC-V9 instructions ([LLVM definition][sparc-v9]) - Relevant to https://github.com/rust-lang/rust/pull/131222#issuecomment-2453310963 - Relevant to https://github.com/rust-lang/rust/pull/132472#discussion_r1832606081 - This is also needed to implement https://github.com/taiki-e/atomic-maybe-uninit/pull/31 (depends on inline assembly support) more robustly. - `v8plus`: SPARC-V8+ ABI ([LLVM definition][sparc-v8plus]) - This is added in LLVM 20. In LLVM 19 and older, it is emulated to work the same way as LLVM in each LLVM version. - See https://github.com/rust-lang/rust/issues/132585#issuecomment-2453926257 for more. - `leoncasa`: CASA instruction[^1] of LEON3 and LEON4 processors ([LLVM definition][sparc-leoncasa], LLVM feature name: `hasleoncasa`) - This is needed to implement https://github.com/taiki-e/atomic-maybe-uninit/pull/31 (depends on inline assembly support) more robustly. [^1]: Atomic CAS instruction [sparc-v9]:f5e4ffaa49/llvm/lib/Target/Sparc/Sparc.td (L37-L39)
[sparc-v8plus]:f5e4ffaa49/llvm/lib/Target/Sparc/Sparc.td (L37-L39)
[sparc-leoncasa]: https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/Sparc/LeonFeatures.td#L32-L37
This commit is contained in:
commit
b9d4ef16c9
16 changed files with 113 additions and 4 deletions
|
@ -14,6 +14,7 @@ pub(crate) fn target() -> Target {
|
|||
data_layout: "E-m:e-p:32:32-i64:64-i128:128-f128:64-n32-S64".into(),
|
||||
arch: "sparc".into(),
|
||||
options: TargetOptions {
|
||||
features: "+v8plus".into(),
|
||||
cpu: "v9".into(),
|
||||
endian: Endian::Big,
|
||||
late_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[
|
||||
|
|
|
@ -545,6 +545,14 @@ const IBMZ_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
|
|||
// tidy-alphabetical-end
|
||||
];
|
||||
|
||||
const SPARC_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
|
||||
// tidy-alphabetical-start
|
||||
("leoncasa", Unstable(sym::sparc_target_feature), &[]),
|
||||
("v8plus", Unstable(sym::sparc_target_feature), &[]),
|
||||
("v9", Unstable(sym::sparc_target_feature), &[]),
|
||||
// tidy-alphabetical-end
|
||||
];
|
||||
|
||||
/// When rustdoc is running, provide a list of all known features so that all their respective
|
||||
/// primitives may be documented.
|
||||
///
|
||||
|
@ -563,6 +571,7 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
|
|||
.chain(CSKY_FEATURES)
|
||||
.chain(LOONGARCH_FEATURES)
|
||||
.chain(IBMZ_FEATURES)
|
||||
.chain(SPARC_FEATURES)
|
||||
.cloned()
|
||||
.map(|(f, s, _)| (f, s))
|
||||
}
|
||||
|
@ -582,6 +591,7 @@ impl super::spec::Target {
|
|||
"csky" => CSKY_FEATURES,
|
||||
"loongarch64" => LOONGARCH_FEATURES,
|
||||
"s390x" => IBMZ_FEATURES,
|
||||
"sparc" | "sparc64" => SPARC_FEATURES,
|
||||
_ => &[],
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue