mirror of
https://github.com/rust-lang/rust.git
synced 2025-11-02 05:55:42 +00:00
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.
20 lines
566 B
Rust
20 lines
566 B
Rust
//@ assembly-output: emit-asm
|
|
//@ compile-flags: -Copt-level=3
|
|
//@ only-aarch64
|
|
//@ only-linux
|
|
|
|
#![crate_type = "rlib"]
|
|
|
|
use std::sync::atomic::AtomicI32;
|
|
use std::sync::atomic::Ordering::*;
|
|
|
|
// Verify config on outline-atomics works (it is always enabled on aarch64-linux).
|
|
#[cfg(not(target_feature = "outline-atomics"))]
|
|
compile_error!("outline-atomics is not enabled");
|
|
|
|
pub fn compare_exchange(a: &AtomicI32) {
|
|
// On AArch64 LLVM should outline atomic operations.
|
|
// CHECK: __aarch64_cas4_relax
|
|
let _ = a.compare_exchange(0, 10, Relaxed, Relaxed);
|
|
}
|