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

Trent Piepho xyzzy
Tue May 29 17:55:44 CEST 2007


On Tue, 29 May 2007, Zuxy Meng wrote:
> 2007/5/29, Guillaume Poirier <gpoirier at mplayerhq.hu>:
> > > 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:
> > >>>> On 5/27/07, Zuxy Meng <zuxy.meng at gmail.com> wrote:
> > >>>>> 2007/5/27, Guillaume Poirier <gpoirier at mplayerhq.hu>:
> > >>>>
> > >>>>> Then please check things like "8+%0" "-16+%1", replace constraints
> > >>>>> from "m" to "r" and rewrite using "8(%0)" "-16(%1)". Maybe Apple's
> > >>>>> binutils doesn't like such syntax.
> > >>>>
> > >>>> I guess I suck at doing such things too. Attached patch is an
> > >>>> attempt
> > >>>> to do what you suggest, be it doesn't assemble, either on Linux
> > >>>> x86-64
> > >>>> or OSX x86
> > >>>
> > >>> When you change from "m" to "r" you're also changing from the
> > >>> lvalue itself
> > >>> to a pointer to the lvalue.
> > >>>
> > >>> This results in less efficient code, since you preclude using SIB
> > >>> addressing and might need an extra register.  If the apple
> > >>> version of gas
> > >>> doesn't like the syntax, it should generate an error.
> > >>
> > >>
> > >> The said syntax seems to be supported, since there's no error
> > >> reported. Trent, you mean that it shouldn't be necessary to replace
> > >> "8+%0" "-16+%1", to "8(%0)" "-16(%1)" ?
> > > 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.

Opps, left in an extra comma.

> > 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?

If an asm block has no unknown side effects, volatile shouldn't be
necessary.  In this case, the asm blocks modify sse registers and gcc
doesn't know about that.

float x[4] = {1}, y[4];
asm("movaps %0, %%xmm0" : : "m"(x[0]) :);
asm("movaps %%xmm0, %0" : "m"(y[0]) : :);

As far as gcc can tell, those two asm statements can go in either order.





More information about the ffmpeg-devel mailing list