[FFmpeg-devel] Patch: Inline asm fixes for Intel compiler on Windows
Ronald S. Bultje
rsbultje at gmail.com
Sun Feb 9 15:20:08 CET 2014
Hi,
On Sat, Feb 8, 2014 at 10:02 AM, Matt Oliver <protogonoi at gmail.com> wrote:
> On 8 February 2014 20:25, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
> > Matt Oliver <protogonoi <at> gmail.com> writes:
> > > diff --git a/libavcodec/x86/vp56_arith.h b/libavcodec/x86/vp56_arith.h
> > > index e71dbf8..ba01412 100644
> > > --- a/libavcodec/x86/vp56_arith.h
> > > +++ b/libavcodec/x86/vp56_arith.h
> > > @@ -24,7 +24,13 @@
> > > #ifndef AVCODEC_X86_VP56_ARITH_H
> > > #define AVCODEC_X86_VP56_ARITH_H
> > >
> > > +#if (defined(__INTEL_COMPILER) && defined(_MSC_VER) && ARCH_X86_64)
> > > +# define BROKEN_REGISTER_ALLOCATION 1
> > > +#else
> > > +# define BROKEN_REGISTER_ALLOCATION 0
> > > +#endif
> >
> > If not, I think you should try to avoid the duplication.
> > Are they really different (ARCH_X86_64)?
>
> Intel compiler is really temperamental when it comes to inline asm. The
> code works fine in 32bit but fails miserably in 64bit. The asm assembler
> doesnt handle the leal instruction properly and uses the wrong register
> type (i.e. 32/64bit) and then generates an error about mismatching register
> types. This doesnt happen in 32 bit because all registers are 32 bit and
> its fine but in 64 bit it seems to mix and match between using 32b/64b
> registers for variables passed through the asm interface and then errors. I
> tried finding a way around it but short of explicitly loading in the
> variables and managing the registers manually there is no way to fix it
> (its just an Intel bug). And I was trying to minimise code impact which is
> why I didnt do that (and the generated code on other platforms may take a
> slight hit). Strangely it only happens on the leal instruction and so far
> only that lea instruction. It seems to be because all 3 inputs in that
> instruction are interface variables and that is what is throwing the
> compiler for a loop.
I'm not going to argue against this being an icl bug, but I'm surprised you
can't come up with a concept that works. Doesn't something like "leal (%l2,
%l3), %l3" work? Also, which one does it convert to 64bit?
Let's not workaround bugs by adding more bugs. Let's fix bugs.
Ronald
More information about the ffmpeg-devel
mailing list