Currently, the type of our atomic RMW intrinsics looks like
fn atomic_xadd_seqcst<T: Copy>(_dst: *mut T, _src: T) -> T
However, this is not quite what we want: for atomic operations on a pointer, we want dst to be something like *mut *mut T, but src should be usize. The return type should be *mut T.
This would let us avoid some unnecessary casts in AtomicPtr, and shift the burden of mapping this operation to something LLVM supports into the backend. It also makes the semantics of these operations more clear: only the provenance of the in-memory data matters; src carries no provenance.
Currently, the type of our atomic RMW intrinsics looks like
However, this is not quite what we want: for atomic operations on a pointer, we want
dstto be something like*mut *mut T, butsrcshould beusize. The return type should be*mut T.This would let us avoid some unnecessary casts in
AtomicPtr, and shift the burden of mapping this operation to something LLVM supports into the backend. It also makes the semantics of these operations more clear: only the provenance of the in-memory data matters;srccarries no provenance.