Skip to content

Commit 8cbc623

Browse files
committed
Add avr_target_feature
1 parent 0a13b43 commit 8cbc623

6 files changed

Lines changed: 48 additions & 4 deletions

File tree

compiler/rustc_feature/src/unstable.rs

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

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,7 @@ symbols! {
577577
automatically_derived,
578578
available_externally,
579579
avr,
580+
avr_target_feature,
580581
avx,
581582
avx10_target_feature,
582583
avx512_target_feature,

compiler/rustc_target/src/target_features.rs

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,28 @@ static M68K_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
898898
// tidy-alphabetical-end
899899
];
900900

901+
static AVR_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
902+
// tidy-alphabetical-start
903+
("addsubiw", Unstable(sym::avr_target_feature), &[]),
904+
("break", Unstable(sym::avr_target_feature), &[]),
905+
("eijmpcall", Unstable(sym::avr_target_feature), &[]),
906+
("elpm", Unstable(sym::avr_target_feature), &[]),
907+
("elpmx", Unstable(sym::avr_target_feature), &[]),
908+
("ijmpcall", Unstable(sym::avr_target_feature), &[]),
909+
("jmpcall", Unstable(sym::avr_target_feature), &[]),
910+
("lowbytefirst", Unstable(sym::avr_target_feature), &[]),
911+
("lpm", Unstable(sym::avr_target_feature), &[]),
912+
("lpmx", Unstable(sym::avr_target_feature), &[]),
913+
("movw", Unstable(sym::avr_target_feature), &[]),
914+
("mul", Unstable(sym::avr_target_feature), &[]),
915+
("rmw", Unstable(sym::avr_target_feature), &[]),
916+
("spm", Unstable(sym::avr_target_feature), &[]),
917+
("spmx", Unstable(sym::avr_target_feature), &[]),
918+
("sram", Unstable(sym::avr_target_feature), &[]),
919+
("tinyencoding", Unstable(sym::avr_target_feature), &[]),
920+
// tidy-alphabetical-end
921+
];
922+
901923
/// When rustdoc is running, provide a list of all known features so that all their respective
902924
/// primitives may be documented.
903925
///
@@ -919,6 +941,7 @@ pub fn all_rust_features() -> impl Iterator<Item = (&'static str, Stability)> {
919941
.chain(IBMZ_FEATURES)
920942
.chain(SPARC_FEATURES)
921943
.chain(M68K_FEATURES)
944+
.chain(AVR_FEATURES)
922945
.cloned()
923946
.map(|(f, s, _)| (f, s))
924947
}
@@ -996,8 +1019,8 @@ impl Target {
9961019
Arch::S390x => IBMZ_FEATURES,
9971020
Arch::Sparc | Arch::Sparc64 => SPARC_FEATURES,
9981021
Arch::M68k => M68K_FEATURES,
1022+
Arch::Avr => AVR_FEATURES,
9991023
Arch::AmdGpu
1000-
| Arch::Avr
10011024
| Arch::Msp430
10021025
| Arch::SpirV
10031026
| Arch::Xtensa
@@ -1023,11 +1046,11 @@ impl Target {
10231046
MIPS_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI
10241047
}
10251048
Arch::AmdGpu => AMDGPU_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI,
1026-
Arch::Nvptx64 | Arch::Bpf | Arch::M68k => &[], // no vector ABI
1049+
Arch::Nvptx64 | Arch::Bpf | Arch::M68k | Arch::Avr => &[], // no vector ABI
10271050
Arch::CSky => CSKY_FEATURES_FOR_CORRECT_FIXED_LENGTH_VECTOR_ABI,
10281051
// FIXME: for some tier3 targets, we are overly cautious and always give warnings
10291052
// when passing args in vector registers.
1030-
Arch::Avr | Arch::Msp430 | Arch::SpirV | Arch::Xtensa | Arch::Other(_) => &[],
1053+
Arch::Msp430 | Arch::SpirV | Arch::Xtensa | Arch::Other(_) => &[],
10311054
}
10321055
}
10331056

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`
@@ -148,6 +153,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
148153
`hvxv79`
149154
`hwdiv`
150155
`i8mm`
156+
`ijmpcall`
151157
`isa-68000`
152158
`isa-68010`
153159
`isa-68020`
@@ -156,6 +162,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
156162
`isa-68060`
157163
`isa-68881`
158164
`isa-68882`
165+
`jmpcall`
159166
`jsconv`
160167
`kl`
161168
`lahfsahf`
@@ -166,6 +173,9 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
166173
`ld-seq-sa`
167174
`leoncasa`
168175
`lor`
176+
`lowbytefirst`
177+
`lpm`
178+
`lpmx`
169179
`lse`
170180
`lse128`
171181
`lse2`
@@ -187,11 +197,13 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
187197
`mops`
188198
`movbe`
189199
`movrs`
200+
`movw`
190201
`mp`
191202
`mp1e2`
192203
`msa`
193204
`msync`
194205
`mte`
206+
`mul`
195207
`multivalue`
196208
`mutable-globals`
197209
`neon`
@@ -256,6 +268,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
256268
`reference-types`
257269
`relax`
258270
`relaxed-simd`
271+
`rmw`
259272
`rtm`
260273
`rva23u64`
261274
`sb`
@@ -308,6 +321,9 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
308321
`sme2p1`
309322
`soft-float`
310323
`spe`
324+
`spm`
325+
`spmx`
326+
`sram`
311327
`ssbs`
312328
`sse`
313329
`sse2`
@@ -332,6 +348,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
332348
`tbm`
333349
`thumb-mode`
334350
`thumb2`
351+
`tinyencoding`
335352
`tme`
336353
`transactional-execution`
337354
`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)