55// return the expected result.
66
77#![ feature( core_intrinsics) ]
8- use std:: intrinsics:: {
9- atomic_cxchg_acqrel_acquire, atomic_cxchg_acqrel_relaxed, atomic_cxchg_acqrel_seqcst,
10- atomic_cxchg_acquire_acquire, atomic_cxchg_acquire_relaxed, atomic_cxchg_acquire_seqcst,
11- atomic_cxchg_relaxed_acquire, atomic_cxchg_relaxed_relaxed, atomic_cxchg_relaxed_seqcst,
12- atomic_cxchg_release_acquire, atomic_cxchg_release_relaxed, atomic_cxchg_release_seqcst,
13- atomic_cxchg_seqcst_acquire, atomic_cxchg_seqcst_relaxed, atomic_cxchg_seqcst_seqcst,
14- } ;
8+ use std:: intrinsics:: { AtomicOrdering , atomic_cxchg} ;
159
1610#[ kani:: proof]
1711fn main ( ) {
@@ -52,21 +46,50 @@ fn main() {
5246 // Returns (val, ok) where
5347 // * val: the old value
5448 // * ok: bool indicating whether the operation was successful or not
55- let x1 = atomic_cxchg_acqrel_acquire ( ptr_a1, 0 , 1 ) ;
56- let x2 = atomic_cxchg_acqrel_relaxed ( ptr_a2, 0 , 1 ) ;
57- let x3 = atomic_cxchg_acqrel_seqcst ( ptr_a3, 0 , 1 ) ;
58- let x4 = atomic_cxchg_acquire_acquire ( ptr_a4, 0 , 1 ) ;
59- let x5 = atomic_cxchg_acquire_relaxed ( ptr_a5, 0 , 1 ) ;
60- let x6 = atomic_cxchg_acquire_seqcst ( ptr_a6, 0 , 1 ) ;
61- let x7 = atomic_cxchg_relaxed_acquire ( ptr_a7, 0 , 1 ) ;
62- let x8 = atomic_cxchg_relaxed_relaxed ( ptr_a8, 0 , 1 ) ;
63- let x9 = atomic_cxchg_relaxed_seqcst ( ptr_a9, 0 , 1 ) ;
64- let x10 = atomic_cxchg_release_acquire ( ptr_a10, 0 , 1 ) ;
65- let x11 = atomic_cxchg_release_relaxed ( ptr_a11, 0 , 1 ) ;
66- let x12 = atomic_cxchg_release_seqcst ( ptr_a12, 0 , 1 ) ;
67- let x13 = atomic_cxchg_seqcst_acquire ( ptr_a13, 0 , 1 ) ;
68- let x14 = atomic_cxchg_seqcst_relaxed ( ptr_a14, 0 , 1 ) ;
69- let x15 = atomic_cxchg_seqcst_seqcst ( ptr_a15, 0 , 1 ) ;
49+ let x1 = atomic_cxchg :: < _ , { AtomicOrdering :: AcqRel } , { AtomicOrdering :: Acquire } > (
50+ ptr_a1, 0 , 1 ,
51+ ) ;
52+ let x2 = atomic_cxchg :: < _ , { AtomicOrdering :: AcqRel } , { AtomicOrdering :: Relaxed } > (
53+ ptr_a2, 0 , 1 ,
54+ ) ;
55+ let x3 =
56+ atomic_cxchg :: < _ , { AtomicOrdering :: AcqRel } , { AtomicOrdering :: SeqCst } > ( ptr_a3, 0 , 1 ) ;
57+ let x4 = atomic_cxchg :: < _ , { AtomicOrdering :: Acquire } , { AtomicOrdering :: Acquire } > (
58+ ptr_a4, 0 , 1 ,
59+ ) ;
60+ let x5 = atomic_cxchg :: < _ , { AtomicOrdering :: Acquire } , { AtomicOrdering :: Relaxed } > (
61+ ptr_a5, 0 , 1 ,
62+ ) ;
63+ let x6 = atomic_cxchg :: < _ , { AtomicOrdering :: Acquire } , { AtomicOrdering :: SeqCst } > (
64+ ptr_a6, 0 , 1 ,
65+ ) ;
66+ let x7 = atomic_cxchg :: < _ , { AtomicOrdering :: Relaxed } , { AtomicOrdering :: Acquire } > (
67+ ptr_a7, 0 , 1 ,
68+ ) ;
69+ let x8 = atomic_cxchg :: < _ , { AtomicOrdering :: Relaxed } , { AtomicOrdering :: Relaxed } > (
70+ ptr_a8, 0 , 1 ,
71+ ) ;
72+ let x9 = atomic_cxchg :: < _ , { AtomicOrdering :: Relaxed } , { AtomicOrdering :: SeqCst } > (
73+ ptr_a9, 0 , 1 ,
74+ ) ;
75+ let x10 = atomic_cxchg :: < _ , { AtomicOrdering :: Release } , { AtomicOrdering :: Acquire } > (
76+ ptr_a10, 0 , 1 ,
77+ ) ;
78+ let x11 = atomic_cxchg :: < _ , { AtomicOrdering :: Release } , { AtomicOrdering :: Relaxed } > (
79+ ptr_a11, 0 , 1 ,
80+ ) ;
81+ let x12 = atomic_cxchg :: < _ , { AtomicOrdering :: Release } , { AtomicOrdering :: SeqCst } > (
82+ ptr_a12, 0 , 1 ,
83+ ) ;
84+ let x13 = atomic_cxchg :: < _ , { AtomicOrdering :: SeqCst } , { AtomicOrdering :: Acquire } > (
85+ ptr_a13, 0 , 1 ,
86+ ) ;
87+ let x14 = atomic_cxchg :: < _ , { AtomicOrdering :: SeqCst } , { AtomicOrdering :: Relaxed } > (
88+ ptr_a14, 0 , 1 ,
89+ ) ;
90+ let x15 = atomic_cxchg :: < _ , { AtomicOrdering :: SeqCst } , { AtomicOrdering :: SeqCst } > (
91+ ptr_a15, 0 , 1 ,
92+ ) ;
7093
7194 assert ! ( x1 == ( 0 , true ) ) ;
7295 assert ! ( x2 == ( 0 , true ) ) ;
@@ -84,21 +107,50 @@ fn main() {
84107 assert ! ( x14 == ( 0 , true ) ) ;
85108 assert ! ( x15 == ( 0 , true ) ) ;
86109
87- let y1 = atomic_cxchg_acqrel_acquire ( ptr_a1, 1 , 1 ) ;
88- let y2 = atomic_cxchg_acqrel_relaxed ( ptr_a2, 1 , 1 ) ;
89- let y3 = atomic_cxchg_acqrel_seqcst ( ptr_a3, 1 , 1 ) ;
90- let y4 = atomic_cxchg_acquire_acquire ( ptr_a4, 1 , 1 ) ;
91- let y5 = atomic_cxchg_acquire_relaxed ( ptr_a5, 1 , 1 ) ;
92- let y6 = atomic_cxchg_acquire_seqcst ( ptr_a6, 1 , 1 ) ;
93- let y7 = atomic_cxchg_relaxed_acquire ( ptr_a7, 1 , 1 ) ;
94- let y8 = atomic_cxchg_relaxed_relaxed ( ptr_a8, 1 , 1 ) ;
95- let y9 = atomic_cxchg_relaxed_seqcst ( ptr_a9, 1 , 1 ) ;
96- let y10 = atomic_cxchg_release_acquire ( ptr_a10, 1 , 1 ) ;
97- let y11 = atomic_cxchg_release_relaxed ( ptr_a11, 1 , 1 ) ;
98- let y12 = atomic_cxchg_release_seqcst ( ptr_a12, 1 , 1 ) ;
99- let y13 = atomic_cxchg_seqcst_acquire ( ptr_a13, 1 , 1 ) ;
100- let y14 = atomic_cxchg_seqcst_relaxed ( ptr_a14, 1 , 1 ) ;
101- let y15 = atomic_cxchg_seqcst_seqcst ( ptr_a15, 1 , 1 ) ;
110+ let y1 = atomic_cxchg :: < _ , { AtomicOrdering :: AcqRel } , { AtomicOrdering :: Acquire } > (
111+ ptr_a1, 1 , 1 ,
112+ ) ;
113+ let y2 = atomic_cxchg :: < _ , { AtomicOrdering :: AcqRel } , { AtomicOrdering :: Relaxed } > (
114+ ptr_a2, 1 , 1 ,
115+ ) ;
116+ let y3 =
117+ atomic_cxchg :: < _ , { AtomicOrdering :: AcqRel } , { AtomicOrdering :: SeqCst } > ( ptr_a3, 1 , 1 ) ;
118+ let y4 = atomic_cxchg :: < _ , { AtomicOrdering :: Acquire } , { AtomicOrdering :: Acquire } > (
119+ ptr_a4, 1 , 1 ,
120+ ) ;
121+ let y5 = atomic_cxchg :: < _ , { AtomicOrdering :: Acquire } , { AtomicOrdering :: Relaxed } > (
122+ ptr_a5, 1 , 1 ,
123+ ) ;
124+ let y6 = atomic_cxchg :: < _ , { AtomicOrdering :: Acquire } , { AtomicOrdering :: SeqCst } > (
125+ ptr_a6, 1 , 1 ,
126+ ) ;
127+ let y7 = atomic_cxchg :: < _ , { AtomicOrdering :: Relaxed } , { AtomicOrdering :: Acquire } > (
128+ ptr_a7, 1 , 1 ,
129+ ) ;
130+ let y8 = atomic_cxchg :: < _ , { AtomicOrdering :: Relaxed } , { AtomicOrdering :: Relaxed } > (
131+ ptr_a8, 1 , 1 ,
132+ ) ;
133+ let y9 = atomic_cxchg :: < _ , { AtomicOrdering :: Relaxed } , { AtomicOrdering :: SeqCst } > (
134+ ptr_a9, 1 , 1 ,
135+ ) ;
136+ let y10 = atomic_cxchg :: < _ , { AtomicOrdering :: Release } , { AtomicOrdering :: Acquire } > (
137+ ptr_a10, 1 , 1 ,
138+ ) ;
139+ let y11 = atomic_cxchg :: < _ , { AtomicOrdering :: Release } , { AtomicOrdering :: Relaxed } > (
140+ ptr_a11, 1 , 1 ,
141+ ) ;
142+ let y12 = atomic_cxchg :: < _ , { AtomicOrdering :: Release } , { AtomicOrdering :: SeqCst } > (
143+ ptr_a12, 1 , 1 ,
144+ ) ;
145+ let y13 = atomic_cxchg :: < _ , { AtomicOrdering :: SeqCst } , { AtomicOrdering :: Acquire } > (
146+ ptr_a13, 1 , 1 ,
147+ ) ;
148+ let y14 = atomic_cxchg :: < _ , { AtomicOrdering :: SeqCst } , { AtomicOrdering :: Relaxed } > (
149+ ptr_a14, 1 , 1 ,
150+ ) ;
151+ let y15 = atomic_cxchg :: < _ , { AtomicOrdering :: SeqCst } , { AtomicOrdering :: SeqCst } > (
152+ ptr_a15, 1 , 1 ,
153+ ) ;
102154
103155 assert ! ( y1 == ( 1 , true ) ) ;
104156 assert ! ( y2 == ( 1 , true ) ) ;
0 commit comments