do { p = *a; } while (p == 0x1 || !atomic_compare_and_swap(p, 0x1, a));
memory_barrier();
// do stuff that looks at *p
q->next = p;
memory_barrier();
atomic_store(q, a);
Here's the equivalent LL/SC version: do {
p = ll(a);
memory_barrier();
// do stuff that looks at *p
q->next = p;
memory_barrier();
} while (!sc(q, a));
The pointer-tagging version is also obviously not loop-free. Which is faster, in which cases, and by how much?
Everything but PostScript itself was closed-source. We could have definitely used 5086 pages of documentation. Even 2 would have been nice. Young whippersnappers don't know how good they have it...