Skip to content

Commit 8a57820

Browse files
committed
Auto merge of #84665 - adamgemmell:aarch64-features, r=Amanieu
Update list of allowed aarch64 features I recently added these features to std_detect for aarch64 linux, pending [review](rust-lang/stdarch#1146). I have commented any features not supported by LLVM 9, the current minimum version for Rust. Some (PAuth at least) were renamed between 9 & 12 and I've left them disabled. TME, however, is not in LLVM 9 but I've left it enabled. See rust-lang/stdarch#993
2 parents 35bab92 + d3737a6 commit 8a57820

File tree

3 files changed

+83
-3
lines changed

3 files changed

+83
-3
lines changed

compiler/rustc_codegen_llvm/src/llvm_util.rs

+6
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ pub fn to_llvm_feature<'a>(sess: &Session, s: &'a str) -> &'a str {
152152
("x86", "avx512vpclmulqdq") => "vpclmulqdq",
153153
("aarch64", "fp") => "fp-armv8",
154154
("aarch64", "fp16") => "fullfp16",
155+
("aarch64", "fhm") => "fp16fml",
156+
("aarch64", "rcpc2") => "rcpc-immo",
157+
("aarch64", "dpb") => "ccpp",
158+
("aarch64", "dpb2") => "ccdp",
159+
("aarch64", "frintts") => "fptoint",
160+
("aarch64", "fcma") => "complxnum",
155161
(_, s) => s,
156162
}
157163
}

compiler/rustc_codegen_ssa/src/target_features.rs

+77-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
1717
("neon", Some(sym::arm_target_feature)),
1818
("crc", Some(sym::arm_target_feature)),
1919
("crypto", Some(sym::arm_target_feature)),
20+
("aes", Some(sym::arm_target_feature)),
21+
("sha2", Some(sym::arm_target_feature)),
2022
("v5te", Some(sym::arm_target_feature)),
2123
("v6", Some(sym::arm_target_feature)),
2224
("v6k", Some(sym::arm_target_feature)),
@@ -33,22 +35,95 @@ const ARM_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
3335
("thumb-mode", Some(sym::arm_target_feature)),
3436
];
3537

38+
// Commented features are not available in LLVM 10.0, or have since been renamed
3639
const AARCH64_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[
37-
("fp", Some(sym::aarch64_target_feature)),
40+
// FEAT_AdvSimd
3841
("neon", Some(sym::aarch64_target_feature)),
42+
// FEAT_FP
43+
("fp", Some(sym::aarch64_target_feature)),
44+
// FEAT_FP16
45+
("fp16", Some(sym::aarch64_target_feature)),
46+
// FEAT_SVE
3947
("sve", Some(sym::aarch64_target_feature)),
48+
// FEAT_CRC
4049
("crc", Some(sym::aarch64_target_feature)),
50+
// Cryptographic extension
4151
("crypto", Some(sym::aarch64_target_feature)),
52+
// FEAT_RAS
4253
("ras", Some(sym::aarch64_target_feature)),
54+
// FEAT_LSE
4355
("lse", Some(sym::aarch64_target_feature)),
56+
// FEAT_RDM
4457
("rdm", Some(sym::aarch64_target_feature)),
45-
("fp16", Some(sym::aarch64_target_feature)),
58+
// FEAT_RCPC
4659
("rcpc", Some(sym::aarch64_target_feature)),
60+
// FEAT_RCPC2
61+
("rcpc2", Some(sym::aarch64_target_feature)),
62+
// FEAT_DotProd
4763
("dotprod", Some(sym::aarch64_target_feature)),
64+
// FEAT_TME
4865
("tme", Some(sym::aarch64_target_feature)),
66+
// FEAT_FHM
67+
("fhm", Some(sym::aarch64_target_feature)),
68+
// FEAT_DIT
69+
("dit", Some(sym::aarch64_target_feature)),
70+
// FEAT_FLAGM
71+
// ("flagm", Some(sym::aarch64_target_feature)),
72+
// FEAT_SSBS
73+
("ssbs", Some(sym::aarch64_target_feature)),
74+
// FEAT_SB
75+
("sb", Some(sym::aarch64_target_feature)),
76+
// FEAT_PAUTH
77+
// ("pauth", Some(sym::aarch64_target_feature)),
78+
// FEAT_DPB
79+
("dpb", Some(sym::aarch64_target_feature)),
80+
// FEAT_DPB2
81+
("dpb2", Some(sym::aarch64_target_feature)),
82+
// FEAT_SVE2
83+
("sve2", Some(sym::aarch64_target_feature)),
84+
// FEAT_SVE2_AES
85+
("sve2-aes", Some(sym::aarch64_target_feature)),
86+
// FEAT_SVE2_SM4
87+
("sve2-sm4", Some(sym::aarch64_target_feature)),
88+
// FEAT_SVE2_SHA3
89+
("sve2-sha3", Some(sym::aarch64_target_feature)),
90+
// FEAT_SVE2_BitPerm
91+
("sve2-bitperm", Some(sym::aarch64_target_feature)),
92+
// FEAT_FRINTTS
93+
("frintts", Some(sym::aarch64_target_feature)),
94+
// FEAT_I8MM
95+
// ("i8mm", Some(sym::aarch64_target_feature)),
96+
// FEAT_F32MM
97+
// ("f32mm", Some(sym::aarch64_target_feature)),
98+
// FEAT_F64MM
99+
// ("f64mm", Some(sym::aarch64_target_feature)),
100+
// FEAT_BF16
101+
// ("bf16", Some(sym::aarch64_target_feature)),
102+
// FEAT_RAND
103+
("rand", Some(sym::aarch64_target_feature)),
104+
// FEAT_BTI
105+
("bti", Some(sym::aarch64_target_feature)),
106+
// FEAT_MTE
107+
("mte", Some(sym::aarch64_target_feature)),
108+
// FEAT_JSCVT
109+
("jsconv", Some(sym::aarch64_target_feature)),
110+
// FEAT_FCMA
111+
("fcma", Some(sym::aarch64_target_feature)),
112+
// FEAT_AES
113+
("aes", Some(sym::aarch64_target_feature)),
114+
// FEAT_SHA1 & FEAT_SHA256
115+
("sha2", Some(sym::aarch64_target_feature)),
116+
// FEAT_SHA512 & FEAT_SHA3
117+
("sha3", Some(sym::aarch64_target_feature)),
118+
// FEAT_SM3 & FEAT_SM4
119+
("sm4", Some(sym::aarch64_target_feature)),
49120
("v8.1a", Some(sym::aarch64_target_feature)),
50121
("v8.2a", Some(sym::aarch64_target_feature)),
51122
("v8.3a", Some(sym::aarch64_target_feature)),
123+
("v8.4a", Some(sym::aarch64_target_feature)),
124+
("v8.5a", Some(sym::aarch64_target_feature)),
125+
// ("v8.6a", Some(sym::aarch64_target_feature)),
126+
// ("v8.7a", Some(sym::aarch64_target_feature)),
52127
];
53128

54129
const X86_ALLOWED_FEATURES: &[(&str, Option<Symbol>)] = &[

library/std/tests/run-time-detect.rs

-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ fn aarch64_linux() {
2727
println!("asimd: {}", is_aarch64_feature_detected!("asimd"));
2828
println!("sve: {}", is_aarch64_feature_detected!("sve"));
2929
println!("crc: {}", is_aarch64_feature_detected!("crc"));
30-
println!("crypto: {}", is_aarch64_feature_detected!("crypto"));
3130
println!("lse: {}", is_aarch64_feature_detected!("lse"));
3231
println!("rdm: {}", is_aarch64_feature_detected!("rdm"));
3332
println!("rcpc: {}", is_aarch64_feature_detected!("rcpc"));

0 commit comments

Comments
 (0)