long emit_cmpxchg( long volatile* p, long from, long to ) { long v = *p; if ( v == from ) *p = to; return v; }
gcc should be able to optimize this. -- Summary: cmpxchgq not emitted. Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: other AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at agmk dot net GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31170