2021-04-05 17:17:23 +00:00
|
|
|
//@ assembly-output: emit-asm
|
2025-02-08 18:56:57 -08:00
|
|
|
//@ compile-flags: -Copt-level=3
|
2021-04-05 17:17:23 +00:00
|
|
|
//@ only-aarch64
|
2021-10-15 06:19:08 +02:00
|
|
|
//@ only-linux
|
2021-04-05 17:17:23 +00:00
|
|
|
|
|
|
|
|
#![crate_type = "rlib"]
|
|
|
|
|
|
|
|
|
|
use std::sync::atomic::AtomicI32;
|
|
|
|
|
use std::sync::atomic::Ordering::*;
|
|
|
|
|
|
2025-08-01 00:32:56 +00:00
|
|
|
// 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");
|
|
|
|
|
|
2021-04-05 17:17:23 +00:00
|
|
|
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);
|
|
|
|
|
}
|