Skip to content

Commit c361394

Browse files
adpaco-awstedinski
authored andcommitted
Audit: Atomic intrinsics (rust-lang#850)
* Moved atomic intrinsics tests, added description * Add support for `atomic_nand*` * Support for `atomic_singlethreadfence` and variants * Add missing test for `atomic_cxchgweak` * Add negative tests for min & max atomics * Update doc with missing intrinsics
1 parent a55d94c commit c361394

File tree

47 files changed

+710
-28
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+710
-28
lines changed

cprover_bindings/src/goto_program/expr.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ pub enum BinaryOperand {
160160
Ashr,
161161
Bitand,
162162
Bitor,
163+
Bitnand,
163164
Bitxor,
164165
Div,
165166
Equal,
@@ -837,6 +838,8 @@ impl Expr {
837838
Bitand | Bitor | Bitxor => {
838839
lhs.typ == rhs.typ && (lhs.typ.is_integer() || lhs.typ.is_vector())
839840
}
841+
// Bitwise ops (no vector support)
842+
Bitnand => lhs.typ == rhs.typ && lhs.typ.is_integer(),
840843
// Comparisons
841844
Ge | Gt | Le | Lt => {
842845
lhs.typ == rhs.typ
@@ -881,7 +884,7 @@ impl Expr {
881884
// Boolean ops
882885
And | Implies | Or | Xor => Type::bool(),
883886
// Bitwise ops
884-
Bitand | Bitor | Bitxor => lhs.typ.clone(),
887+
Bitand | Bitnand | Bitor | Bitxor => lhs.typ.clone(),
885888
// Comparisons
886889
Ge | Gt | Le | Lt => {
887890
if lhs.typ.is_vector() {
@@ -966,6 +969,11 @@ impl Expr {
966969
self.binop(Bitand, e)
967970
}
968971

972+
/// `~ (self & e)`
973+
pub fn bitnand(self, e: Expr) -> Expr {
974+
self.binop(Bitnand, e)
975+
}
976+
969977
/// `self | e`
970978
pub fn bitor(self, e: Expr) -> Expr {
971979
self.binop(Bitor, e)

cprover_bindings/src/irep/to_irep.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ impl ToIrepId for BinaryOperand {
5454
BinaryOperand::And => IrepId::And,
5555
BinaryOperand::Ashr => IrepId::Ashr,
5656
BinaryOperand::Bitand => IrepId::Bitand,
57+
BinaryOperand::Bitnand => IrepId::Bitnand,
5758
BinaryOperand::Bitor => IrepId::Bitor,
5859
BinaryOperand::Bitxor => IrepId::Bitxor,
5960
BinaryOperand::Div => IrepId::Div,

docs/src/limitations.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -245,16 +245,16 @@ atomic_load | Partial | See [Atomics](#atomics) |
245245
atomic_load_acq | Partial | See [Atomics](#atomics) |
246246
atomic_load_relaxed | Partial | See [Atomics](#atomics) |
247247
atomic_load_unordered | Partial | See [Atomics](#atomics) |
248-
atomic_max | Partial | See [Atomics](#atomics) |
249-
atomic_max_acq | Partial | See [Atomics](#atomics) |
250-
atomic_max_acqrel | Partial | See [Atomics](#atomics) |
251-
atomic_max_rel | Partial | See [Atomics](#atomics) |
252-
atomic_max_relaxed | Partial | See [Atomics](#atomics) |
253-
atomic_min | Partial | See [Atomics](#atomics) |
254-
atomic_min_acq | Partial | See [Atomics](#atomics) |
255-
atomic_min_acqrel | Partial | See [Atomics](#atomics) |
256-
atomic_min_rel | Partial | See [Atomics](#atomics) |
257-
atomic_min_relaxed | Partial | See [Atomics](#atomics) |
248+
atomic_max | No | See [Atomics](#atomics) |
249+
atomic_max_acq | No | See [Atomics](#atomics) |
250+
atomic_max_acqrel | No | See [Atomics](#atomics) |
251+
atomic_max_rel | No | See [Atomics](#atomics) |
252+
atomic_max_relaxed | No | See [Atomics](#atomics) |
253+
atomic_min | No | See [Atomics](#atomics) |
254+
atomic_min_acq | No | See [Atomics](#atomics) |
255+
atomic_min_acqrel | No | See [Atomics](#atomics) |
256+
atomic_min_rel | No | See [Atomics](#atomics) |
257+
atomic_min_relaxed | No | See [Atomics](#atomics) |
258258
atomic_nand | Partial | See [Atomics](#atomics) |
259259
atomic_nand_acq | Partial | See [Atomics](#atomics) |
260260
atomic_nand_acqrel | Partial | See [Atomics](#atomics) |
@@ -273,16 +273,16 @@ atomic_store | Partial | See [Atomics](#atomics) |
273273
atomic_store_rel | Partial | See [Atomics](#atomics) |
274274
atomic_store_relaxed | Partial | See [Atomics](#atomics) |
275275
atomic_store_unordered | Partial | See [Atomics](#atomics) |
276-
atomic_umax | Partial | See [Atomics](#atomics) |
277-
atomic_umax_acq | Partial | See [Atomics](#atomics) |
278-
atomic_umax_acqrel | Partial | See [Atomics](#atomics) |
279-
atomic_umax_rel | Partial | See [Atomics](#atomics) |
280-
atomic_umax_relaxed | Partial | See [Atomics](#atomics) |
281-
atomic_umin | Partial | See [Atomics](#atomics) |
282-
atomic_umin_acq | Partial | See [Atomics](#atomics) |
283-
atomic_umin_acqrel | Partial | See [Atomics](#atomics) |
284-
atomic_umin_rel | Partial | See [Atomics](#atomics) |
285-
atomic_umin_relaxed | Partial | See [Atomics](#atomics) |
276+
atomic_umax | No | See [Atomics](#atomics) |
277+
atomic_umax_acq | No | See [Atomics](#atomics) |
278+
atomic_umax_acqrel | No | See [Atomics](#atomics) |
279+
atomic_umax_rel | No | See [Atomics](#atomics) |
280+
atomic_umax_relaxed | No | See [Atomics](#atomics) |
281+
atomic_umin | No | See [Atomics](#atomics) |
282+
atomic_umin_acq | No | See [Atomics](#atomics) |
283+
atomic_umin_acqrel | No | See [Atomics](#atomics) |
284+
atomic_umin_rel | No | See [Atomics](#atomics) |
285+
atomic_umin_relaxed | No | See [Atomics](#atomics) |
286286
atomic_xadd | Partial | See [Atomics](#atomics) |
287287
atomic_xadd_acq | Partial | See [Atomics](#atomics) |
288288
atomic_xadd_acqrel | Partial | See [Atomics](#atomics) |

src/kani-compiler/rustc_codegen_kani/src/codegen/intrinsic.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,11 +335,20 @@ impl<'tcx> GotocCtx<'tcx> {
335335
"atomic_load_acq" => self.codegen_atomic_load(intrinsic, fargs, p, loc),
336336
"atomic_load_relaxed" => self.codegen_atomic_load(intrinsic, fargs, p, loc),
337337
"atomic_load_unordered" => self.codegen_atomic_load(intrinsic, fargs, p, loc),
338+
"atomic_nand" => codegen_atomic_binop!(bitnand),
339+
"atomic_nand_acq" => codegen_atomic_binop!(bitnand),
340+
"atomic_nand_acqrel" => codegen_atomic_binop!(bitnand),
341+
"atomic_nand_rel" => codegen_atomic_binop!(bitnand),
342+
"atomic_nand_relaxed" => codegen_atomic_binop!(bitnand),
338343
"atomic_or" => codegen_atomic_binop!(bitor),
339344
"atomic_or_acq" => codegen_atomic_binop!(bitor),
340345
"atomic_or_acqrel" => codegen_atomic_binop!(bitor),
341346
"atomic_or_rel" => codegen_atomic_binop!(bitor),
342347
"atomic_or_relaxed" => codegen_atomic_binop!(bitor),
348+
"atomic_singlethreadfence" => self.codegen_atomic_noop(intrinsic, loc),
349+
"atomic_singlethreadfence_acq" => self.codegen_atomic_noop(intrinsic, loc),
350+
"atomic_singlethreadfence_acqrel" => self.codegen_atomic_noop(intrinsic, loc),
351+
"atomic_singlethreadfence_rel" => self.codegen_atomic_noop(intrinsic, loc),
343352
"atomic_store" => self.codegen_atomic_store(intrinsic, fargs, p, loc),
344353
"atomic_store_rel" => self.codegen_atomic_store(intrinsic, fargs, p, loc),
345354
"atomic_store_relaxed" => self.codegen_atomic_store(intrinsic, fargs, p, loc),

tests/kani/Atomics/Stable/CompareExchange/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/CompareExchange/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_cxchg` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicBool, Ordering};
48

59
fn main() {
@@ -25,7 +29,7 @@ fn main() {
2529
let a8 = AtomicBool::new(true);
2630
let a9 = AtomicBool::new(true);
2731

28-
// compare_exchange is the stable version of atomic_cxchg
32+
// `compare_exchange` is the stable version of `atomic_cxchg`
2933
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#1094-1115
3034
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2410-2437
3135
// Combinations other than the ones included here result in panic

tests/kani/Atomics/Stable/Exchange/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/Exchange/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_xchg` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicBool, Ordering};
48

59
fn main() {
@@ -9,7 +13,7 @@ fn main() {
913
let a4 = AtomicBool::new(true);
1014
let a5 = AtomicBool::new(true);
1115

12-
// swap is the stable version of atomic_xchg
16+
// `swap` is the stable version of `atomic_xchg`
1317
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#435
1418
assert!(a1.swap(false, Ordering::Acquire) == true);
1519
assert!(a2.swap(false, Ordering::AcqRel) == true);

tests/kani/Atomics/Stable/Fence/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/Fence/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_fence` and other variants (stable version) can be
5+
// processed.
6+
37
use std::sync::atomic::{fence, Ordering};
48

59
fn main() {

tests/kani/Atomics/Stable/FetchAdd/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/FetchAdd/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_xadd` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicIsize, Ordering};
48

59
fn main() {
@@ -11,7 +15,7 @@ fn main() {
1115
let a4 = AtomicIsize::new(0);
1216
let a5 = AtomicIsize::new(0);
1317

14-
// fetch_add is the stable version of atomic_add
18+
// `fetch_add` is the stable version of `atomic_xadd`
1519
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#1717-1724
1620
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2379-2392
1721
assert!(a1.fetch_add(1, Ordering::Acquire) == 0);

tests/kani/Atomics/Stable/FetchAnd/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/FetchAnd/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_and` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicBool, Ordering};
48

59
fn main() {
@@ -13,7 +17,7 @@ fn main() {
1317
let a4 = AtomicBool::new(true);
1418
let a5 = AtomicBool::new(true);
1519

16-
// fetch_and is the stable version of atomic_and
20+
// `fetch_and` is the stable version of `atomic_and`
1721
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#623-629
1822
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2468-2481
1923
assert!(a1.fetch_and(false, Ordering::Acquire) == true);

tests/kani/Atomics/Stable/FetchOr/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/FetchOr/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_or` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicBool, Ordering};
48

59
fn main() {
@@ -13,7 +17,7 @@ fn main() {
1317
let a4 = AtomicBool::new(true);
1418
let a5 = AtomicBool::new(true);
1519

16-
// fetch_or is the stable version of atomic_or
20+
// `fetch_or` is the stable version of `atomic_or`
1721
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#715-721
1822
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2498-2511
1923
assert!(a1.fetch_or(false, Ordering::Acquire) == true);

tests/kani/Atomics/Stable/FetchSub/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/FetchSub/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_xsub` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicIsize, Ordering};
48

59
fn main() {
@@ -11,7 +15,7 @@ fn main() {
1115
let a4 = AtomicIsize::new(1);
1216
let a5 = AtomicIsize::new(1);
1317

14-
// fetch_sub is the stable version of atomic_sub
18+
// `fetch_sub` is the stable version of `atomic_xsub`
1519
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#1748-1755
1620
// https://doc.rust-lang.org/src/core/sync/atomic.rs.html#2395-2408
1721
assert!(a1.fetch_sub(1, Ordering::Acquire) == 1);

tests/kani/Atomics/Stable/FetchXor/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/FetchXor/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_xor` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicBool, Ordering};
48

59
fn main() {
@@ -13,7 +17,7 @@ fn main() {
1317
let a4 = AtomicBool::new(true);
1418
let a5 = AtomicBool::new(true);
1519

16-
// fetch_xor is the stable version of atomic_xor
20+
// `fetch_xor` is the stable version of `atomic_xor`
1721
assert!(a1.fetch_xor(true, Ordering::Acquire) == true);
1822
assert!(a2.fetch_xor(true, Ordering::Release) == true);
1923
assert!(a3.fetch_xor(true, Ordering::AcqRel) == true);

tests/kani/Atomics/Stable/Load/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/Load/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_load` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicBool, Ordering};
48

59
fn main() {

tests/kani/Atomics/Stable/Store/main.rs renamed to tests/kani/Intrinsics/Atomic/Stable/Store/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_store` and other variants (stable version) return the
5+
// expected result.
6+
37
use std::sync::atomic::{AtomicBool, Ordering};
48

59
fn main() {

tests/kani/Atomics/Unstable/AtomicAdd/main.rs renamed to tests/kani/Intrinsics/Atomic/Unstable/AtomicAdd/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_xsub` and other variants (unstable version) return the
5+
// expected result.
6+
37
#![feature(core_intrinsics)]
48
use std::intrinsics::{
59
atomic_xadd, atomic_xadd_acq, atomic_xadd_acqrel, atomic_xadd_rel, atomic_xadd_relaxed,

tests/kani/Atomics/Unstable/AtomicAnd/main.rs renamed to tests/kani/Intrinsics/Atomic/Unstable/AtomicAnd/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_and` and other variants (unstable version) return the
5+
// expected result.
6+
37
#![feature(core_intrinsics)]
48
use std::intrinsics::{
59
atomic_and, atomic_and_acq, atomic_and_acqrel, atomic_and_rel, atomic_and_relaxed,

tests/kani/Atomics/Unstable/AtomicCxchg/main.rs renamed to tests/kani/Intrinsics/Atomic/Unstable/AtomicCxchg/main.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_cxchg` and other variants (unstable version) return the
5+
// expected result.
6+
37
#![feature(core_intrinsics)]
48
use std::intrinsics::{
59
atomic_cxchg, atomic_cxchg_acq, atomic_cxchg_acq_failrelaxed, atomic_cxchg_acqrel,
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
// SPDX-License-Identifier: Apache-2.0 OR MIT
3+
4+
// Check that `atomic_cxchgweak` and other variants (unstable version) return
5+
// the expected result.
6+
7+
#![feature(core_intrinsics)]
8+
use std::intrinsics::{
9+
atomic_cxchgweak, atomic_cxchgweak_acq, atomic_cxchgweak_acq_failrelaxed,
10+
atomic_cxchgweak_acqrel, atomic_cxchgweak_acqrel_failrelaxed, atomic_cxchgweak_failacq,
11+
atomic_cxchgweak_failrelaxed, atomic_cxchgweak_rel, atomic_cxchgweak_relaxed,
12+
};
13+
14+
fn main() {
15+
let mut a1 = 0 as u8;
16+
let mut a2 = 0 as u8;
17+
let mut a3 = 0 as u8;
18+
let mut a4 = 0 as u8;
19+
let mut a5 = 0 as u8;
20+
let mut a6 = 0 as u8;
21+
let mut a7 = 0 as u8;
22+
let mut a8 = 0 as u8;
23+
let mut a9 = 0 as u8;
24+
25+
let ptr_a1: *mut u8 = &mut a1;
26+
let ptr_a2: *mut u8 = &mut a2;
27+
let ptr_a3: *mut u8 = &mut a3;
28+
let ptr_a4: *mut u8 = &mut a4;
29+
let ptr_a5: *mut u8 = &mut a5;
30+
let ptr_a6: *mut u8 = &mut a6;
31+
let ptr_a7: *mut u8 = &mut a7;
32+
let ptr_a8: *mut u8 = &mut a8;
33+
let ptr_a9: *mut u8 = &mut a9;
34+
35+
unsafe {
36+
// Stores a value if the current value is the same as the old value
37+
// Returns (val, ok) where
38+
// * val: the old value
39+
// * ok: bool indicating whether the operation was successful or not
40+
let x1 = atomic_cxchgweak(ptr_a1, 0, 1);
41+
let x2 = atomic_cxchgweak_acq(ptr_a2, 0, 1);
42+
let x3 = atomic_cxchgweak_acq_failrelaxed(ptr_a3, 0, 1);
43+
let x4 = atomic_cxchgweak_acqrel(ptr_a4, 0, 1);
44+
let x5 = atomic_cxchgweak_acqrel_failrelaxed(ptr_a5, 0, 1);
45+
let x6 = atomic_cxchgweak_failacq(ptr_a6, 0, 1);
46+
let x7 = atomic_cxchgweak_failrelaxed(ptr_a7, 0, 1);
47+
let x8 = atomic_cxchgweak_rel(ptr_a8, 0, 1);
48+
let x9 = atomic_cxchgweak_relaxed(ptr_a9, 0, 1);
49+
50+
assert!(x1 == (0, true));
51+
assert!(x2 == (0, true));
52+
assert!(x3 == (0, true));
53+
assert!(x4 == (0, true));
54+
assert!(x5 == (0, true));
55+
assert!(x6 == (0, true));
56+
assert!(x7 == (0, true));
57+
assert!(x8 == (0, true));
58+
assert!(x9 == (0, true));
59+
60+
let y1 = atomic_cxchgweak(ptr_a1, 1, 1);
61+
let y2 = atomic_cxchgweak_acq(ptr_a2, 1, 1);
62+
let y3 = atomic_cxchgweak_acq_failrelaxed(ptr_a3, 1, 1);
63+
let y4 = atomic_cxchgweak_acqrel(ptr_a4, 1, 1);
64+
let y5 = atomic_cxchgweak_acqrel_failrelaxed(ptr_a5, 1, 1);
65+
let y6 = atomic_cxchgweak_failacq(ptr_a6, 1, 1);
66+
let y7 = atomic_cxchgweak_failrelaxed(ptr_a7, 1, 1);
67+
let y8 = atomic_cxchgweak_rel(ptr_a8, 1, 1);
68+
let y9 = atomic_cxchgweak_relaxed(ptr_a9, 1, 1);
69+
70+
assert!(y1 == (1, true));
71+
assert!(y2 == (1, true));
72+
assert!(y3 == (1, true));
73+
assert!(y4 == (1, true));
74+
assert!(y5 == (1, true));
75+
assert!(y6 == (1, true));
76+
assert!(y7 == (1, true));
77+
assert!(y8 == (1, true));
78+
assert!(y9 == (1, true));
79+
}
80+
}

0 commit comments

Comments
 (0)