[x264-devel] Failure to build x264 with ASM on i386

Dimitry Andric dimitry at andric.com
Mon Feb 3 22:48:06 CET 2014


On 03 Feb 2014, at 18:39, Loren Merritt <lorenm at u.washington.edu> wrote:
...
> Otoh, gcc works with -fPIC. I can confirm that 5 registers is enough for
> the inline asm blocks in question. If clang thinks they need more than 5
> registers, that's a bug in clang's register allocator.

No, gcc uses 7 registers.  For example, with -fPIC and gcc 4.8, the
allocation for x264_predictor_clip_mmx2() is as follows:

%0 = %eax
%1 = %edx
%2 = %ecx
%4 = %ebp
%5 = %esi
%6 = %edi
%7 = %ebx

The reason is that gcc assumes a 16 byte stack alignment on i386, which
is only valid for Linux after ~2006, not most BSDs.  If you force gcc to
assume a 4 byte stack alignment, it also cannot compile the inline
assembly:

gcc48 -Wshadow -O3 -ffast-math -m32  -Wall -I. -I/share/dim/src/x264 -march=i686 -mfpmath=sse -msse -std=gnu99 -mpreferred-stack-boundary=2 -fPIC -fomit-frame-pointer -fno-tree-vectorize   -c -o encoder/me.o /share/dim/src/x264/encoder/me.c
In file included from /share/dim/src/x264/common/common.h:1014:0,
                 from /share/dim/src/x264/encoder/me.c:28:
/share/dim/src/x264/encoder/me.c: In function 'x264_me_search_ref':
/share/dim/src/x264/common/x86/util.h:130:5: error: 'asm' operand has impossible constraints
     asm(
     ^
/share/dim/src/x264/common/x86/util.h:193:5: error: 'asm' operand has impossible constraints
     asm(
     ^

For the BSDs, this is actually a bug in gcc. :-)

-Dimitry

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 203 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mailman.videolan.org/pipermail/x264-devel/attachments/20140203/fd9eea2c/attachment.sig>


More information about the x264-devel mailing list