[FFmpeg-devel] [PATCH] avfilter/vf_fspp.c: make the filter compile with latest LLVM

Michael Niedermayer michaelni at gmx.at
Thu Oct 31 23:06:59 CET 2013


On Thu, Oct 31, 2013 at 01:43:38PM -0700, Thierry Foucu wrote:
> On Thu, Oct 31, 2013 at 1:17 PM, Michael Niedermayer <michaelni at gmx.at>wrote:
> 
> > On Thu, Oct 31, 2013 at 12:16:55PM -0700, Thierry Foucu wrote:
> > > On Thu, Oct 31, 2013 at 12:09 PM, Reimar Döffinger <
> > Reimar.Doeffinger at gmx.de
> > > > wrote:
> > >
> > > > On Thu, Oct 31, 2013 at 11:53:22AM -0700, Thierry Foucu wrote:
> > > > > Make the vf_fspp code not use the incorrectly documented and
> > essentially
> > > > > compiler-internal inline assembly constraint "o" which simply does
> > not
> > > > work
> > > > > the way it was being used. Instead, pass explicit memory operands
> > out of
> > > > the
> > > > > array of temporaries. The compiler is smart enough to build them with
> > > > > immediate offsets of a common register address.
> > > > >
> > > > > In the process, remove 2 unused 8-byte temporaries from two
> > functions in
> > > > this
> > > > > filter. Doing this saves 16 bytes of stack space, and in row_idct_mmx
> > > > allows
> > > > > the use of simpler addressing modes (no offset from %rsp) which
> > saves 3
> > > > bytes
> > > > > of encoded instruction stream.
> > > > >
> > > > > Otherwise, this produces *exactly* the same assembly as the previous
> > > > version,
> > > > > but can be assembled by LLVM as well as GCC.
> > > >
> > > > Which gcc versions did you try with?
> > > >
> > >
> > > I tried with only one version of gcc "version 4.6.3"
> > >
> > > For LLVM, i used :
> > >
> > > clang version 3.4 (trunk 192869)
> > >
> > >
> > > Without this change, clang reports this type of errors:
> > >
> > > libavfilter/libmpcodecs/vf_fspp.c:1975:42: error: unknown token in
> > expression
> > >         "paddw %%mm4, %%mm1            \n\t"
> > >                                          ^
> > > <inline asm>:22:18: note: instantiated into assembly here
> > >         movq %mm5, 0*8+(%r12)
> > >                         ^
> > > libavfilter/libmpcodecs/vf_fspp.c:1978:42: error: unknown token in
> > expression
> > >         "punpcklbw %%mm7, %%mm3        \n\t"
> > >                                          ^
> > > <inline asm>:24:18: note: instantiated into assembly here
> > >         movq %mm6, 1*8+(%r12)
> > >
> >
> > just tried some compilers i had installed on my box (sadly there are
> > no old ones amongth them) but
> > clang version 3.1 (trunk 144800)
> > fails to build the new code with -m32 -O0 but succeeds with the old
> >
> 
> 
> damn.. i though it will be working fine. Sorry i could not test it against
> old version.
> 
> 
> >
> > /home/michael/ffmpeg-git/ffmpeg/libavfilter/libmpcodecs/vf_fspp.c:878:9:
> > error: ran out of registers during register allocation
> >         ".p2align " "4" "\n\t"
> >         ^
> > /home/michael/ffmpeg-git/ffmpeg/libavfilter/libmpcodecs/vf_fspp.c:878:9:
> > error: ran out of registers during register allocation
> > 3 warnings and 2 errors generated.
> >
> >
> 
> Any idea how we can resolve this problem?

using fewer operands should work
it would be possible to use a single register as pointer to the
temporary storage or to just make space on the stack in the asm
code or even convert the whole asm to yasm syntax which takes the
C compiler out of the equation


> 
> Could it be a bug in clang then?

its a question of how "bug" is defined anw how "valid" asm() is
defined.


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Freedom in capitalist society always remains about the same as it was in
ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131031/f982ae67/attachment.asc>


More information about the ffmpeg-devel mailing list