Re: [PATCH] x86: fix inline assembly constraints

H. Peter Anvin
2008-10-30T03:55:58Z

Jike Song wrote:
>
> Besides, by looking at the inline assembly in kernel, I found lots of
> codes like this:
>
> static inline void atomic_add(int i, atomic_t *v)
> {
> asm volatile(LOCK_PREFIX "addl %1,%0"
> : "=m" (v->counter)
> : "ir" (i), "m" (v->counter));
> }
>
>
> Yes, it works. But a little ugly.. Should this be cleaned-up with the
> following?
>
> : "+m" (v->counter)
> : "ir" (i)
>
> If you agrees, I'll send out the patch; otherwise I won't wasting your time ;-)
>

Please don't change them just to change them, if there is no actual
error. You never know when you're going to trigger a new bug in some
weird version of gcc.

-hpa