mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-30 22:12:15 +00:00
Rollup merge of #97423 - m-ou-se:memory-ordering-intrinsics, r=tmiasko
Simplify memory ordering intrinsics This changes the names of the atomic intrinsics to always fully include their memory ordering arguments. ```diff - atomic_cxchg + atomic_cxchg_seqcst_seqcst - atomic_cxchg_acqrel + atomic_cxchg_acqrel_release - atomic_cxchg_acqrel_failrelaxed + atomic_cxchg_acqrel_relaxed // And so on. ``` - `seqcst` is no longer implied - The failure ordering on chxchg is no longer implied in some cases, but now always explicitly part of the name. - `release` is no longer shortened to just `rel`. That was especially confusing, since `relaxed` also starts with `rel`. - `acquire` is no longer shortened to just `acq`, such that the names now all match the `std::sync::atomic::Ordering` variants exactly. - This now allows for more combinations on the compare exchange operations, such as `atomic_cxchg_acquire_release`, which is necessary for #68464. - This PR only exposes the new possibilities through unstable intrinsics, but not yet through the stable API. That's for [a separate PR](https://github.com/rust-lang/rust/pull/98383) that requires an FCP. Suffixes for operations with a single memory order: | Order | Before | After | |---------|--------------|------------| | Relaxed | `_relaxed` | `_relaxed` | | Acquire | `_acq` | `_acquire` | | Release | `_rel` | `_release` | | AcqRel | `_acqrel` | `_acqrel` | | SeqCst | (none) | `_seqcst` | Suffixes for compare-and-exchange operations with two memory orderings: | Success | Failure | Before | After | |---------|---------|--------------------------|--------------------| | Relaxed | Relaxed | `_relaxed` | `_relaxed_relaxed` | | Relaxed | Acquire | ❌ | `_relaxed_acquire` | | Relaxed | SeqCst | ❌ | `_relaxed_seqcst` | | Acquire | Relaxed | `_acq_failrelaxed` | `_acquire_relaxed` | | Acquire | Acquire | `_acq` | `_acquire_acquire` | | Acquire | SeqCst | ❌ | `_acquire_seqcst` | | Release | Relaxed | `_rel` | `_release_relaxed` | | Release | Acquire | ❌ | `_release_acquire` | | Release | SeqCst | ❌ | `_release_seqcst` | | AcqRel | Relaxed | `_acqrel_failrelaxed` | `_acqrel_relaxed` | | AcqRel | Acquire | `_acqrel` | `_acqrel_acquire` | | AcqRel | SeqCst | ❌ | `_acqrel_seqcst` | | SeqCst | Relaxed | `_failrelaxed` | `_seqcst_relaxed` | | SeqCst | Acquire | `_failacq` | `_seqcst_acquire` | | SeqCst | SeqCst | (none) | `_seqcst_seqcst` |
This commit is contained in:
commit
45740acd34
@ -6,6 +6,7 @@
|
||||
#![feature(associated_type_bounds)]
|
||||
#![feature(strict_provenance)]
|
||||
#![feature(int_roundings)]
|
||||
#![feature(if_let_guard)]
|
||||
#![recursion_limit = "256"]
|
||||
#![allow(rustc::potential_query_instability)]
|
||||
|
||||
|
@ -376,32 +376,23 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
}
|
||||
|
||||
// This requires that atomic intrinsics follow a specific naming pattern:
|
||||
// "atomic_<operation>[_<ordering>]", and no ordering means SeqCst
|
||||
name if name_str.starts_with("atomic_") => {
|
||||
// "atomic_<operation>[_<ordering>]"
|
||||
name if let Some(atomic) = name_str.strip_prefix("atomic_") => {
|
||||
use crate::common::AtomicOrdering::*;
|
||||
use crate::common::{AtomicRmwBinOp, SynchronizationScope};
|
||||
|
||||
let split: Vec<_> = name_str.split('_').collect();
|
||||
let Some((instruction, ordering)) = atomic.split_once('_') else {
|
||||
bx.sess().fatal("Atomic intrinsic missing memory ordering");
|
||||
};
|
||||
|
||||
let is_cxchg = split[1] == "cxchg" || split[1] == "cxchgweak";
|
||||
let (order, failorder) = match split.len() {
|
||||
2 => (SequentiallyConsistent, SequentiallyConsistent),
|
||||
3 => match split[2] {
|
||||
"unordered" => (Unordered, Unordered),
|
||||
"relaxed" => (Relaxed, Relaxed),
|
||||
"acq" => (Acquire, Acquire),
|
||||
"rel" => (Release, Relaxed),
|
||||
"acqrel" => (AcquireRelease, Acquire),
|
||||
"failrelaxed" if is_cxchg => (SequentiallyConsistent, Relaxed),
|
||||
"failacq" if is_cxchg => (SequentiallyConsistent, Acquire),
|
||||
_ => bx.sess().fatal("unknown ordering in atomic intrinsic"),
|
||||
},
|
||||
4 => match (split[2], split[3]) {
|
||||
("acq", "failrelaxed") if is_cxchg => (Acquire, Relaxed),
|
||||
("acqrel", "failrelaxed") if is_cxchg => (AcquireRelease, Relaxed),
|
||||
_ => bx.sess().fatal("unknown ordering in atomic intrinsic"),
|
||||
},
|
||||
_ => bx.sess().fatal("Atomic intrinsic not in correct format"),
|
||||
let parse_ordering = |bx: &Bx, s| match s {
|
||||
"unordered" => Unordered,
|
||||
"relaxed" => Relaxed,
|
||||
"acquire" => Acquire,
|
||||
"release" => Release,
|
||||
"acqrel" => AcquireRelease,
|
||||
"seqcst" => SequentiallyConsistent,
|
||||
_ => bx.sess().fatal("unknown ordering in atomic intrinsic"),
|
||||
};
|
||||
|
||||
let invalid_monomorphization = |ty| {
|
||||
@ -416,11 +407,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
);
|
||||
};
|
||||
|
||||
match split[1] {
|
||||
match instruction {
|
||||
"cxchg" | "cxchgweak" => {
|
||||
let Some((success, failure)) = ordering.split_once('_') else {
|
||||
bx.sess().fatal("Atomic compare-exchange intrinsic missing failure memory ordering");
|
||||
};
|
||||
let ty = substs.type_at(0);
|
||||
if int_type_width_signed(ty, bx.tcx()).is_some() || ty.is_unsafe_ptr() {
|
||||
let weak = split[1] == "cxchgweak";
|
||||
let weak = instruction == "cxchgweak";
|
||||
let mut dst = args[0].immediate();
|
||||
let mut cmp = args[1].immediate();
|
||||
let mut src = args[2].immediate();
|
||||
@ -432,7 +426,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
cmp = bx.ptrtoint(cmp, bx.type_isize());
|
||||
src = bx.ptrtoint(src, bx.type_isize());
|
||||
}
|
||||
let pair = bx.atomic_cmpxchg(dst, cmp, src, order, failorder, weak);
|
||||
let pair = bx.atomic_cmpxchg(dst, cmp, src, parse_ordering(bx, success), parse_ordering(bx, failure), weak);
|
||||
let val = bx.extract_value(pair, 0);
|
||||
let success = bx.extract_value(pair, 1);
|
||||
let val = bx.from_immediate(val);
|
||||
@ -460,11 +454,11 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
let llty = bx.type_isize();
|
||||
let ptr_llty = bx.type_ptr_to(llty);
|
||||
source = bx.pointercast(source, ptr_llty);
|
||||
let result = bx.atomic_load(llty, source, order, size);
|
||||
let result = bx.atomic_load(llty, source, parse_ordering(bx, ordering), size);
|
||||
// ... and then cast the result back to a pointer
|
||||
bx.inttoptr(result, bx.backend_type(layout))
|
||||
} else {
|
||||
bx.atomic_load(bx.backend_type(layout), source, order, size)
|
||||
bx.atomic_load(bx.backend_type(layout), source, parse_ordering(bx, ordering), size)
|
||||
}
|
||||
} else {
|
||||
return invalid_monomorphization(ty);
|
||||
@ -484,7 +478,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
ptr = bx.pointercast(ptr, ptr_llty);
|
||||
val = bx.ptrtoint(val, bx.type_isize());
|
||||
}
|
||||
bx.atomic_store(val, ptr, order, size);
|
||||
bx.atomic_store(val, ptr, parse_ordering(bx, ordering), size);
|
||||
return;
|
||||
} else {
|
||||
return invalid_monomorphization(ty);
|
||||
@ -492,12 +486,12 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
}
|
||||
|
||||
"fence" => {
|
||||
bx.atomic_fence(order, SynchronizationScope::CrossThread);
|
||||
bx.atomic_fence(parse_ordering(bx, ordering), SynchronizationScope::CrossThread);
|
||||
return;
|
||||
}
|
||||
|
||||
"singlethreadfence" => {
|
||||
bx.atomic_fence(order, SynchronizationScope::SingleThread);
|
||||
bx.atomic_fence(parse_ordering(bx, ordering), SynchronizationScope::SingleThread);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -531,7 +525,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
|
||||
ptr = bx.pointercast(ptr, ptr_llty);
|
||||
val = bx.ptrtoint(val, bx.type_isize());
|
||||
}
|
||||
bx.atomic_rmw(atom_op, ptr, val, order)
|
||||
bx.atomic_rmw(atom_op, ptr, val, parse_ordering(bx, ordering))
|
||||
} else {
|
||||
return invalid_monomorphization(ty);
|
||||
}
|
||||
|
@ -24,12 +24,12 @@ functions are defined in `compiler/rustc_codegen_llvm/src/intrinsic.rs` and in
|
||||
#![feature(intrinsics)]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn atomic_fence(); // ok!
|
||||
fn atomic_fence_seqcst(); // ok!
|
||||
}
|
||||
|
||||
fn main() {
|
||||
unsafe {
|
||||
atomic_fence();
|
||||
atomic_fence_seqcst();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
@ -70,6 +70,214 @@ pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {
|
||||
unsafe { crate::ptr::drop_in_place(to_drop) }
|
||||
}
|
||||
|
||||
// These have been renamed.
|
||||
#[cfg(bootstrap)]
|
||||
extern "rust-intrinsic" {
|
||||
pub fn atomic_cxchg<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_acq<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_rel<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_acqrel<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_failacq<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_acq_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_acqrel_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_acq<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_rel<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_acqrel<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_failacq<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_acq_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_acqrel_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_load<T: Copy>(src: *const T) -> T;
|
||||
pub fn atomic_load_acq<T: Copy>(src: *const T) -> T;
|
||||
pub fn atomic_load_relaxed<T: Copy>(src: *const T) -> T;
|
||||
pub fn atomic_load_unordered<T: Copy>(src: *const T) -> T;
|
||||
pub fn atomic_store<T: Copy>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_rel<T: Copy>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_relaxed<T: Copy>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_unordered<T: Copy>(dst: *mut T, val: T);
|
||||
pub fn atomic_xchg<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_and<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_and_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_and_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_and_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_and_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_nand<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_nand_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_nand_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_nand_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_nand_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_or<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_or_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_or_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_or_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_or_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xor<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xor_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xor_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xor_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xor_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_max<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_max_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_max_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_max_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_max_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_min<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_min_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_min_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_min_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_min_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umin<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umin_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umin_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umin_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umin_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umax<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umax_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umax_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umax_acqrel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umax_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_fence();
|
||||
pub fn atomic_fence_acq();
|
||||
pub fn atomic_fence_rel();
|
||||
pub fn atomic_fence_acqrel();
|
||||
pub fn atomic_singlethreadfence();
|
||||
pub fn atomic_singlethreadfence_acq();
|
||||
pub fn atomic_singlethreadfence_rel();
|
||||
pub fn atomic_singlethreadfence_acqrel();
|
||||
}
|
||||
|
||||
// These have been renamed.
|
||||
#[cfg(bootstrap)]
|
||||
mod atomics {
|
||||
pub use super::atomic_cxchg as atomic_cxchg_seqcst_seqcst;
|
||||
pub use super::atomic_cxchg_acq as atomic_cxchg_acquire_acquire;
|
||||
pub use super::atomic_cxchg_acq_failrelaxed as atomic_cxchg_acquire_relaxed;
|
||||
pub use super::atomic_cxchg_acqrel as atomic_cxchg_acqrel_acquire;
|
||||
pub use super::atomic_cxchg_acqrel_failrelaxed as atomic_cxchg_acqrel_relaxed;
|
||||
pub use super::atomic_cxchg_failacq as atomic_cxchg_seqcst_acquire;
|
||||
pub use super::atomic_cxchg_failrelaxed as atomic_cxchg_seqcst_relaxed;
|
||||
pub use super::atomic_cxchg_rel as atomic_cxchg_release_relaxed;
|
||||
pub use super::atomic_cxchg_relaxed as atomic_cxchg_relaxed_relaxed;
|
||||
|
||||
pub use super::atomic_cxchgweak as atomic_cxchgweak_seqcst_seqcst;
|
||||
pub use super::atomic_cxchgweak_acq as atomic_cxchgweak_acquire_acquire;
|
||||
pub use super::atomic_cxchgweak_acq_failrelaxed as atomic_cxchgweak_acquire_relaxed;
|
||||
pub use super::atomic_cxchgweak_acqrel as atomic_cxchgweak_acqrel_acquire;
|
||||
pub use super::atomic_cxchgweak_acqrel_failrelaxed as atomic_cxchgweak_acqrel_relaxed;
|
||||
pub use super::atomic_cxchgweak_failacq as atomic_cxchgweak_seqcst_acquire;
|
||||
pub use super::atomic_cxchgweak_failrelaxed as atomic_cxchgweak_seqcst_relaxed;
|
||||
pub use super::atomic_cxchgweak_rel as atomic_cxchgweak_release_relaxed;
|
||||
pub use super::atomic_cxchgweak_relaxed as atomic_cxchgweak_relaxed_relaxed;
|
||||
|
||||
pub use super::atomic_load as atomic_load_seqcst;
|
||||
pub use super::atomic_load_acq as atomic_load_acquire;
|
||||
pub use super::atomic_load_relaxed;
|
||||
pub use super::atomic_load_unordered;
|
||||
|
||||
pub use super::atomic_store as atomic_store_seqcst;
|
||||
pub use super::atomic_store_rel as atomic_store_release;
|
||||
pub use super::atomic_store_relaxed;
|
||||
pub use super::atomic_store_unordered;
|
||||
|
||||
pub use super::atomic_xchg as atomic_xchg_seqcst;
|
||||
pub use super::atomic_xchg_acq as atomic_xchg_acquire;
|
||||
pub use super::atomic_xchg_acqrel;
|
||||
pub use super::atomic_xchg_rel as atomic_xchg_release;
|
||||
pub use super::atomic_xchg_relaxed;
|
||||
|
||||
pub use super::atomic_xadd as atomic_xadd_seqcst;
|
||||
pub use super::atomic_xadd_acq as atomic_xadd_acquire;
|
||||
pub use super::atomic_xadd_acqrel;
|
||||
pub use super::atomic_xadd_rel as atomic_xadd_release;
|
||||
pub use super::atomic_xadd_relaxed;
|
||||
|
||||
pub use super::atomic_xsub as atomic_xsub_seqcst;
|
||||
pub use super::atomic_xsub_acq as atomic_xsub_acquire;
|
||||
pub use super::atomic_xsub_acqrel;
|
||||
pub use super::atomic_xsub_rel as atomic_xsub_release;
|
||||
pub use super::atomic_xsub_relaxed;
|
||||
|
||||
pub use super::atomic_and as atomic_and_seqcst;
|
||||
pub use super::atomic_and_acq as atomic_and_acquire;
|
||||
pub use super::atomic_and_acqrel;
|
||||
pub use super::atomic_and_rel as atomic_and_release;
|
||||
pub use super::atomic_and_relaxed;
|
||||
|
||||
pub use super::atomic_nand as atomic_nand_seqcst;
|
||||
pub use super::atomic_nand_acq as atomic_nand_acquire;
|
||||
pub use super::atomic_nand_acqrel;
|
||||
pub use super::atomic_nand_rel as atomic_nand_release;
|
||||
pub use super::atomic_nand_relaxed;
|
||||
|
||||
pub use super::atomic_or as atomic_or_seqcst;
|
||||
pub use super::atomic_or_acq as atomic_or_acquire;
|
||||
pub use super::atomic_or_acqrel;
|
||||
pub use super::atomic_or_rel as atomic_or_release;
|
||||
pub use super::atomic_or_relaxed;
|
||||
|
||||
pub use super::atomic_xor as atomic_xor_seqcst;
|
||||
pub use super::atomic_xor_acq as atomic_xor_acquire;
|
||||
pub use super::atomic_xor_acqrel;
|
||||
pub use super::atomic_xor_rel as atomic_xor_release;
|
||||
pub use super::atomic_xor_relaxed;
|
||||
|
||||
pub use super::atomic_max as atomic_max_seqcst;
|
||||
pub use super::atomic_max_acq as atomic_max_acquire;
|
||||
pub use super::atomic_max_acqrel;
|
||||
pub use super::atomic_max_rel as atomic_max_release;
|
||||
pub use super::atomic_max_relaxed;
|
||||
|
||||
pub use super::atomic_min as atomic_min_seqcst;
|
||||
pub use super::atomic_min_acq as atomic_min_acquire;
|
||||
pub use super::atomic_min_acqrel;
|
||||
pub use super::atomic_min_rel as atomic_min_release;
|
||||
pub use super::atomic_min_relaxed;
|
||||
|
||||
pub use super::atomic_umin as atomic_umin_seqcst;
|
||||
pub use super::atomic_umin_acq as atomic_umin_acquire;
|
||||
pub use super::atomic_umin_acqrel;
|
||||
pub use super::atomic_umin_rel as atomic_umin_release;
|
||||
pub use super::atomic_umin_relaxed;
|
||||
|
||||
pub use super::atomic_umax as atomic_umax_seqcst;
|
||||
pub use super::atomic_umax_acq as atomic_umax_acquire;
|
||||
pub use super::atomic_umax_acqrel;
|
||||
pub use super::atomic_umax_rel as atomic_umax_release;
|
||||
pub use super::atomic_umax_relaxed;
|
||||
|
||||
pub use super::atomic_fence as atomic_fence_seqcst;
|
||||
pub use super::atomic_fence_acq as atomic_fence_acquire;
|
||||
pub use super::atomic_fence_acqrel;
|
||||
pub use super::atomic_fence_rel as atomic_fence_release;
|
||||
|
||||
pub use super::atomic_singlethreadfence as atomic_singlethreadfence_seqcst;
|
||||
pub use super::atomic_singlethreadfence_acq as atomic_singlethreadfence_acquire;
|
||||
pub use super::atomic_singlethreadfence_acqrel;
|
||||
pub use super::atomic_singlethreadfence_rel as atomic_singlethreadfence_release;
|
||||
}
|
||||
|
||||
#[cfg(bootstrap)]
|
||||
pub use atomics::*;
|
||||
|
||||
#[cfg(not(bootstrap))]
|
||||
extern "rust-intrinsic" {
|
||||
// N.B., these intrinsics take raw pointers because they mutate aliased
|
||||
// memory, which is not valid for either `&` or `&mut`.
|
||||
@ -78,142 +286,226 @@ extern "rust-intrinsic" {
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::SeqCst`] as both the `success` and `failure` parameters.
|
||||
/// [`Ordering::Relaxed`] as both the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_relaxed_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::Acquire`] as both the `success` and `failure` parameters.
|
||||
/// [`Ordering::Relaxed`] and [`Ordering::Acquire`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acq<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_relaxed_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::Release`] as the `success` and [`Ordering::Relaxed`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_rel<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::AcqRel`] as the `success` and [`Ordering::Acquire`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acqrel<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::Relaxed`] as both the `success` and `failure` parameters.
|
||||
/// [`Ordering::Relaxed`] and [`Ordering::SeqCst`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_relaxed_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `success` and [`Ordering::Relaxed`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// [`Ordering::Acquire`] and [`Ordering::Relaxed`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acquire_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `success` and [`Ordering::Acquire`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_failacq<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// [`Ordering::Acquire`] as both the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acquire_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::Acquire`] as the `success` and [`Ordering::Relaxed`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acq_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// [`Ordering::Acquire`] and [`Ordering::SeqCst`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acquire_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::AcqRel`] as the `success` and [`Ordering::Relaxed`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acqrel_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// [`Ordering::Release`] and [`Ordering::Relaxed`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_release_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::Release`] and [`Ordering::Acquire`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_release_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::Release`] and [`Ordering::SeqCst`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_release_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::AcqRel`] and [`Ordering::Relaxed`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acqrel_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::AcqRel`] and [`Ordering::Acquire`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acqrel_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::AcqRel`] and [`Ordering::SeqCst`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_acqrel_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::SeqCst`] and [`Ordering::Relaxed`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_seqcst_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::SeqCst`] and [`Ordering::Acquire`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_seqcst_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange` method by passing
|
||||
/// [`Ordering::SeqCst`] as both the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange`].
|
||||
pub fn atomic_cxchg_seqcst_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::SeqCst`] as both the `success` and `failure` parameters.
|
||||
/// [`Ordering::Relaxed`] as both the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_relaxed_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::Acquire`] as both the `success` and `failure` parameters.
|
||||
/// [`Ordering::Relaxed`] and [`Ordering::Acquire`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acq<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_relaxed_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::Release`] as the `success` and [`Ordering::Relaxed`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_rel<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::AcqRel`] as the `success` and [`Ordering::Acquire`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acqrel<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::Relaxed`] as both the `success` and `failure` parameters.
|
||||
/// [`Ordering::Relaxed`] and [`Ordering::SeqCst`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_relaxed_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `success` and [`Ordering::Relaxed`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// [`Ordering::Acquire`] and [`Ordering::Relaxed`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acquire_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `success` and [`Ordering::Acquire`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_failacq<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// [`Ordering::Acquire`] as both the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acquire_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::Acquire`] as the `success` and [`Ordering::Relaxed`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acq_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// [`Ordering::Acquire`] and [`Ordering::SeqCst`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acquire_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::AcqRel`] as the `success` and [`Ordering::Relaxed`] as the
|
||||
/// `failure` parameters. For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acqrel_failrelaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// [`Ordering::Release`] and [`Ordering::Relaxed`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_release_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::Release`] and [`Ordering::Acquire`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_release_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::Release`] and [`Ordering::SeqCst`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_release_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::AcqRel`] and [`Ordering::Relaxed`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acqrel_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::AcqRel`] and [`Ordering::Acquire`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acqrel_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::AcqRel`] and [`Ordering::SeqCst`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_acqrel_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::SeqCst`] and [`Ordering::Relaxed`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_seqcst_relaxed<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::SeqCst`] and [`Ordering::Acquire`] as the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_seqcst_acquire<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
/// Stores a value if the current value is the same as the `old` value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `compare_exchange_weak` method by passing
|
||||
/// [`Ordering::SeqCst`] as both the success and failure parameters.
|
||||
/// For example, [`AtomicBool::compare_exchange_weak`].
|
||||
pub fn atomic_cxchgweak_seqcst_seqcst<T: Copy>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
|
||||
/// Loads the current value of the pointer.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `load` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicBool::load`].
|
||||
pub fn atomic_load<T: Copy>(src: *const T) -> T;
|
||||
pub fn atomic_load_seqcst<T: Copy>(src: *const T) -> T;
|
||||
/// Loads the current value of the pointer.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `load` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicBool::load`].
|
||||
pub fn atomic_load_acq<T: Copy>(src: *const T) -> T;
|
||||
pub fn atomic_load_acquire<T: Copy>(src: *const T) -> T;
|
||||
/// Loads the current value of the pointer.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -227,13 +519,13 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `store` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicBool::store`].
|
||||
pub fn atomic_store<T: Copy>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_seqcst<T: Copy>(dst: *mut T, val: T);
|
||||
/// Stores the value at the specified memory location.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `store` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicBool::store`].
|
||||
pub fn atomic_store_rel<T: Copy>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_release<T: Copy>(dst: *mut T, val: T);
|
||||
/// Stores the value at the specified memory location.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -247,19 +539,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `swap` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicBool::swap`].
|
||||
pub fn atomic_xchg<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Stores the value at the specified memory location, returning the old value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `swap` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicBool::swap`].
|
||||
pub fn atomic_xchg_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Stores the value at the specified memory location, returning the old value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `swap` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicBool::swap`].
|
||||
pub fn atomic_xchg_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Stores the value at the specified memory location, returning the old value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -278,19 +570,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_add` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicIsize::fetch_add`].
|
||||
pub fn atomic_xadd<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Adds to the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_add` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicIsize::fetch_add`].
|
||||
pub fn atomic_xadd_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Adds to the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_add` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicIsize::fetch_add`].
|
||||
pub fn atomic_xadd_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Adds to the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -309,19 +601,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_sub` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicIsize::fetch_sub`].
|
||||
pub fn atomic_xsub<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Subtract from the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_sub` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicIsize::fetch_sub`].
|
||||
pub fn atomic_xsub_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Subtract from the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_sub` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicIsize::fetch_sub`].
|
||||
pub fn atomic_xsub_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Subtract from the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -340,19 +632,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_and` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicBool::fetch_and`].
|
||||
pub fn atomic_and<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_and_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise and with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_and` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicBool::fetch_and`].
|
||||
pub fn atomic_and_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_and_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise and with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_and` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicBool::fetch_and`].
|
||||
pub fn atomic_and_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_and_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise and with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -371,19 +663,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`AtomicBool`] type via the `fetch_nand` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicBool::fetch_nand`].
|
||||
pub fn atomic_nand<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_nand_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise nand with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`AtomicBool`] type via the `fetch_nand` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicBool::fetch_nand`].
|
||||
pub fn atomic_nand_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_nand_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise nand with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`AtomicBool`] type via the `fetch_nand` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicBool::fetch_nand`].
|
||||
pub fn atomic_nand_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_nand_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise nand with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -402,19 +694,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_or` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicBool::fetch_or`].
|
||||
pub fn atomic_or<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_or_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise or with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_or` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicBool::fetch_or`].
|
||||
pub fn atomic_or_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_or_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise or with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_or` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicBool::fetch_or`].
|
||||
pub fn atomic_or_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_or_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise or with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -433,19 +725,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_xor` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicBool::fetch_xor`].
|
||||
pub fn atomic_xor<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xor_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise xor with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_xor` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicBool::fetch_xor`].
|
||||
pub fn atomic_xor_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xor_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise xor with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] types via the `fetch_xor` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicBool::fetch_xor`].
|
||||
pub fn atomic_xor_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xor_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Bitwise xor with the current value, returning the previous value.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -464,19 +756,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] signed integer types via the `fetch_max` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicI32::fetch_max`].
|
||||
pub fn atomic_max<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_max_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Maximum with the current value using a signed comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] signed integer types via the `fetch_max` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicI32::fetch_max`].
|
||||
pub fn atomic_max_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_max_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Maximum with the current value using a signed comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] signed integer types via the `fetch_max` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicI32::fetch_max`].
|
||||
pub fn atomic_max_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_max_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Maximum with the current value using a signed comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -495,19 +787,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] signed integer types via the `fetch_min` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicI32::fetch_min`].
|
||||
pub fn atomic_min<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_min_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Minimum with the current value using a signed comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] signed integer types via the `fetch_min` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicI32::fetch_min`].
|
||||
pub fn atomic_min_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_min_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Minimum with the current value using a signed comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] signed integer types via the `fetch_min` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicI32::fetch_min`].
|
||||
pub fn atomic_min_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_min_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Minimum with the current value using a signed comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -526,19 +818,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] unsigned integer types via the `fetch_min` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicU32::fetch_min`].
|
||||
pub fn atomic_umin<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umin_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Minimum with the current value using an unsigned comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] unsigned integer types via the `fetch_min` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicU32::fetch_min`].
|
||||
pub fn atomic_umin_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umin_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Minimum with the current value using an unsigned comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] unsigned integer types via the `fetch_min` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicU32::fetch_min`].
|
||||
pub fn atomic_umin_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umin_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Minimum with the current value using an unsigned comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -557,19 +849,19 @@ extern "rust-intrinsic" {
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] unsigned integer types via the `fetch_max` method by passing
|
||||
/// [`Ordering::SeqCst`] as the `order`. For example, [`AtomicU32::fetch_max`].
|
||||
pub fn atomic_umax<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umax_seqcst<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Maximum with the current value using an unsigned comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] unsigned integer types via the `fetch_max` method by passing
|
||||
/// [`Ordering::Acquire`] as the `order`. For example, [`AtomicU32::fetch_max`].
|
||||
pub fn atomic_umax_acq<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umax_acquire<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Maximum with the current value using an unsigned comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
/// [`atomic`] unsigned integer types via the `fetch_max` method by passing
|
||||
/// [`Ordering::Release`] as the `order`. For example, [`AtomicU32::fetch_max`].
|
||||
pub fn atomic_umax_rel<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_umax_release<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
/// Maximum with the current value using an unsigned comparison.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available on the
|
||||
@ -583,6 +875,99 @@ extern "rust-intrinsic" {
|
||||
/// [`Ordering::Relaxed`] as the `order`. For example, [`AtomicU32::fetch_max`].
|
||||
pub fn atomic_umax_relaxed<T: Copy>(dst: *mut T, src: T) -> T;
|
||||
|
||||
/// An atomic fence.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::fence`] by passing [`Ordering::SeqCst`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_fence_seqcst();
|
||||
/// An atomic fence.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::fence`] by passing [`Ordering::Acquire`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_fence_acquire();
|
||||
/// An atomic fence.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::fence`] by passing [`Ordering::Release`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_fence_release();
|
||||
/// An atomic fence.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::fence`] by passing [`Ordering::AcqRel`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_fence_acqrel();
|
||||
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the
|
||||
/// compiler, but no instructions will be emitted for it. This is
|
||||
/// appropriate for operations on the same thread that may be preempted,
|
||||
/// such as when interacting with signal handlers.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::compiler_fence`] by passing [`Ordering::SeqCst`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_singlethreadfence_seqcst();
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the
|
||||
/// compiler, but no instructions will be emitted for it. This is
|
||||
/// appropriate for operations on the same thread that may be preempted,
|
||||
/// such as when interacting with signal handlers.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::compiler_fence`] by passing [`Ordering::Acquire`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_singlethreadfence_acquire();
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the
|
||||
/// compiler, but no instructions will be emitted for it. This is
|
||||
/// appropriate for operations on the same thread that may be preempted,
|
||||
/// such as when interacting with signal handlers.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::compiler_fence`] by passing [`Ordering::Release`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_singlethreadfence_release();
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the
|
||||
/// compiler, but no instructions will be emitted for it. This is
|
||||
/// appropriate for operations on the same thread that may be preempted,
|
||||
/// such as when interacting with signal handlers.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::compiler_fence`] by passing [`Ordering::AcqRel`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_singlethreadfence_acqrel();
|
||||
}
|
||||
|
||||
// These have been renamed.
|
||||
//
|
||||
// These are the aliases for the old names.
|
||||
// To be removed when stdarch and panic_unwind have been updated.
|
||||
#[cfg(not(bootstrap))]
|
||||
mod atomics {
|
||||
pub use super::atomic_cxchg_acqrel_acquire as atomic_cxchg_acqrel;
|
||||
pub use super::atomic_cxchg_acqrel_relaxed as atomic_cxchg_acqrel_failrelaxed;
|
||||
pub use super::atomic_cxchg_acquire_acquire as atomic_cxchg_acq;
|
||||
pub use super::atomic_cxchg_acquire_relaxed as atomic_cxchg_acq_failrelaxed;
|
||||
pub use super::atomic_cxchg_relaxed_relaxed as atomic_cxchg_relaxed;
|
||||
pub use super::atomic_cxchg_release_relaxed as atomic_cxchg_rel;
|
||||
pub use super::atomic_cxchg_seqcst_acquire as atomic_cxchg_failacq;
|
||||
pub use super::atomic_cxchg_seqcst_relaxed as atomic_cxchg_failrelaxed;
|
||||
pub use super::atomic_cxchg_seqcst_seqcst as atomic_cxchg;
|
||||
pub use super::atomic_store_seqcst as atomic_store;
|
||||
}
|
||||
|
||||
#[cfg(not(bootstrap))]
|
||||
pub use atomics::*;
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
/// The `prefetch` intrinsic is a hint to the code generator to insert a prefetch instruction
|
||||
/// if supported; otherwise, it is a no-op.
|
||||
/// Prefetches have no effect on the behavior of the program but can change its performance
|
||||
@ -623,78 +1008,6 @@ extern "rust-intrinsic" {
|
||||
///
|
||||
/// This intrinsic does not have a stable counterpart.
|
||||
pub fn prefetch_write_instruction<T>(data: *const T, locality: i32);
|
||||
}
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
/// An atomic fence.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::fence`] by passing [`Ordering::SeqCst`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_fence();
|
||||
/// An atomic fence.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::fence`] by passing [`Ordering::Acquire`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_fence_acq();
|
||||
/// An atomic fence.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::fence`] by passing [`Ordering::Release`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_fence_rel();
|
||||
/// An atomic fence.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::fence`] by passing [`Ordering::AcqRel`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_fence_acqrel();
|
||||
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the
|
||||
/// compiler, but no instructions will be emitted for it. This is
|
||||
/// appropriate for operations on the same thread that may be preempted,
|
||||
/// such as when interacting with signal handlers.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::compiler_fence`] by passing [`Ordering::SeqCst`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_singlethreadfence();
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the
|
||||
/// compiler, but no instructions will be emitted for it. This is
|
||||
/// appropriate for operations on the same thread that may be preempted,
|
||||
/// such as when interacting with signal handlers.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::compiler_fence`] by passing [`Ordering::Acquire`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_singlethreadfence_acq();
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the
|
||||
/// compiler, but no instructions will be emitted for it. This is
|
||||
/// appropriate for operations on the same thread that may be preempted,
|
||||
/// such as when interacting with signal handlers.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::compiler_fence`] by passing [`Ordering::Release`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_singlethreadfence_rel();
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the
|
||||
/// compiler, but no instructions will be emitted for it. This is
|
||||
/// appropriate for operations on the same thread that may be preempted,
|
||||
/// such as when interacting with signal handlers.
|
||||
///
|
||||
/// The stabilized version of this intrinsic is available in
|
||||
/// [`atomic::compiler_fence`] by passing [`Ordering::AcqRel`]
|
||||
/// as the `order`.
|
||||
pub fn atomic_singlethreadfence_acqrel();
|
||||
|
||||
/// Magic intrinsic that derives its meaning from attributes
|
||||
/// attached to the function.
|
||||
|
@ -2575,11 +2575,11 @@ unsafe fn atomic_store<T: Copy>(dst: *mut T, val: T, order: Ordering) {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_store`.
|
||||
unsafe {
|
||||
match order {
|
||||
Release => intrinsics::atomic_store_rel(dst, val),
|
||||
Relaxed => intrinsics::atomic_store_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_store(dst, val),
|
||||
Release => intrinsics::atomic_store_release(dst, val),
|
||||
SeqCst => intrinsics::atomic_store_seqcst(dst, val),
|
||||
Acquire => panic!("there is no such thing as an acquire store"),
|
||||
AcqRel => panic!("there is no such thing as an acquire/release store"),
|
||||
AcqRel => panic!("there is no such thing as an acquire-release store"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2589,11 +2589,11 @@ unsafe fn atomic_load<T: Copy>(dst: *const T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_load`.
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_load_acq(dst),
|
||||
Relaxed => intrinsics::atomic_load_relaxed(dst),
|
||||
SeqCst => intrinsics::atomic_load(dst),
|
||||
Acquire => intrinsics::atomic_load_acquire(dst),
|
||||
SeqCst => intrinsics::atomic_load_seqcst(dst),
|
||||
Release => panic!("there is no such thing as a release load"),
|
||||
AcqRel => panic!("there is no such thing as an acquire/release load"),
|
||||
AcqRel => panic!("there is no such thing as an acquire-release load"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2604,11 +2604,11 @@ unsafe fn atomic_swap<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_swap`.
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_xchg_acq(dst, val),
|
||||
Release => intrinsics::atomic_xchg_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_xchg_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_xchg_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_xchg(dst, val),
|
||||
Acquire => intrinsics::atomic_xchg_acquire(dst, val),
|
||||
Release => intrinsics::atomic_xchg_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_xchg_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_xchg_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2620,11 +2620,11 @@ unsafe fn atomic_add<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_add`.
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_xadd_acq(dst, val),
|
||||
Release => intrinsics::atomic_xadd_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_xadd_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_xadd_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_xadd(dst, val),
|
||||
Acquire => intrinsics::atomic_xadd_acquire(dst, val),
|
||||
Release => intrinsics::atomic_xadd_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_xadd_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_xadd_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2636,11 +2636,11 @@ unsafe fn atomic_sub<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_sub`.
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_xsub_acq(dst, val),
|
||||
Release => intrinsics::atomic_xsub_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_xsub_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_xsub_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_xsub(dst, val),
|
||||
Acquire => intrinsics::atomic_xsub_acquire(dst, val),
|
||||
Release => intrinsics::atomic_xsub_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_xsub_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_xsub_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2657,16 +2657,22 @@ unsafe fn atomic_compare_exchange<T: Copy>(
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_compare_exchange`.
|
||||
let (val, ok) = unsafe {
|
||||
match (success, failure) {
|
||||
(Acquire, Acquire) => intrinsics::atomic_cxchg_acq(dst, old, new),
|
||||
(Release, Relaxed) => intrinsics::atomic_cxchg_rel(dst, old, new),
|
||||
(AcqRel, Acquire) => intrinsics::atomic_cxchg_acqrel(dst, old, new),
|
||||
(Relaxed, Relaxed) => intrinsics::atomic_cxchg_relaxed(dst, old, new),
|
||||
(SeqCst, SeqCst) => intrinsics::atomic_cxchg(dst, old, new),
|
||||
(Acquire, Relaxed) => intrinsics::atomic_cxchg_acq_failrelaxed(dst, old, new),
|
||||
(AcqRel, Relaxed) => intrinsics::atomic_cxchg_acqrel_failrelaxed(dst, old, new),
|
||||
(SeqCst, Relaxed) => intrinsics::atomic_cxchg_failrelaxed(dst, old, new),
|
||||
(SeqCst, Acquire) => intrinsics::atomic_cxchg_failacq(dst, old, new),
|
||||
(_, AcqRel) => panic!("there is no such thing as an acquire/release failure ordering"),
|
||||
(Relaxed, Relaxed) => intrinsics::atomic_cxchg_relaxed_relaxed(dst, old, new),
|
||||
//(Relaxed, Acquire) => intrinsics::atomic_cxchg_relaxed_acquire(dst, old, new),
|
||||
//(Relaxed, SeqCst) => intrinsics::atomic_cxchg_relaxed_seqcst(dst, old, new),
|
||||
(Acquire, Relaxed) => intrinsics::atomic_cxchg_acquire_relaxed(dst, old, new),
|
||||
(Acquire, Acquire) => intrinsics::atomic_cxchg_acquire_acquire(dst, old, new),
|
||||
//(Acquire, SeqCst) => intrinsics::atomic_cxchg_acquire_seqcst(dst, old, new),
|
||||
(Release, Relaxed) => intrinsics::atomic_cxchg_release_relaxed(dst, old, new),
|
||||
//(Release, Acquire) => intrinsics::atomic_cxchg_release_acquire(dst, old, new),
|
||||
//(Release, SeqCst) => intrinsics::atomic_cxchg_release_seqcst(dst, old, new),
|
||||
(AcqRel, Relaxed) => intrinsics::atomic_cxchg_acqrel_relaxed(dst, old, new),
|
||||
(AcqRel, Acquire) => intrinsics::atomic_cxchg_acqrel_acquire(dst, old, new),
|
||||
//(AcqRel, SeqCst) => intrinsics::atomic_cxchg_acqrel_seqcst(dst, old, new),
|
||||
(SeqCst, Relaxed) => intrinsics::atomic_cxchg_seqcst_relaxed(dst, old, new),
|
||||
(SeqCst, Acquire) => intrinsics::atomic_cxchg_seqcst_acquire(dst, old, new),
|
||||
(SeqCst, SeqCst) => intrinsics::atomic_cxchg_seqcst_seqcst(dst, old, new),
|
||||
(_, AcqRel) => panic!("there is no such thing as an acquire-release failure ordering"),
|
||||
(_, Release) => panic!("there is no such thing as a release failure ordering"),
|
||||
_ => panic!("a failure ordering can't be stronger than a success ordering"),
|
||||
}
|
||||
@ -2686,16 +2692,22 @@ unsafe fn atomic_compare_exchange_weak<T: Copy>(
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_compare_exchange_weak`.
|
||||
let (val, ok) = unsafe {
|
||||
match (success, failure) {
|
||||
(Acquire, Acquire) => intrinsics::atomic_cxchgweak_acq(dst, old, new),
|
||||
(Release, Relaxed) => intrinsics::atomic_cxchgweak_rel(dst, old, new),
|
||||
(AcqRel, Acquire) => intrinsics::atomic_cxchgweak_acqrel(dst, old, new),
|
||||
(Relaxed, Relaxed) => intrinsics::atomic_cxchgweak_relaxed(dst, old, new),
|
||||
(SeqCst, SeqCst) => intrinsics::atomic_cxchgweak(dst, old, new),
|
||||
(Acquire, Relaxed) => intrinsics::atomic_cxchgweak_acq_failrelaxed(dst, old, new),
|
||||
(AcqRel, Relaxed) => intrinsics::atomic_cxchgweak_acqrel_failrelaxed(dst, old, new),
|
||||
(SeqCst, Relaxed) => intrinsics::atomic_cxchgweak_failrelaxed(dst, old, new),
|
||||
(SeqCst, Acquire) => intrinsics::atomic_cxchgweak_failacq(dst, old, new),
|
||||
(_, AcqRel) => panic!("there is no such thing as an acquire/release failure ordering"),
|
||||
(Relaxed, Relaxed) => intrinsics::atomic_cxchgweak_relaxed_relaxed(dst, old, new),
|
||||
//(Relaxed, Acquire) => intrinsics::atomic_cxchgweak_relaxed_acquire(dst, old, new),
|
||||
//(Relaxed, SeqCst) => intrinsics::atomic_cxchgweak_relaxed_seqcst(dst, old, new),
|
||||
(Acquire, Relaxed) => intrinsics::atomic_cxchgweak_acquire_relaxed(dst, old, new),
|
||||
(Acquire, Acquire) => intrinsics::atomic_cxchgweak_acquire_acquire(dst, old, new),
|
||||
//(Acquire, SeqCst) => intrinsics::atomic_cxchgweak_acquire_seqcst(dst, old, new),
|
||||
(Release, Relaxed) => intrinsics::atomic_cxchgweak_release_relaxed(dst, old, new),
|
||||
//(Release, Acquire) => intrinsics::atomic_cxchgweak_release_acquire(dst, old, new),
|
||||
//(Release, SeqCst) => intrinsics::atomic_cxchgweak_release_seqcst(dst, old, new),
|
||||
(AcqRel, Relaxed) => intrinsics::atomic_cxchgweak_acqrel_relaxed(dst, old, new),
|
||||
(AcqRel, Acquire) => intrinsics::atomic_cxchgweak_acqrel_acquire(dst, old, new),
|
||||
//(AcqRel, SeqCst) => intrinsics::atomic_cxchgweak_acqrel_seqcst(dst, old, new),
|
||||
(SeqCst, Relaxed) => intrinsics::atomic_cxchgweak_seqcst_relaxed(dst, old, new),
|
||||
(SeqCst, Acquire) => intrinsics::atomic_cxchgweak_seqcst_acquire(dst, old, new),
|
||||
(SeqCst, SeqCst) => intrinsics::atomic_cxchgweak_seqcst_seqcst(dst, old, new),
|
||||
(_, AcqRel) => panic!("there is no such thing as an acquire-release failure ordering"),
|
||||
(_, Release) => panic!("there is no such thing as a release failure ordering"),
|
||||
_ => panic!("a failure ordering can't be stronger than a success ordering"),
|
||||
}
|
||||
@ -2709,11 +2721,11 @@ unsafe fn atomic_and<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_and`
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_and_acq(dst, val),
|
||||
Release => intrinsics::atomic_and_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_and_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_and_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_and(dst, val),
|
||||
Acquire => intrinsics::atomic_and_acquire(dst, val),
|
||||
Release => intrinsics::atomic_and_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_and_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_and_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2724,11 +2736,11 @@ unsafe fn atomic_nand<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_nand`
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_nand_acq(dst, val),
|
||||
Release => intrinsics::atomic_nand_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_nand_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_nand_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_nand(dst, val),
|
||||
Acquire => intrinsics::atomic_nand_acquire(dst, val),
|
||||
Release => intrinsics::atomic_nand_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_nand_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_nand_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2739,11 +2751,11 @@ unsafe fn atomic_or<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_or`
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_or_acq(dst, val),
|
||||
Release => intrinsics::atomic_or_rel(dst, val),
|
||||
SeqCst => intrinsics::atomic_or_seqcst(dst, val),
|
||||
Acquire => intrinsics::atomic_or_acquire(dst, val),
|
||||
Release => intrinsics::atomic_or_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_or_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_or_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_or(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2754,11 +2766,11 @@ unsafe fn atomic_xor<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_xor`
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_xor_acq(dst, val),
|
||||
Release => intrinsics::atomic_xor_rel(dst, val),
|
||||
SeqCst => intrinsics::atomic_xor_seqcst(dst, val),
|
||||
Acquire => intrinsics::atomic_xor_acquire(dst, val),
|
||||
Release => intrinsics::atomic_xor_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_xor_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_xor_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_xor(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2770,11 +2782,11 @@ unsafe fn atomic_max<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_max`
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_max_acq(dst, val),
|
||||
Release => intrinsics::atomic_max_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_max_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_max_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_max(dst, val),
|
||||
Acquire => intrinsics::atomic_max_acquire(dst, val),
|
||||
Release => intrinsics::atomic_max_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_max_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_max_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2786,11 +2798,11 @@ unsafe fn atomic_min<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_min`
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_min_acq(dst, val),
|
||||
Release => intrinsics::atomic_min_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_min_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_min_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_min(dst, val),
|
||||
Acquire => intrinsics::atomic_min_acquire(dst, val),
|
||||
Release => intrinsics::atomic_min_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_min_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_min_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2802,11 +2814,11 @@ unsafe fn atomic_umax<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_umax`
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_umax_acq(dst, val),
|
||||
Release => intrinsics::atomic_umax_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_umax_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_umax_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_umax(dst, val),
|
||||
Acquire => intrinsics::atomic_umax_acquire(dst, val),
|
||||
Release => intrinsics::atomic_umax_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_umax_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_umax_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2818,11 +2830,11 @@ unsafe fn atomic_umin<T: Copy>(dst: *mut T, val: T, order: Ordering) -> T {
|
||||
// SAFETY: the caller must uphold the safety contract for `atomic_umin`
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_umin_acq(dst, val),
|
||||
Release => intrinsics::atomic_umin_rel(dst, val),
|
||||
AcqRel => intrinsics::atomic_umin_acqrel(dst, val),
|
||||
Relaxed => intrinsics::atomic_umin_relaxed(dst, val),
|
||||
SeqCst => intrinsics::atomic_umin(dst, val),
|
||||
Acquire => intrinsics::atomic_umin_acquire(dst, val),
|
||||
Release => intrinsics::atomic_umin_release(dst, val),
|
||||
AcqRel => intrinsics::atomic_umin_acqrel(dst, val),
|
||||
SeqCst => intrinsics::atomic_umin_seqcst(dst, val),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2908,10 +2920,10 @@ pub fn fence(order: Ordering) {
|
||||
// SAFETY: using an atomic fence is safe.
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_fence_acq(),
|
||||
Release => intrinsics::atomic_fence_rel(),
|
||||
Acquire => intrinsics::atomic_fence_acquire(),
|
||||
Release => intrinsics::atomic_fence_release(),
|
||||
AcqRel => intrinsics::atomic_fence_acqrel(),
|
||||
SeqCst => intrinsics::atomic_fence(),
|
||||
SeqCst => intrinsics::atomic_fence_seqcst(),
|
||||
Relaxed => panic!("there is no such thing as a relaxed fence"),
|
||||
}
|
||||
}
|
||||
@ -2990,10 +3002,10 @@ pub fn compiler_fence(order: Ordering) {
|
||||
// SAFETY: using an atomic fence is safe.
|
||||
unsafe {
|
||||
match order {
|
||||
Acquire => intrinsics::atomic_singlethreadfence_acq(),
|
||||
Release => intrinsics::atomic_singlethreadfence_rel(),
|
||||
Acquire => intrinsics::atomic_singlethreadfence_acquire(),
|
||||
Release => intrinsics::atomic_singlethreadfence_release(),
|
||||
AcqRel => intrinsics::atomic_singlethreadfence_acqrel(),
|
||||
SeqCst => intrinsics::atomic_singlethreadfence(),
|
||||
SeqCst => intrinsics::atomic_singlethreadfence_seqcst(),
|
||||
Relaxed => panic!("there is no such thing as a relaxed compiler fence"),
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
#![no_core]
|
||||
|
||||
extern "rust-intrinsic" {
|
||||
fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
|
||||
fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
}
|
||||
|
||||
#[lang = "sized"]
|
||||
@ -17,50 +17,50 @@ impl<T: ?Sized> Copy for *mut T {}
|
||||
|
||||
#[cfg(target_has_atomic = "8")]
|
||||
pub unsafe fn atomic_u8(x: *mut u8) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "8")]
|
||||
pub unsafe fn atomic_i8(x: *mut i8) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "16")]
|
||||
pub unsafe fn atomic_u16(x: *mut u16) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "16")]
|
||||
pub unsafe fn atomic_i16(x: *mut i16) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "32")]
|
||||
pub unsafe fn atomic_u32(x: *mut u32) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "32")]
|
||||
pub unsafe fn atomic_i32(x: *mut i32) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "64")]
|
||||
pub unsafe fn atomic_u64(x: *mut u64) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "64")]
|
||||
pub unsafe fn atomic_i64(x: *mut i64) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "128")]
|
||||
pub unsafe fn atomic_u128(x: *mut u128) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "128")]
|
||||
pub unsafe fn atomic_i128(x: *mut i128) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
pub unsafe fn atomic_usize(x: *mut usize) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
#[cfg(target_has_atomic = "ptr")]
|
||||
pub unsafe fn atomic_isize(x: *mut isize) {
|
||||
atomic_xadd(x, 1);
|
||||
atomic_xadd_seqcst(x, 1);
|
||||
}
|
||||
|
@ -2,13 +2,13 @@
|
||||
|
||||
pub mod rusti {
|
||||
extern "rust-intrinsic" {
|
||||
pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub fn atomic_xchg(dst: *mut isize, src: isize) -> isize {
|
||||
pub fn atomic_xchg_seqcst(dst: *mut isize, src: isize) -> isize {
|
||||
unsafe {
|
||||
rusti::atomic_xchg(dst, src)
|
||||
rusti::atomic_xchg_seqcst(dst, src)
|
||||
}
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
|
||||
|
||||
extern crate cci_intrinsic;
|
||||
use cci_intrinsic::atomic_xchg;
|
||||
use cci_intrinsic::atomic_xchg_seqcst;
|
||||
|
||||
pub fn main() {
|
||||
let mut x = 1;
|
||||
atomic_xchg(&mut x, 5);
|
||||
atomic_xchg_seqcst(&mut x, 5);
|
||||
assert_eq!(x, 5);
|
||||
}
|
||||
|
@ -3,31 +3,31 @@
|
||||
|
||||
mod rusti {
|
||||
extern "rust-intrinsic" {
|
||||
pub fn atomic_cxchg<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchg_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
|
||||
pub fn atomic_cxchgweak<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_acq<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_rel<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_seqcst_seqcst<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_acquire_acquire<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
pub fn atomic_cxchgweak_release_relaxed<T>(dst: *mut T, old: T, src: T) -> (T, bool);
|
||||
|
||||
pub fn atomic_load<T>(src: *const T) -> T;
|
||||
pub fn atomic_load_acq<T>(src: *const T) -> T;
|
||||
pub fn atomic_load_seqcst<T>(src: *const T) -> T;
|
||||
pub fn atomic_load_acquire<T>(src: *const T) -> T;
|
||||
|
||||
pub fn atomic_store<T>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_rel<T>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_seqcst<T>(dst: *mut T, val: T);
|
||||
pub fn atomic_store_release<T>(dst: *mut T, val: T);
|
||||
|
||||
pub fn atomic_xchg<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_acq<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_rel<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xchg_release<T>(dst: *mut T, src: T) -> T;
|
||||
|
||||
pub fn atomic_xadd<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_acq<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_rel<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xadd_release<T>(dst: *mut T, src: T) -> T;
|
||||
|
||||
pub fn atomic_xsub<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_acq<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_rel<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_seqcst<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_acquire<T>(dst: *mut T, src: T) -> T;
|
||||
pub fn atomic_xsub_release<T>(dst: *mut T, src: T) -> T;
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,45 +35,45 @@ pub fn main() {
|
||||
unsafe {
|
||||
let mut x: Box<_> = Box::new(1);
|
||||
|
||||
assert_eq!(rusti::atomic_load(&*x), 1);
|
||||
assert_eq!(rusti::atomic_load_seqcst(&*x), 1);
|
||||
*x = 5;
|
||||
assert_eq!(rusti::atomic_load_acq(&*x), 5);
|
||||
assert_eq!(rusti::atomic_load_acquire(&*x), 5);
|
||||
|
||||
rusti::atomic_store(&mut *x,3);
|
||||
rusti::atomic_store_seqcst(&mut *x,3);
|
||||
assert_eq!(*x, 3);
|
||||
rusti::atomic_store_rel(&mut *x,1);
|
||||
rusti::atomic_store_release(&mut *x,1);
|
||||
assert_eq!(*x, 1);
|
||||
|
||||
assert_eq!(rusti::atomic_cxchg(&mut *x, 1, 2), (1, true));
|
||||
assert_eq!(rusti::atomic_cxchg_seqcst_seqcst(&mut *x, 1, 2), (1, true));
|
||||
assert_eq!(*x, 2);
|
||||
|
||||
assert_eq!(rusti::atomic_cxchg_acq(&mut *x, 1, 3), (2, false));
|
||||
assert_eq!(rusti::atomic_cxchg_acquire_acquire(&mut *x, 1, 3), (2, false));
|
||||
assert_eq!(*x, 2);
|
||||
|
||||
assert_eq!(rusti::atomic_cxchg_rel(&mut *x, 2, 1), (2, true));
|
||||
assert_eq!(rusti::atomic_cxchg_release_relaxed(&mut *x, 2, 1), (2, true));
|
||||
assert_eq!(*x, 1);
|
||||
|
||||
assert_eq!(rusti::atomic_xchg(&mut *x, 0), 1);
|
||||
assert_eq!(rusti::atomic_xchg_seqcst(&mut *x, 0), 1);
|
||||
assert_eq!(*x, 0);
|
||||
|
||||
assert_eq!(rusti::atomic_xchg_acq(&mut *x, 1), 0);
|
||||
assert_eq!(rusti::atomic_xchg_acquire(&mut *x, 1), 0);
|
||||
assert_eq!(*x, 1);
|
||||
|
||||
assert_eq!(rusti::atomic_xchg_rel(&mut *x, 0), 1);
|
||||
assert_eq!(rusti::atomic_xchg_release(&mut *x, 0), 1);
|
||||
assert_eq!(*x, 0);
|
||||
|
||||
assert_eq!(rusti::atomic_xadd(&mut *x, 1), 0);
|
||||
assert_eq!(rusti::atomic_xadd_acq(&mut *x, 1), 1);
|
||||
assert_eq!(rusti::atomic_xadd_rel(&mut *x, 1), 2);
|
||||
assert_eq!(rusti::atomic_xadd_seqcst(&mut *x, 1), 0);
|
||||
assert_eq!(rusti::atomic_xadd_acquire(&mut *x, 1), 1);
|
||||
assert_eq!(rusti::atomic_xadd_release(&mut *x, 1), 2);
|
||||
assert_eq!(*x, 3);
|
||||
|
||||
assert_eq!(rusti::atomic_xsub(&mut *x, 1), 3);
|
||||
assert_eq!(rusti::atomic_xsub_acq(&mut *x, 1), 2);
|
||||
assert_eq!(rusti::atomic_xsub_rel(&mut *x, 1), 1);
|
||||
assert_eq!(rusti::atomic_xsub_seqcst(&mut *x, 1), 3);
|
||||
assert_eq!(rusti::atomic_xsub_acquire(&mut *x, 1), 2);
|
||||
assert_eq!(rusti::atomic_xsub_release(&mut *x, 1), 1);
|
||||
assert_eq!(*x, 0);
|
||||
|
||||
loop {
|
||||
let res = rusti::atomic_cxchgweak(&mut *x, 0, 1);
|
||||
let res = rusti::atomic_cxchgweak_seqcst_seqcst(&mut *x, 0, 1);
|
||||
assert_eq!(res.0, 0);
|
||||
if res.1 {
|
||||
break;
|
||||
@ -82,7 +82,7 @@ pub fn main() {
|
||||
assert_eq!(*x, 1);
|
||||
|
||||
loop {
|
||||
let res = rusti::atomic_cxchgweak_acq(&mut *x, 1, 2);
|
||||
let res = rusti::atomic_cxchgweak_acquire_acquire(&mut *x, 1, 2);
|
||||
assert_eq!(res.0, 1);
|
||||
if res.1 {
|
||||
break;
|
||||
@ -91,7 +91,7 @@ pub fn main() {
|
||||
assert_eq!(*x, 2);
|
||||
|
||||
loop {
|
||||
let res = rusti::atomic_cxchgweak_rel(&mut *x, 2, 3);
|
||||
let res = rusti::atomic_cxchgweak_release_relaxed(&mut *x, 2, 3);
|
||||
assert_eq!(res.0, 2);
|
||||
if res.1 {
|
||||
break;
|
||||
|
@ -12,81 +12,81 @@ pub type Bar = &'static Fn();
|
||||
pub type Quux = [u8; 100];
|
||||
|
||||
pub unsafe fn test_bool_load(p: &mut bool, v: bool) {
|
||||
intrinsics::atomic_load(p);
|
||||
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `bool`
|
||||
intrinsics::atomic_load_seqcst(p);
|
||||
//~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `bool`
|
||||
}
|
||||
|
||||
pub unsafe fn test_bool_store(p: &mut bool, v: bool) {
|
||||
intrinsics::atomic_store(p, v);
|
||||
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `bool`
|
||||
intrinsics::atomic_store_seqcst(p, v);
|
||||
//~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `bool`
|
||||
}
|
||||
|
||||
pub unsafe fn test_bool_xchg(p: &mut bool, v: bool) {
|
||||
intrinsics::atomic_xchg(p, v);
|
||||
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `bool`
|
||||
intrinsics::atomic_xchg_seqcst(p, v);
|
||||
//~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `bool`
|
||||
}
|
||||
|
||||
pub unsafe fn test_bool_cxchg(p: &mut bool, v: bool) {
|
||||
intrinsics::atomic_cxchg(p, v, v);
|
||||
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
|
||||
intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
|
||||
//~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `bool`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Foo_load(p: &mut Foo, v: Foo) {
|
||||
intrinsics::atomic_load(p);
|
||||
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `Foo`
|
||||
intrinsics::atomic_load_seqcst(p);
|
||||
//~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `Foo`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Foo_store(p: &mut Foo, v: Foo) {
|
||||
intrinsics::atomic_store(p, v);
|
||||
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `Foo`
|
||||
intrinsics::atomic_store_seqcst(p, v);
|
||||
//~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `Foo`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Foo_xchg(p: &mut Foo, v: Foo) {
|
||||
intrinsics::atomic_xchg(p, v);
|
||||
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
|
||||
intrinsics::atomic_xchg_seqcst(p, v);
|
||||
//~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `Foo`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Foo_cxchg(p: &mut Foo, v: Foo) {
|
||||
intrinsics::atomic_cxchg(p, v, v);
|
||||
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
|
||||
intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
|
||||
//~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `Foo`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Bar_load(p: &mut Bar, v: Bar) {
|
||||
intrinsics::atomic_load(p);
|
||||
intrinsics::atomic_load_seqcst(p);
|
||||
//~^ ERROR expected basic integer type, found `&dyn Fn()`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Bar_store(p: &mut Bar, v: Bar) {
|
||||
intrinsics::atomic_store(p, v);
|
||||
intrinsics::atomic_store_seqcst(p, v);
|
||||
//~^ ERROR expected basic integer type, found `&dyn Fn()`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Bar_xchg(p: &mut Bar, v: Bar) {
|
||||
intrinsics::atomic_xchg(p, v);
|
||||
intrinsics::atomic_xchg_seqcst(p, v);
|
||||
//~^ ERROR expected basic integer type, found `&dyn Fn()`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Bar_cxchg(p: &mut Bar, v: Bar) {
|
||||
intrinsics::atomic_cxchg(p, v, v);
|
||||
intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
|
||||
//~^ ERROR expected basic integer type, found `&dyn Fn()`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Quux_load(p: &mut Quux, v: Quux) {
|
||||
intrinsics::atomic_load(p);
|
||||
//~^ ERROR `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
intrinsics::atomic_load_seqcst(p);
|
||||
//~^ ERROR `atomic_load_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Quux_store(p: &mut Quux, v: Quux) {
|
||||
intrinsics::atomic_store(p, v);
|
||||
//~^ ERROR `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
intrinsics::atomic_store_seqcst(p, v);
|
||||
//~^ ERROR `atomic_store_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Quux_xchg(p: &mut Quux, v: Quux) {
|
||||
intrinsics::atomic_xchg(p, v);
|
||||
//~^ ERROR `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
intrinsics::atomic_xchg_seqcst(p, v);
|
||||
//~^ ERROR `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
}
|
||||
|
||||
pub unsafe fn test_Quux_cxchg(p: &mut Quux, v: Quux) {
|
||||
intrinsics::atomic_cxchg(p, v, v);
|
||||
//~^ ERROR `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
|
||||
//~^ ERROR `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
}
|
||||
|
@ -1,98 +1,98 @@
|
||||
error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `bool`
|
||||
error[E0511]: invalid monomorphization of `atomic_load_seqcst` intrinsic: expected basic integer type, found `bool`
|
||||
--> $DIR/non-integer-atomic.rs:15:5
|
||||
|
|
||||
LL | intrinsics::atomic_load(p);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_load_seqcst(p);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `bool`
|
||||
error[E0511]: invalid monomorphization of `atomic_store_seqcst` intrinsic: expected basic integer type, found `bool`
|
||||
--> $DIR/non-integer-atomic.rs:20:5
|
||||
|
|
||||
LL | intrinsics::atomic_store(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_store_seqcst(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `bool`
|
||||
error[E0511]: invalid monomorphization of `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `bool`
|
||||
--> $DIR/non-integer-atomic.rs:25:5
|
||||
|
|
||||
LL | intrinsics::atomic_xchg(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_xchg_seqcst(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `bool`
|
||||
error[E0511]: invalid monomorphization of `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `bool`
|
||||
--> $DIR/non-integer-atomic.rs:30:5
|
||||
|
|
||||
LL | intrinsics::atomic_cxchg(p, v, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `Foo`
|
||||
error[E0511]: invalid monomorphization of `atomic_load_seqcst` intrinsic: expected basic integer type, found `Foo`
|
||||
--> $DIR/non-integer-atomic.rs:35:5
|
||||
|
|
||||
LL | intrinsics::atomic_load(p);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_load_seqcst(p);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `Foo`
|
||||
error[E0511]: invalid monomorphization of `atomic_store_seqcst` intrinsic: expected basic integer type, found `Foo`
|
||||
--> $DIR/non-integer-atomic.rs:40:5
|
||||
|
|
||||
LL | intrinsics::atomic_store(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_store_seqcst(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `Foo`
|
||||
error[E0511]: invalid monomorphization of `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `Foo`
|
||||
--> $DIR/non-integer-atomic.rs:45:5
|
||||
|
|
||||
LL | intrinsics::atomic_xchg(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_xchg_seqcst(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `Foo`
|
||||
error[E0511]: invalid monomorphization of `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `Foo`
|
||||
--> $DIR/non-integer-atomic.rs:50:5
|
||||
|
|
||||
LL | intrinsics::atomic_cxchg(p, v, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `&dyn Fn()`
|
||||
error[E0511]: invalid monomorphization of `atomic_load_seqcst` intrinsic: expected basic integer type, found `&dyn Fn()`
|
||||
--> $DIR/non-integer-atomic.rs:55:5
|
||||
|
|
||||
LL | intrinsics::atomic_load(p);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_load_seqcst(p);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `&dyn Fn()`
|
||||
error[E0511]: invalid monomorphization of `atomic_store_seqcst` intrinsic: expected basic integer type, found `&dyn Fn()`
|
||||
--> $DIR/non-integer-atomic.rs:60:5
|
||||
|
|
||||
LL | intrinsics::atomic_store(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_store_seqcst(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `&dyn Fn()`
|
||||
error[E0511]: invalid monomorphization of `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `&dyn Fn()`
|
||||
--> $DIR/non-integer-atomic.rs:65:5
|
||||
|
|
||||
LL | intrinsics::atomic_xchg(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_xchg_seqcst(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `&dyn Fn()`
|
||||
error[E0511]: invalid monomorphization of `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `&dyn Fn()`
|
||||
--> $DIR/non-integer-atomic.rs:70:5
|
||||
|
|
||||
LL | intrinsics::atomic_cxchg(p, v, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_load` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
error[E0511]: invalid monomorphization of `atomic_load_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
--> $DIR/non-integer-atomic.rs:75:5
|
||||
|
|
||||
LL | intrinsics::atomic_load(p);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_load_seqcst(p);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_store` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
error[E0511]: invalid monomorphization of `atomic_store_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
--> $DIR/non-integer-atomic.rs:80:5
|
||||
|
|
||||
LL | intrinsics::atomic_store(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_store_seqcst(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_xchg` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
error[E0511]: invalid monomorphization of `atomic_xchg_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
--> $DIR/non-integer-atomic.rs:85:5
|
||||
|
|
||||
LL | intrinsics::atomic_xchg(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_xchg_seqcst(p, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error[E0511]: invalid monomorphization of `atomic_cxchg` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
error[E0511]: invalid monomorphization of `atomic_cxchg_seqcst_seqcst` intrinsic: expected basic integer type, found `[u8; 100]`
|
||||
--> $DIR/non-integer-atomic.rs:90:5
|
||||
|
|
||||
LL | intrinsics::atomic_cxchg(p, v, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
LL | intrinsics::atomic_cxchg_seqcst_seqcst(p, v, v);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 16 previous errors
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user