>> Ugh, in the hopes of simplifying the example, I made it somewhat trivial...
>> 
>> static __inline__ void atomic_add(atomic_t *v, int i)
>> {
>>      __asm__ __volatile__("addl %2,%0" : "=m" (*v) : "m" (*v), "d" (i));
>> }
>> 
>> Is that correct?  And if so, then isn't the documentation wrong?
>
>This is correct, as is a version using "+m" (*v) : "d"(i),
>though of course the %2 gets moved to %1 in that case.

If I try:

static __inline__ void atomic_add(atomic_t *v, int i)
{
        __asm__ __volatile__("addl %1,%0" : "+m" (*v) : "d" (i));
}

Then the compiler complains with:

/asm/atomic.h:33: warning: read-write constraint does not allow a register

So is the warning wrong?

-- 
Peter Barada
[EMAIL PROTECTED]

Reply via email to