[MPlayer-dev-eng] Improved remove-logo filter
Uoti Urpala
uoti.urpala at pp1.inet.fi
Sun Nov 5 23:57:46 CET 2006
On Sun, 2006-11-05 at 13:37 -0800, Trent Piepho wrote:
> On Sun, 5 Nov 2006, Michael Niedermayer wrote:
> > and copying variables onto the stack can improve speed alot, gcc svn does
> > this according to uoti, maybe violating your dont copy constraint?
>
> It sounded to me like what Uoti found was an asm construct that modified a
> variable through a pointer with out telling gcc about it. Something like:
>
> int x, *p = x;
> asm("movl $0, (%0)" : : "r"(p));
>
> Of course something like that will not work, because gcc doesn't know the
> value of x has changed.
The construct was similar to that, but there were no free registers in
which gcc could keep anything extra during the asm, and there was no
optimization gcc could do based on just "it must be the same as last
time". It failed because gcc made a copy of the variable *on the stack*.
For an example where this obviously makes sense consider a chain of
pointers like a->b->c->d->e->f used in several places in the code. The
final value of f is a common subexpression; even if it cannot fit in a
register it makes a lot more sense to make a copy of it on the stack
than to go through the whole chain every time the value is accessed.
> It needs "memory" on the clobber list, or better
> yet, "=m"(x) as an output.
... except that if "=m" cannot point to an alias of the variable, your
"better" alternative is a bad idea since it requires allocating a
register to hold &x unless x is a stack variable or similar that can be
accessed without needing an explicit pointer.
> If svn gcc can provide "=m" constraints with copies of variables, I'd like
> to see an example.
I don't know whether current gcc can do that with an asm output
variable. However if it currently can't the functionality might be a
desirable feature.
> And ask the gcc devs WTF one is supposed to do to write
> a spin-lock.
I've already explained this exact thing TWICE. Are you retarted or what?
If you need side effects which don't directly affect the current thread
to happen then you must specify "volatile". This is true even for plain
C, without any asm whatsoever.
More information about the MPlayer-dev-eng
mailing list