Skip to content

Commit 24c770b

Browse files
committed
aarch64: Make outline-atomics a known target feature
This is a feature used by LLVM that is enabled for our `aarch64-linux` targets, which we would like to configure on in `std`. Thus, mark `outline-atomics` a known feature. It is left unstable for now.
1 parent adcb3d3 commit 24c770b

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

compiler/rustc_target/src/target_features.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ static AARCH64_FEATURES: &[(&str, Stability, ImpliedFeatures)] = &[
248248
("mte", Stable, &[]),
249249
// FEAT_AdvSimd & FEAT_FP
250250
("neon", Stable, &[]),
251+
// Backend option to turn atomic operations into an intrinsic call when `lse` is not known to be
252+
// available, so the intrinsic can do runtime LSE feature detection rather than unconditionally
253+
// using slower non-LSE operations. Unstable since it doesn't need to user-togglable.
254+
("outline-atomics", Unstable(sym::aarch64_unstable_target_feature), &[]),
251255
// FEAT_PAUTH (address authentication)
252256
("paca", Stable, &[]),
253257
// FEAT_PAUTH (generic authentication)

tests/assembly-llvm/asm/aarch64-outline-atomics.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
use std::sync::atomic::AtomicI32;
99
use std::sync::atomic::Ordering::*;
1010

11+
// Verify config on outline-atomics works (it is always enabled on aarch64-linux).
12+
#[cfg(not(target_feature = "outline-atomics"))]
13+
compile_error!("outline-atomics is not enabled");
14+
1115
pub fn compare_exchange(a: &AtomicI32) {
1216
// On AArch64 LLVM should outline atomic operations.
1317
// CHECK: __aarch64_cas4_relax

tests/ui/check-cfg/target_feature.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ LL | cfg!(target_feature = "_UNEXPECTED_VALUE");
183183
`nnp-assist`
184184
`nontrapping-fptoint`
185185
`nvic`
186+
`outline-atomics`
186187
`paca`
187188
`pacg`
188189
`pan`

0 commit comments

Comments
 (0)