Skip to content

Commit 5a56217

Browse files
committed
Stabilise aarch64_target_feature
1 parent 3996139 commit 5a56217

File tree

8 files changed

+64
-58
lines changed

8 files changed

+64
-58
lines changed

compiler/rustc_codegen_ssa/src/target_features.rs

+56-53
Original file line numberDiff line numberDiff line change
@@ -44,105 +44,108 @@ const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
4444

4545
const AARCH64_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
4646
// FEAT_AdvSimd
47-
("neon", Some(sym::aarch64_target_feature)),
47+
("neon", None),
4848
// FEAT_FP
49-
("fp", Some(sym::aarch64_target_feature)),
49+
("fp", None),
5050
// FEAT_FP16
51-
("fp16", Some(sym::aarch64_target_feature)),
51+
("fp16", None),
5252
// FEAT_SVE
53-
("sve", Some(sym::aarch64_target_feature)),
53+
("sve", None),
5454
// FEAT_CRC
55-
("crc", Some(sym::aarch64_target_feature)),
55+
("crc", None),
5656
// FEAT_RAS
57-
("ras", Some(sym::aarch64_target_feature)),
57+
("ras", None),
5858
// FEAT_LSE
59-
("lse", Some(sym::aarch64_target_feature)),
59+
("lse", None),
6060
// FEAT_RDM
61-
("rdm", Some(sym::aarch64_target_feature)),
61+
("rdm", None),
6262
// FEAT_RCPC
63-
("rcpc", Some(sym::aarch64_target_feature)),
63+
("rcpc", None),
6464
// FEAT_RCPC2
65-
("rcpc2", Some(sym::aarch64_target_feature)),
65+
("rcpc2", None),
6666
// FEAT_DotProd
67-
("dotprod", Some(sym::aarch64_target_feature)),
67+
("dotprod", None),
6868
// FEAT_TME
69-
("tme", Some(sym::aarch64_target_feature)),
69+
("tme", None),
7070
// FEAT_FHM
71-
("fhm", Some(sym::aarch64_target_feature)),
71+
("fhm", None),
7272
// FEAT_DIT
73-
("dit", Some(sym::aarch64_target_feature)),
73+
("dit", None),
7474
// FEAT_FLAGM
75-
("flagm", Some(sym::aarch64_target_feature)),
75+
("flagm", None),
7676
// FEAT_SSBS
77-
("ssbs", Some(sym::aarch64_target_feature)),
77+
("ssbs", None),
7878
// FEAT_SB
79-
("sb", Some(sym::aarch64_target_feature)),
79+
("sb", None),
8080
// FEAT_PAUTH (address authentication)
81-
("paca", Some(sym::aarch64_target_feature)),
81+
("paca", None),
8282
// FEAT_PAUTH (generic authentication)
83-
("pacg", Some(sym::aarch64_target_feature)),
83+
("pacg", None),
8484
// FEAT_DPB
85-
("dpb", Some(sym::aarch64_target_feature)),
85+
("dpb", None),
8686
// FEAT_DPB2
87-
("dpb2", Some(sym::aarch64_target_feature)),
87+
("dpb2", None),
8888
// FEAT_SVE2
89-
("sve2", Some(sym::aarch64_target_feature)),
89+
("sve2", None),
9090
// FEAT_SVE2_AES
91-
("sve2-aes", Some(sym::aarch64_target_feature)),
91+
("sve2-aes", None),
9292
// FEAT_SVE2_SM4
93-
("sve2-sm4", Some(sym::aarch64_target_feature)),
93+
("sve2-sm4", None),
9494
// FEAT_SVE2_SHA3
95-
("sve2-sha3", Some(sym::aarch64_target_feature)),
95+
("sve2-sha3", None),
9696
// FEAT_SVE2_BitPerm
97-
("sve2-bitperm", Some(sym::aarch64_target_feature)),
97+
("sve2-bitperm", None),
9898
// FEAT_FRINTTS
99-
("frintts", Some(sym::aarch64_target_feature)),
99+
("frintts", None),
100100
// FEAT_I8MM
101-
("i8mm", Some(sym::aarch64_target_feature)),
101+
("i8mm", None),
102102
// FEAT_F32MM
103-
("f32mm", Some(sym::aarch64_target_feature)),
103+
("f32mm", None),
104104
// FEAT_F64MM
105-
("f64mm", Some(sym::aarch64_target_feature)),
105+
("f64mm", None),
106106
// FEAT_BF16
107-
("bf16", Some(sym::aarch64_target_feature)),
107+
("bf16", None),
108108
// FEAT_RAND
109-
("rand", Some(sym::aarch64_target_feature)),
109+
("rand", None),
110110
// FEAT_BTI
111-
("bti", Some(sym::aarch64_target_feature)),
111+
("bti", None),
112112
// FEAT_MTE
113-
("mte", Some(sym::aarch64_target_feature)),
113+
("mte", None),
114114
// FEAT_JSCVT
115-
("jsconv", Some(sym::aarch64_target_feature)),
115+
("jsconv", None),
116116
// FEAT_FCMA
117-
("fcma", Some(sym::aarch64_target_feature)),
117+
("fcma", None),
118118
// FEAT_AES
119-
("aes", Some(sym::aarch64_target_feature)),
119+
("aes", None),
120120
// FEAT_SHA1 & FEAT_SHA256
121-
("sha2", Some(sym::aarch64_target_feature)),
121+
("sha2", None),
122122
// FEAT_SHA512 & FEAT_SHA3
123-
("sha3", Some(sym::aarch64_target_feature)),
123+
("sha3", None),
124124
// FEAT_SM3 & FEAT_SM4
125-
("sm4", Some(sym::aarch64_target_feature)),
125+
("sm4", None),
126126
// FEAT_PAN
127-
("pan", Some(sym::aarch64_target_feature)),
127+
("pan", None),
128128
// FEAT_LOR
129-
("lor", Some(sym::aarch64_target_feature)),
129+
("lor", None),
130130
// FEAT_VHE
131-
("vh", Some(sym::aarch64_target_feature)),
131+
("vh", None),
132132
// FEAT_PMUv3
133-
("pmuv3", Some(sym::aarch64_target_feature)),
133+
("pmuv3", None),
134134
// FEAT_SPE
135-
("spe", Some(sym::aarch64_target_feature)),
136-
("v8.1a", Some(sym::aarch64_target_feature)),
137-
("v8.2a", Some(sym::aarch64_target_feature)),
138-
("v8.3a", Some(sym::aarch64_target_feature)),
139-
("v8.4a", Some(sym::aarch64_target_feature)),
140-
("v8.5a", Some(sym::aarch64_target_feature)),
141-
("v8.6a", Some(sym::aarch64_target_feature)),
142-
("v8.7a", Some(sym::aarch64_target_feature)),
135+
("spe", None),
136+
("v8.1a", Some(sym::aarch64_ver_target_feature)),
137+
("v8.2a", Some(sym::aarch64_ver_target_feature)),
138+
("v8.3a", Some(sym::aarch64_ver_target_feature)),
139+
("v8.4a", Some(sym::aarch64_ver_target_feature)),
140+
("v8.5a", Some(sym::aarch64_ver_target_feature)),
141+
("v8.6a", Some(sym::aarch64_ver_target_feature)),
142+
("v8.7a", Some(sym::aarch64_ver_target_feature)),
143143
];
144144

145-
const AARCH64_TIED_FEATURES: &[&[&str]] = &[&["paca", "pacg"]];
145+
const AARCH64_TIED_FEATURES: &[&[&str]] = &[
146+
&["fp", "neon"], // Silicon always has both, so avoid needless complications
147+
&["paca", "pacg"], // Together these represent `pauth` in LLVM
148+
];
146149

147150
const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
148151
("adx", Some(sym::adx_target_feature)),

compiler/rustc_feature/src/accepted.rs

+2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ declare_features! (
4646
// feature-group-start: accepted features
4747
// -------------------------------------------------------------------------
4848

49+
/// Allows `#[target_feature(...)]` on aarch64 platforms
50+
(accepted, aarch64_target_feature, "1.61.0", Some(44839), None),
4951
/// Allows the sysV64 ABI to be specified on all platforms
5052
/// instead of just the platforms on which it is the C ABI.
5153
(accepted, abi_sysv64, "1.24.0", Some(36167), None),

compiler/rustc_feature/src/active.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ declare_features! (
241241
// FIXME: Document these and merge with the list below.
242242

243243
// Unstable `#[target_feature]` directives.
244-
(active, aarch64_target_feature, "1.27.0", Some(44839), None),
244+
(active, aarch64_ver_target_feature, "1.27.0", Some(44839), None),
245245
(active, adx_target_feature, "1.32.0", Some(44839), None),
246246
(active, arm_target_feature, "1.27.0", Some(44839), None),
247247
(active, avx512_target_feature, "1.27.0", Some(44839), None),

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ symbols! {
278278
_task_context,
279279
a32,
280280
aarch64_target_feature,
281+
aarch64_ver_target_feature,
281282
abi,
282283
abi_amdgpu_kernel,
283284
abi_avr_interrupt,

compiler/rustc_typeck/src/collect.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2680,7 +2680,6 @@ fn from_target_feature(
26802680
// Only allow features whose feature gates have been enabled.
26812681
let allowed = match feature_gate.as_ref().copied() {
26822682
Some(sym::arm_target_feature) => rust_features.arm_target_feature,
2683-
Some(sym::aarch64_target_feature) => rust_features.aarch64_target_feature,
26842683
Some(sym::hexagon_target_feature) => rust_features.hexagon_target_feature,
26852684
Some(sym::powerpc_target_feature) => rust_features.powerpc_target_feature,
26862685
Some(sym::mips_target_feature) => rust_features.mips_target_feature,
@@ -2696,6 +2695,7 @@ fn from_target_feature(
26962695
Some(sym::f16c_target_feature) => rust_features.f16c_target_feature,
26972696
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature,
26982697
Some(sym::bpf_target_feature) => rust_features.bpf_target_feature,
2698+
Some(sym::aarch64_ver_target_feature) => rust_features.aarch64_ver_target_feature,
26992699
Some(name) => bug!("unknown target feature gate {}", name),
27002700
None => true,
27012701
};

library/core/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@
206206
#![feature(asm_const)]
207207
//
208208
// Target features:
209-
#![feature(aarch64_target_feature)]
209+
#![cfg_attr(bootstrap, feature(aarch64_target_feature))]
210210
#![feature(adx_target_feature)]
211211
#![feature(arm_target_feature)]
212212
#![feature(avx512_target_feature)]

src/test/ui/target-feature/gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
// gate-test-avx512_target_feature
1717
// gate-test-tbm_target_feature
1818
// gate-test-arm_target_feature
19-
// gate-test-aarch64_target_feature
2019
// gate-test-hexagon_target_feature
2120
// gate-test-mips_target_feature
2221
// gate-test-wasm_target_feature
@@ -28,6 +27,7 @@
2827
// gate-test-riscv_target_feature
2928
// gate-test-ermsb_target_feature
3029
// gate-test-bpf_target_feature
30+
// gate-test-aarch64_ver_target_feature
3131

3232
#[target_feature(enable = "avx512bw")]
3333
//~^ ERROR: currently unstable

src/test/ui/target-feature/tied-features.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// build-fail
22
// compile-flags: --crate-type=rlib --target=aarch64-unknown-linux-gnu
33
// needs-llvm-components: aarch64
4-
#![feature(aarch64_target_feature, target_feature_11)]
4+
#![cfg_attr(bootstrap, feature(aarch64_target_feature))]
55
#![feature(no_core, lang_items)]
66
#![no_core]
77

0 commit comments

Comments
 (0)