Files
LibretroAdmin 6ba45f7acb retro_atomic: one half of the 128-bit word alone
retro_atomic_load_acquire_128_lo(p) and retro_atomic_load_acquire_128_hi(p)
read one 64-bit half of a retro_atomic_128_t with acquire ordering: the
half as it is, not paired with the other half of the same value.

They are for one field of a pair that changes together: the owner of a
lock whose word also holds its queue, a pointer whose generation is not
needed to look at it. The whole value is a compare-and-swap on every
backend but GCC and Clang on x86-64, so the cache line is written by a
load; a half is a plain aligned eight-byte load everywhere, which both
processors do in one access:

- GCC and Clang (x86-64, AArch64): __atomic_load_n with
  __ATOMIC_ACQUIRE on the volatile word;
- MSVC x86-64: a volatile load and a compiler barrier (x86-64 orders
  loads);
- MSVC ARM64: __iso_volatile_load64 and __dmb(_ARM64_BARRIER_ISH).

No cast on the GCC and Clang paths, C89 throughout.

retro_atomic_test reads each half after the single-thread operations,
and its four 128-bit readers read both halves alone beside the whole
value under the counting and swapping threads: the low half never goes
back, the high one (its complement) never forward. With the low half
reading the high word the test fails both ways. Passes on x86-64 and,
under qemu, AArch64; the MSVC paths are not compiled here.
2026-11-14 22:22:28 +01:00
..