[Mplayer-cvslog] CVS: main/libmpcodecs vf_ilpack.c,1.2,1.3

Michael Niedermayer michaelni at gmx.at
Tue Dec 16 00:48:39 CET 2003


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)

that combined with gccs randomized inability to compile asm statements makes 
writing them an art sometimes :)

possible solutons are:
push pop all changed register 
replace w/16 by some end poiner and compare against that (1 changed reg less)
use complex addressing and an index like ... (%%eax, %%ebx, 2) ; incl %%ebx
reorder ur data so u need fewer pointers
fork gcc
just ignore it and hope it doesnt break
...

[...]
-- 
Michael
level[i]= get_vlc(); i+=get_vlc();		(violates patent EP0266049)
median(mv[y-1][x], mv[y][x-1], mv[y+1][x+1]);	(violates patent #5,905,535)
buf[i]= qp - buf[i-1];				(violates patent #?)
for more examples, see http://mplayerhq.hu/~michael/patent.html
stop it, see http://petition.eurolinux.org & http://petition.ffii.org/eubsa/en



More information about the MPlayer-cvslog mailing list