http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52381
Timo Kreuzer <timo.kreuzer at reactos dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |timo.kreuzer at reactos dot | |org --- Comment #3 from Timo Kreuzer <timo.kreuzer at reactos dot org> 2013-01-10 13:49:11 UTC --- I support this feature request. As an exmple I'd like to mention the x86 instruction cmpxchg. While GCC has 2 CAS builtins (__sync_bool_compare_and_swap and __sync_val_compare_and_swap) neither of these supports what the x86 cmpxchg instruction does, namely returning both a boolean value indicating success AND the previous value of the memory operand in case of failure. So here's the code that would handle this, if output operand was usable. try_again: // do something asm goto ( "lock cmpxchg %%ecx, %[Destination] \t\n" "jnz %l[try_again] \t\n" : "=c"(Exchange) // <= does not work : [Destination]"m"(Destination), [Comparand]"a"(Comparand), [Exchange]"c"(Exchange) : "memory" : try_again ); Note that in this case the output is needed on the jump path.