
United Kingdom

ALT Six tables showing the machine instructions for the atomic operations on ARMv8, ARMv8.1 and x86-64, for non-atomic, relaxed, acquire, release, acquire plus release, and sequentially consistent memory ordering. The six tables are labeled: load, store, swap, fetch op, compare exchange, fence. The full contents don't fit in the alt text, but here are the main takeaways: On x86, in each table, the instructions are the same for all (atomic) memory orderings, except seqcst store using a XCHG instruction instead of a MOV, and seqcst fence using MFENCE instead of nothing. On ARM, the acquire plus release instructions are equivalent to the sequentially consistent instructions in all cases. On ARMv8, the swap, fetch op and strong compare exchange are implemented as loops using the LDXR and STXR instructions. But on ARMv8.1, they are all implemented as a single instruction. On x86, fetch op is implemented with a lock prefix for some operations, and as a CMPXCHG loop for some others.






















![// Box:
let a: Option<Box<Thing>> = Some(Box::new(Thing));
let b: Option<&Thing> = a.as_deref();
// Vec:
let a: Option<Vec<i32>> = Some(vec![1, 2, 3]);
let b: Option<&[i32]> = a.as_deref();
// String:
let a: Option<String> = Some(format!("{b:?}"));
let b: Option<&str> = a.as_deref();](https://pbs.twimg.com/media/FO9LE3VXsAM6CgI.jpg?name=small&format=webp)