On Thu, 7 Sep 2000, Jamie Lokier wrote:

> asm *__volatile__* seems to make no difference.  I've tried a few things.
> 
> Andrea Arcangeli wrote:
> > Maybe we can rely on the __volatile__ statement of the asm that will
> > enforce that if we write:
> > 
> >     *p = 0;
> >     __asm__ __volatile__("" : :);
> >     *p = 1;
> >
> > in the assembler we'll then find both a write of 0 and then a write of 1
> > to memory.
> 
> That does 2 writes with gcc-2.96 and also egcs-2.91.66/19990314
> (Red Hat's kgcc), with or without -fstrict-aliasing.
> 
> It also does 2 writes without __volatile__.

Your test is broken.

Read the gcc documentation. A inline asm with no outputs is implicitly
considered volatile. So _both_ your tests had volatile there.

Now, that may not matter that much fo ryour test-case: gcc gets careful
around inline asm anyway, even without the volatile.


Change it to something like

        __asm__("":"=r" (x):"0" (x));

and the "volatile" should matter.

Not for memory references, perhaps. But for the movement issues.

                        Linus

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to