]> git.lizzy.rs Git - rust.git/blob - src/test/ui/atomic-compare_exchange.rs
Auto merge of #67000 - spastorino:remove-promoted-from-place, r=oli-obk
[rust.git] / src / test / ui / atomic-compare_exchange.rs
1 // run-pass
2
3 #![allow(stable_features)]
4
5 #![feature(extended_compare_and_swap)]
6 use std::sync::atomic::AtomicIsize;
7 use std::sync::atomic::Ordering::*;
8
9 static ATOMIC: AtomicIsize = AtomicIsize::new(0);
10
11 fn main() {
12     // Make sure codegen can emit all the intrinsics correctly
13     ATOMIC.compare_exchange(0, 1, Relaxed, Relaxed).ok();
14     ATOMIC.compare_exchange(0, 1, Acquire, Relaxed).ok();
15     ATOMIC.compare_exchange(0, 1, Release, Relaxed).ok();
16     ATOMIC.compare_exchange(0, 1, AcqRel, Relaxed).ok();
17     ATOMIC.compare_exchange(0, 1, SeqCst, Relaxed).ok();
18     ATOMIC.compare_exchange(0, 1, Acquire, Acquire).ok();
19     ATOMIC.compare_exchange(0, 1, AcqRel, Acquire).ok();
20     ATOMIC.compare_exchange(0, 1, SeqCst, Acquire).ok();
21     ATOMIC.compare_exchange(0, 1, SeqCst, SeqCst).ok();
22     ATOMIC.compare_exchange_weak(0, 1, Relaxed, Relaxed).ok();
23     ATOMIC.compare_exchange_weak(0, 1, Acquire, Relaxed).ok();
24     ATOMIC.compare_exchange_weak(0, 1, Release, Relaxed).ok();
25     ATOMIC.compare_exchange_weak(0, 1, AcqRel, Relaxed).ok();
26     ATOMIC.compare_exchange_weak(0, 1, SeqCst, Relaxed).ok();
27     ATOMIC.compare_exchange_weak(0, 1, Acquire, Acquire).ok();
28     ATOMIC.compare_exchange_weak(0, 1, AcqRel, Acquire).ok();
29     ATOMIC.compare_exchange_weak(0, 1, SeqCst, Acquire).ok();
30     ATOMIC.compare_exchange_weak(0, 1, SeqCst, SeqCst).ok();
31 }