@@ -52,30 +52,6 @@ pub unsafe fn cmpxchg16b(
5252
5353 debug_assert ! ( dst as usize % 16 == 0 ) ;
5454
55- // Copied from `atomic_compare_exchange` in `core`.
56- // https://github.com/rust-lang/rust/blob/f8a2e49/library/core/src/sync/atomic.rs#L3046-L3079
57- let ( val, _ok) = match ( success, failure) {
58- ( Relaxed , Relaxed ) => intrinsics:: atomic_cxchg_relaxed_relaxed ( dst, old, new) ,
59- ( Relaxed , Acquire ) => intrinsics:: atomic_cxchg_relaxed_acquire ( dst, old, new) ,
60- ( Relaxed , SeqCst ) => intrinsics:: atomic_cxchg_relaxed_seqcst ( dst, old, new) ,
61- ( Acquire , Relaxed ) => intrinsics:: atomic_cxchg_acquire_relaxed ( dst, old, new) ,
62- ( Acquire , Acquire ) => intrinsics:: atomic_cxchg_acquire_acquire ( dst, old, new) ,
63- ( Acquire , SeqCst ) => intrinsics:: atomic_cxchg_acquire_seqcst ( dst, old, new) ,
64- ( Release , Relaxed ) => intrinsics:: atomic_cxchg_release_relaxed ( dst, old, new) ,
65- ( Release , Acquire ) => intrinsics:: atomic_cxchg_release_acquire ( dst, old, new) ,
66- ( Release , SeqCst ) => intrinsics:: atomic_cxchg_release_seqcst ( dst, old, new) ,
67- ( AcqRel , Relaxed ) => intrinsics:: atomic_cxchg_acqrel_relaxed ( dst, old, new) ,
68- ( AcqRel , Acquire ) => intrinsics:: atomic_cxchg_acqrel_acquire ( dst, old, new) ,
69- ( AcqRel , SeqCst ) => intrinsics:: atomic_cxchg_acqrel_seqcst ( dst, old, new) ,
70- ( SeqCst , Relaxed ) => intrinsics:: atomic_cxchg_seqcst_relaxed ( dst, old, new) ,
71- ( SeqCst , Acquire ) => intrinsics:: atomic_cxchg_seqcst_acquire ( dst, old, new) ,
72- ( SeqCst , SeqCst ) => intrinsics:: atomic_cxchg_seqcst_seqcst ( dst, old, new) ,
73- ( _, AcqRel ) => panic ! ( "there is no such thing as an acquire-release failure ordering" ) ,
74- ( _, Release ) => panic ! ( "there is no such thing as a release failure ordering" ) ,
75-
76- // `atomic::Ordering` is non_exhaustive. It warns when `core_arch` is built as a part of `core`.
77- #[ allow( unreachable_patterns) ]
78- ( _, _) => unreachable ! ( ) ,
79- } ;
80- val
55+ let res = crate :: sync:: atomic:: atomic_compare_exchange ( dst, old, new, success, failure) ;
56+ res. unwrap_or_else ( |x| x)
8157}
0 commit comments