[FFmpeg-devel] fate : clang x86

Alexander Strange astrange
Tue Aug 31 00:32:25 CEST 2010


On Aug 23, 2010, at 6:57 PM, M?ns Rullg?rd wrote:

> Eli Friedman <eli.friedman at gmail.com> writes:
> 
>> 2010/8/21 M?ns Rullg?rd <mans at mansr.com>:
>>> Eli Friedman <eli.friedman at gmail.com> writes:
>>> 
>>>> 2010/8/21 M?ns Rullg?rd <mans at mansr.com>:
>>>>> castet.matthieu at free.fr writes:
>>>>> 
>>>>>> Hi,
>>>>>> 
>>>>>> on freebsd "-mllvm -regalloc=fast" cflags are used to make clang/llvm accept
>>>>>> some inline asm.
>>>>>> 
>>>>>> May be we should do the same on linux ?
>>>>> 
>>>>> I tried and failed to figure out what that flag does.  I assume it
>>>>> does something with the register allocator, but I'd like to know what.
>>>> 
>>>> It's a workaround of sorts for
>>>> http://llvm.org/bugs/show_bug.cgi?id=4668 .  LLVM essentially has two
>>>> register allocator implementations: one is the "fast" allocator, which
>>>> is a local register allocator used for -O0, and the other is the
>>>> "linear scan" allocator, which is the slower global register allocator
>>>> used for -O1+.  "-mllvm -regalloc=fast" forces the use of the "fast"
>>>> allocator, which leads to slower generated code, but isn't affected by
>>>> the bug in question.
>>> 
>>> Sounds like it's not suitable for production use.  Any chance they'll
>>> fix the bug?
>> 
>> In the near future?  Not very likely... from what I understand, it's a
>> relatively difficult issue to solve, and bugs rejecting valid inline
>> asm are generally considered low priority for the people who know the
>> register allocator well enough to fix this.
> 
> That leaves two options:
> 
> 1. Declare clang officially unsupported for x86_32.
> 2. Fix our code.

For reference, this is the error:

fatal error: error in backend: Ran out of registers during register allocation!
Please check your inline asm statement for invalid constraints:
INLINEASM <es:movd %eax, %xmm3              
	pshuflw $$0, %xmm3, %xmm3       
	punpcklwd %xmm3, %xmm3         
	pxor %xmm7, %xmm7                  
	pxor %xmm4, %xmm4                  
	movdqa ($2), %xmm5                   
	pxor %xmm6, %xmm6                  
	psubw ($3), %xmm6                  
	mov $$-128, %eax               
	.p2align 4
	1:                                 
	movdqa ($1, %eax), %xmm0        
	movdqa %xmm0, %xmm1            
	pabsw  %xmm0, %xmm0            
	psubusw %xmm6, %xmm0               
	pmulhw %xmm5, %xmm0                
	por %xmm0, %xmm4                   
	psignw %xmm1, %xmm0            
	movdqa %xmm0, ($5, %eax)        
	pcmpeqw %xmm7, %xmm0               
	movdqa ($4, %eax), %xmm1        
	movdqa %xmm7, ($1, %eax)        
	pandn %xmm1, %xmm0                 
	pmaxsw %xmm0, %xmm3     
	add $$16, %eax      
	 js 1b                             
	movhlps %xmm3, %xmm0           
	pmaxsw %xmm0, %xmm3     
	pshuflw $$0x0E, %xmm3, %xmm0    
	pmaxsw %xmm0, %xmm3     
	pshuflw $$0x01, %xmm3, %xmm0    
	pmaxsw %xmm0, %xmm3     
	movd %xmm3, %eax              
	movzb %al, %eax              
	>, 0, 10, %EAX<imp-def>, 9, %reg1309<kill>, 9, %reg1317, 9, %reg1305<kill>, 9, %reg1312<kill>, 9, %reg1310<kill>, 2147483657, %EAX, 14, %EFLAGS<earlyclobber,imp-def,dead>, <!-1>; GR32:%reg1309,1317,1305,1312,1310 dbg:libavcodec/x86/mpegvideo_mmx_template.c:152:9

It only happens (on Darwin x86-32 at least) without -fomit-frame-pointer, which is already not the default configuration. How are they building it?




More information about the ffmpeg-devel mailing list