about summary refs log tree commit diff
path: root/tests/assembly-llvm/asm/aarch64-outline-atomics.rs
blob: 1177c1e68ed56702bc377d7dce5364ae2bb158dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//@ 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);
}