Skip to content

Commit 9a07350

Browse files
committed
Add avr_target_feature
1 parent fecb335 commit 9a07350

6 files changed

Lines changed: 48 additions & 9 deletions

File tree

compiler/rustc_feature/src/unstable.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,8 @@ declare_features! (
375375
(unstable, async_for_loop, "1.77.0", Some(118898)),
376376
/// Allows `async` trait bound modifier.
377377
(unstable, async_trait_bounds, "1.85.0", Some(62290)),
378+
/// Target features on avr.
379+
(unstable, avr_target_feature, "CURRENT_RUSTC_VERSION", Some(146889)),
378380
/// Allows using Intel AVX10 target features and intrinsics
379381
(unstable, avx10_target_feature, "1.88.0", Some(138843)),
380382
/// Target features on bpf.

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,7 @@ symbols! {
564564
automatically_derived,
565565
available_externally,
566566
avr,
567+
avr_target_feature,
567568
avx,
568569
avx10_target_feature,
569570
avx512_target_feature,

compiler/rustc_target/src/target_features.rs

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,28 @@ static M68K_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
885885
// tidy-alphabetical-end
886886
];
887887

888+
static AVR_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
889+
// tidy-alphabetical-start
890+
("addsubiw", Unstable(sym::avr_target_feature), &[]),
891+
("break", Unstable(sym::avr_target_feature), &[]),
892+
("eijmpcall", Unstable(sym::avr_target_feature), &[]),
893+
("elpm", Unstable(sym::avr_target_feature), &[]),
894+
("elpmx", Unstable(sym::avr_target_feature), &[]),
895+
("ijmpcall", Unstable(sym::avr_target_feature), &[]),
896+
("jmpcall", Unstable(sym::avr_target_feature), &[]),
897+
("lowbytefirst", Unstable(sym::avr_target_feature), &[]),
898+
("lpm", Unstable(sym::avr_target_feature), &[]),
899+
("lpmx", Unstable(sym::avr_target_feature), &[]),
900+
("movw", Unstable(sym::avr_target_feature), &[]),
901+
("mul", Unstable(sym::avr_target_feature), &[]),
902+
("rmw", Unstable(sym::avr_target_feature), &[]),
903+
("spm", Unstable(sym::avr_target_feature), &[]),
904+
("spmx", Unstable(sym::avr_target_feature), &[]),
905+
("sram", Unstable(sym::avr_target_feature), &[]),
906+
("tinyencoding", Unstable(sym::avr_target_feature), &[]),
907+
// tidy-alphabetical-end
908+
];
909+
888910
/// When rustdoc is running, provide a list of all known features so that all their respective
889911
/// primitives may be documented.
890912
///
@@ -906,6 +928,7 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
906928
.chain(IBMZ_FEATURES)
907929
.chain(SPARC_FEATURES)
908930
.chain(M68K_FEATURES)
931+
.chain(AVR_FEATURES)
909932
.cloned()
910933
.map(|(f, s, _)| (f, s))
911934
}
@@ -983,8 +1006,8 @@ impl Target {
9831006
Arch::S390x => IBMZ_FEATURES,
9841007
Arch::Sparc | Arch::Sparc64 => SPARC_FEATURES,
9851008
Arch::M68k => M68K_FEATURES,
1009+
Arch::Avr => AVR_FEATURES,
9861010
Arch::AmdGpu
987-
| Arch::Avr
9881011
| Arch::Msp430
9891012
| Arch::PowerPC64LE
9901013
| Arch::SpirV
@@ -1011,16 +1034,11 @@ impl Target {
10111034
MIPS_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI
10121035
}
10131036
Arch::AmdGpu => AMDGPU_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI,
1014-
Arch::Nvptx64 | Arch::Bpf | Arch::M68k => &[], // no vector ABI
1037+
Arch::Nvptx64 | Arch::Bpf | Arch::M68k | Arch::Avr => &[], // no vector ABI
10151038
Arch::CSky => CSKY_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI,
10161039
// FIXME: for some tier3 targets, we are overly cautious and always give warnings
10171040
// when passing args in vector registers.
1018-
Arch::Avr
1019-
| Arch::Msp430
1020-
| Arch::PowerPC64LE
1021-
| Arch::SpirV
1022-
| Arch::Xtensa
1023-
| Arch::Other(_) => &[],
1041+
Arch::Msp430 | Arch::PowerPC64LE | Arch::SpirV | Arch::Xtensa | Arch::Other(_) => &[],
10241042
}
10251043
}
10261044

tests/ui/check-cfg/target_feature.stderr

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
1414
`7e10`
1515
`a`
1616
`aclass`
17+
`addsubiw`
1718
`adx`
1819
`aes`
1920
`altivec`
@@ -57,6 +58,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
5758
`bf16`
5859
`bmi1`
5960
`bmi2`
61+
`break`
6062
`bti`
6163
`bulk-memory`
6264
`c`
@@ -83,6 +85,9 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
8385
`e2`
8486
`ecv`
8587
`edsp`
88+
`eijmpcall`
89+
`elpm`
90+
`elpmx`
8691
`elrw`
8792
`enhanced-sort`
8893
`ermsb`
@@ -134,6 +139,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
134139
`hvx-length128b`
135140
`hwdiv`
136141
`i8mm`
142+
`ijmpcall`
137143
`isa-68000`
138144
`isa-68010`
139145
`isa-68020`
@@ -142,6 +148,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
142148
`isa-68060`
143149
`isa-68881`
144150
`isa-68882`
151+
`jmpcall`
145152
`jsconv`
146153
`kl`
147154
`lahfsahf`
@@ -152,6 +159,9 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
152159
`ld-seq-sa`
153160
`leoncasa`
154161
`lor`
162+
`lowbytefirst`
163+
`lpm`
164+
`lpmx`
155165
`lse`
156166
`lse128`
157167
`lse2`
@@ -173,11 +183,13 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
173183
`mops`
174184
`movbe`
175185
`movrs`
186+
`movw`
176187
`mp`
177188
`mp1e2`
178189
`msa`
179190
`msync`
180191
`mte`
192+
`mul`
181193
`multivalue`
182194
`mutable-globals`
183195
`neon`
@@ -242,6 +254,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
242254
`reference-types`
243255
`relax`
244256
`relaxed-simd`
257+
`rmw`
245258
`rtm`
246259
`rva23u64`
247260
`sb`
@@ -294,6 +307,9 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
294307
`sme2p1`
295308
`soft-float`
296309
`spe`
310+
`spm`
311+
`spmx`
312+
`sram`
297313
`ssbs`
298314
`sse`
299315
`sse2`
@@ -318,6 +334,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
318334
`tbm`
319335
`thumb-mode`
320336
`thumb2`
337+
`tinyencoding`
321338
`tme`
322339
`transactional-execution`
323340
`trust`

tests/ui/target-feature/gate.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
// gate-test-sparc_target_feature
2121
// gate-test-x87_target_feature
2222
// gate-test-m68k_target_feature
23+
// gate-test-avr_target_feature
2324

2425
#[target_feature(enable = "x87")]
2526
//~^ ERROR: currently unstable

tests/ui/target-feature/gate.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the target feature `x87` is currently unstable
2-
--> $DIR/gate.rs:24:18
2+
--> $DIR/gate.rs:25:18
33
|
44
LL | #[target_feature(enable = "x87")]
55
| ^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)