[Mplayer-cvslog] CVS: main/libmpcodecs vf_ilpack.c,1.2,1.3
D Richard Felker III
dalias at aerifal.cx
Tue Dec 16 08:16:03 CET 2003
On Tue, Dec 16, 2003 at 12:48:39AM +0100, Michael Niedermayer wrote:
> Hi
>
> On Monday 15 December 2003 22:23, D Richard Felker III wrote:
> > On Mon, Dec 15, 2003 at 03:29:20PM +0100, Michael Niedermayer wrote:
> > > btw, ur asm code is wrong (it has undefined behavior)
> > >
> > > + "addl $16, %%esi \n\t"
> > > + "addl $8, %%eax \n\t"
> > > + "addl $8, %%ebx \n\t"
> > > [...]
> > > + "addl $32, %%edi \n\t"
> > > +
> > > + "decl %%ecx \n\t"
> > > [...]
> > > + :
> > > + : "S" (y), "D" (dst), "a" (u), "b" (v), "d" (&us), "c"
> > > (w/16) + : "memory"
> > > + );
> > >
> > > this modifies read only operands
> >
> > Could you explain how to do it correctly, then? I tried also putting
> > them in the output section, but then gcc complains that I'm using >10
> > registers.
> that would be the correct way, if gcc wouldnt suck
:(
> > Also, what's the correct thing to do if you want to modify
> > a register but throw away the value after you're done? Do you have to
> > create dummy variables and tell gcc to output into them?
> yes, if u modify something it must either be on the output list or the clobber
> list or u have to save & restore it, or hope/know that gcc doesnt/cant use it
> like the mmx registers
> at that point u probably try to put an input on the clobber list like
> :
> : "a"(y)
> : "%eax"
> but clobbered inputs arent legal (no i dunno why)
"memory" in the clobberlist means all registers are clobbered. Except
apparently the ones used for input or output. :(
> that combined with gccs randomized inability to compile asm statements makes
> writing them an art sometimes :)
>
> possible solutons are:
> push pop all changed register
This would be ok.
> replace w/16 by some end poiner and compare against that (1 changed reg less)
The fact that w/16 gets clobbered doesn't matter, since it will never
be used again. On the other hand, clobbering the pointers _does_
matter, and I depend on gcc continuing to use my changed values after
the asm block exits (when calling the C function for the remainder).
> use complex addressing and an index like ... (%%eax, %%ebx, 2) ; incl %%ebx
Already out of registers.
> reorder ur data so u need fewer pointers
Not possible; the code has to work with what it's given. Otherwise
it'll be so slow you might as well use the C code.
> fork gcc
gcc sux too much. Rewrite from scratch if there wasn't better stuff to
do...
> just ignore it and hope it doesnt break
I like this option... :))
BTW, I know one other solution.
+ : "=S" (y) "=D" (dst), "=a" (u), "=b" (v)
+ : "S" (&dst)
+ : "memory"
+ );
Then use the address of dst on the stack to load all the other inputs
once the asm begins. Yes, gcc really sucks.....
Rich
More information about the MPlayer-cvslog
mailing list