just curious to know which CPU architectures support compare and swap atomic primitives?
Sparc v9 has a cas instruction. The SPARC v9 architecture manual discusses the use of the CAS instruction in Annex J, look specifically at examples J.11 and J.12.
I believe the name of the instruction is actually "casa", because it can access either the current address space or an alternate. "cas" is an assembler macro which accesses the current ASI.
There is also an article on developers.sun.com discussing the various atomic instructions which Sparc processors have implemented over the years, including cas.