Skip to content

Commit 8764244

Browse files
taiki-eAmanieu
authored andcommitted
core_arch: Update cmpxchg16b docs and fix feature name
- Fix a typo in the feature name - Update docs to reflect changes in behavior on invalid ordering in stabilized PR: invalid ordering is no longer UB, just causes panic as well as compare_exchange
1 parent ac277c5 commit 8764244

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

crates/core_arch/src/x86_64/cmpxchg16b.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ use stdarch_test::assert_instr;
1616
///
1717
/// # Memory Orderings
1818
///
19-
/// This atomic operations has the same semantics of memory orderings as
19+
/// This atomic operation has the same semantics of memory orderings as
2020
/// `AtomicUsize::compare_exchange` does, only operating on 16 bytes of memory
2121
/// instead of just a pointer.
2222
///
23+
/// The failure ordering must be [`Ordering::SeqCst`], [`Ordering::Acquire`] or
24+
/// [`Ordering::Relaxed`].
25+
///
2326
/// For more information on memory orderings here see the `compare_exchange`
2427
/// documentation for other `Atomic*` types in the standard library.
2528
///
@@ -33,16 +36,11 @@ use stdarch_test::assert_instr;
3336
/// runtime to work correctly. If the CPU running the binary does not actually
3437
/// support `cmpxchg16b` and the program enters an execution path that
3538
/// eventually would reach this function the behavior is undefined.
36-
///
37-
/// The failure ordering must be [`Ordering::SeqCst`], [`Ordering::Acquire`] or
38-
/// [`Ordering::Relaxed`], or this function call is undefined. See the `Atomic*`
39-
/// documentation's `compare_exchange` function for more information. When
40-
/// `compare_exchange` panics, this is undefined behavior.
4139
#[inline]
4240
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
4341
#[cfg_attr(test, assert_instr(cmpxchg16b, success = Ordering::SeqCst, failure = Ordering::SeqCst))]
4442
#[target_feature(enable = "cmpxchg16b")]
45-
#[stable(feature = "cmpxchg16b_instrinsic", since = "1.67.0")]
43+
#[stable(feature = "cmpxchg16b_intrinsic", since = "1.67.0")]
4644
pub unsafe fn cmpxchg16b(
4745
dst: *mut u128,
4846
old: u128,

0 commit comments

Comments
 (0)