Skip to content

Commit

Permalink
Rollup merge of rust-lang#134329 - taiki-e:m68k-target-feature, r=wor…
Browse files Browse the repository at this point in the history
…kingjubilee

Add m68k_target_feature

This adds the following unstable target features (tracking issue: rust-lang#134328):

- isa-68000
- isa-68010
- isa-68020
- isa-68030
- isa-68040
- isa-68060
- isa-68881
- isa-68882

The feature names and implied features are match with [definitions in LLVM](https://github.com/llvm/llvm-project/blob/llvmorg-19.1.0/llvm/lib/Target/M68k/M68k.td#L21-L57).

isa-68881 and isa-68882 are FPU ISA features.
isa-68881 is needed to support input/output in floating-point regs in inline assembly. isa-68020 is needed to implement taiki-e/atomic-maybe-uninit#28 more robustly.

cc `@glaubitz` `@ricky26` (designated developers  of [m68k-unknown-linux-gnu](https://doc.rust-lang.org/nightly/rustc/platform-support/m68k-unknown-linux-gnu.html#designated-developers))
r? workingjubilee

`@rustbot` label +O-motorola68k +A-target-feature
  • Loading branch information
jieyouxu authored Dec 15, 2024
2 parents fdd0eb0 + 56b8e66 commit 54e2d39
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 2 deletions.
1 change: 1 addition & 0 deletions compiler/rustc_feature/src/unstable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ declare_features! (
(unstable, hexagon_target_feature, "1.27.0", Some(44839)),
(unstable, lahfsahf_target_feature, "1.78.0", Some(44839)),
(unstable, loongarch_target_feature, "1.73.0", Some(44839)),
(unstable, m68k_target_feature, "CURRENT_RUSTC_VERSION", Some(134328)),
(unstable, mips_target_feature, "1.27.0", Some(44839)),
(unstable, powerpc_target_feature, "1.27.0", Some(44839)),
(unstable, prfchw_target_feature, "1.78.0", Some(44839)),
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@ symbols! {
loongarch_target_feature,
loop_break_value,
lt,
m68k_target_feature,
macro_at_most_once_rep,
macro_attributes_in_derive_output,
macro_escape,
Expand Down
18 changes: 17 additions & 1 deletion compiler/rustc_target/src/target_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,20 @@ const SPARC_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
// tidy-alphabetical-end
];

const M68K_FEATURES: &[(&str, StabilityUncomputed, ImpliedFeatures)] = &[
// tidy-alphabetical-start
("isa-68000", unstable(sym::m68k_target_feature), &[]),
("isa-68010", unstable(sym::m68k_target_feature), &["isa-68000"]),
("isa-68020", unstable(sym::m68k_target_feature), &["isa-68010"]),
("isa-68030", unstable(sym::m68k_target_feature), &["isa-68020"]),
("isa-68040", unstable(sym::m68k_target_feature), &["isa-68030", "isa-68882"]),
("isa-68060", unstable(sym::m68k_target_feature), &["isa-68040"]),
// FPU
("isa-68881", unstable(sym::m68k_target_feature), &[]),
("isa-68882", unstable(sym::m68k_target_feature), &["isa-68881"]),
// tidy-alphabetical-end
];

/// When rustdoc is running, provide a list of all known features so that all their respective
/// primitives may be documented.
///
Expand All @@ -687,6 +701,7 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, StabilityUncom
.chain(LOONGARCH_FEATURES)
.chain(IBMZ_FEATURES)
.chain(SPARC_FEATURES)
.chain(M68K_FEATURES)
.cloned()
.map(|(f, s, _)| (f, s))
}
Expand Down Expand Up @@ -734,6 +749,7 @@ impl Target {
"loongarch64" => LOONGARCH_FEATURES,
"s390x" => IBMZ_FEATURES,
"sparc" | "sparc64" => SPARC_FEATURES,
"m68k" => M68K_FEATURES,
_ => &[],
}
}
Expand All @@ -751,7 +767,7 @@ impl Target {
"sparc" | "sparc64" => SPARC_FEATURES_FOR_CORRECT_VECTOR_ABI,
"hexagon" => HEXAGON_FEATURES_FOR_CORRECT_VECTOR_ABI,
"mips" | "mips32r6" | "mips64" | "mips64r6" => MIPS_FEATURES_FOR_CORRECT_VECTOR_ABI,
"bpf" => &[], // no vector ABI
"bpf" | "m68k" => &[], // no vector ABI
"csky" => CSKY_FEATURES_FOR_CORRECT_VECTOR_ABI,
// FIXME: for some tier3 targets, we are overly cautious and always give warnings
// when passing args in vector registers.
Expand Down
8 changes: 8 additions & 0 deletions tests/ui/check-cfg/target_feature.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
`hvx-length128b`
`hwdiv`
`i8mm`
`isa-68000`
`isa-68010`
`isa-68020`
`isa-68030`
`isa-68040`
`isa-68060`
`isa-68881`
`isa-68882`
`jsconv`
`lahfsahf`
`lasx`
Expand Down
1 change: 1 addition & 0 deletions tests/ui/target-feature/gate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
// gate-test-s390x_target_feature
// gate-test-sparc_target_feature
// gate-test-x87_target_feature
// gate-test-m68k_target_feature

#[target_feature(enable = "avx512bw")]
//~^ ERROR: currently unstable
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/target-feature/gate.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error[E0658]: the target feature `avx512bw` is currently unstable
--> $DIR/gate.rs:29:18
--> $DIR/gate.rs:30:18
|
LL | #[target_feature(enable = "avx512bw")]
| ^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit 54e2d39

Please sign in to comment.