[MPlayer-dev-eng] Asm parameter constraints (was: Improved remove-logo filter)

Uoti Urpala uoti.urpala at pp1.inet.fi
Wed Nov 1 21:42:35 CET 2006


On Wed, 2006-11-01 at 11:47 -0800, Trent Piepho wrote:
> > > How could accumulator be in two different memory locations?
> >
> > an opimizing compiler can make a copy, for example it could copy it to
> > the stack, gcc may or may not be capable of that but that doesnt matter
> > for the validity of the code ...
> 
> It isn't allowed do that.  If it did, it would be impossible to write
> atomic operations.  There would be no way to write something like a
> spin-lock.

It is allowed to do that. There is a way to write a spinlock: use the
"volatile" keyword.

> Linus is saying allow "+m"(x) constraints by making them the same as
> "=m"(x):"m"(x).  He's not saying gcc should be able to copy variables in
> and out of a temporary memory location for asm constructs.  In fact, he
> specificly says something like "=m"(x) :  "0"(y) that would require two
> different variables to be in the same place in memory shouldn't be allowed.

So he says a construct that would *require* the variables to be in
different locations shouldn't be allowed. That was nothing whatsoever to
do with whether the compiler is *allowed* to keep copies in multiple
locations.




More information about the MPlayer-dev-eng mailing list