I am trying to write an inline asm statement that atomically adds a number to a memory variable. Here's what I came up with:
#define atomic_add(mem,val) asm volatile ("lock; add%z0 %1, %0": "+m" (mem): "ir" (val)) This appears to work fine on x86, but in 64-bit mode %z returns "ll" instead of "q" for 64-bit values like size_t, and thus the assembler complains like this: t.c:53: Error: no such instruction: `addll $3,x.5802(%rip)' If I understand %z correctly, this is exactly what it is meant for... right? Please make it return "q" in this case. -- Summary: inline asm %z on amd64 says "ll" instead of "q" Product: gcc Version: 4.4.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: inline-asm AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: felix-gcc at fefe dot de GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39590