[FFmpeg-devel] r9017 breaks WMA decoding on Intel Macs

Zuxy Meng zuxy.meng
Tue May 29 13:44:02 CEST 2007


Hi,

2007/5/29, Guillaume POIRIER <poirierg at gmail.com>:
> Hi,
>
> On 5/29/07, Zuxy Meng <zuxy.meng at gmail.com> wrote:
> > Hi,
> >
> > 2007/5/29, Guillaume Poirier <gpoirier at mplayerhq.hu>:
> > > Hi folks,
> > > Le 28 mai 07 ? 01:26, Trent Piepho a ?crit :
> > >
> > > > On Mon, 28 May 2007, Guillaume POIRIER wrote:
> > > >> On 5/28/07, Trent Piepho <xyzzy at speakeasy.org> wrote:
> > > >>> On Sun, 27 May 2007, Guillaume POIRIER wrote:
> > > >> When I do this change, and this change alone (no "m" to "r"
> > > >> contrain),
> > > >> it doesn't assemble either.
> > > >
> > > > In general you can write:
> > > >  int x, foo[16];
> > > >  asm("mov 4+%1, %0" : "r"(x) : "m"(foo[4]));
> > > >
> > > > Or you can write this:
> > > >  int x, foo[16];
> > > >  asm("mov 4(%1), %0" : "r"(x) : "r"(foo + 4));
> > > >  asm("mov 4(%1), %0" : "r"(x) : "r"(&foo[4]));  // same as previous
> > > > line
> > > >
> > > > The first form, with "4+%1" is better.  It can result in more
> > > > efficient
> > > > code, and is some cases use one less register, which can be very
> > > > important.
> > > >
> > > > Both ways of writing this are slightly broken though.  If you also
> > > > touch
> > > > foo from some C code, the optimizer could produce incorrect code.
> > > > This
> > > > is better:
> > > >  int x, foo[16];
> > > >  asm("mov %2, %0" : "r"(x) : "m"(foo[4]), "m"(foo[4+1]));
> > > >
> > > > I'm attaching a patch showing the right way to do.
> > >
> > > Ok, I get the idea. Inline asm is pretty much black magic to me.
> > >
> > > Your patch doesn't work, as it doesn't even assemble, but attached
> > > corrected patch does fix the problem.
> > >
> > > Zuxy, Michael, what do you think about it?
> > > Note that I did try to putting all asm blocks of fft_sse.c as "asm
> > > volatile" but that didn't fix the problem alone.
> >
> > It looks good to me, but is the "asm" -> "asm volatile" part
> > absolutely necessary?
>
> Don't know. This sure can be tested. I'd like to point out that every
> ASM block in lavc is declared as "asm volatile", except in fft_sse.c.
> Why is that? Why would you want them to be left as non-volatile?
>
> Won't GCC try to outsmart us sooner or later and break your beautiful
> little ASM blocks? ;-)

OK then keep the volatile if Loren doesn't object (he rewrote fft_sse
with inline asm IIRC) :-)
-- 
Zuxy
Beauty is truth,
While truth is beauty.
PGP KeyID: E8555ED6




More information about the ffmpeg-devel mailing list