[vlc-devel] [PATCHv2 2/3] deinterlace: x86: add external asm emms function

Rémi Denis-Courmont remi at remlab.net
Mon Nov 28 12:31:27 CET 2016

On November 28, 2016 12:16:38 AM GMT+02:00, Janne Grunau <janne-vlc at jannau.net> wrote:
>On 2016-11-27 23:40:01 +0200, Rémi Denis-Courmont wrote:
>> Le sunnuntaina 27. marraskuuta 2016, 22.24.20 EET Janne Grunau a
>écrit :
>> > On 2016-11-27 23:17:22 +0200, Rémi Denis-Courmont wrote:
>> > > Le sunnuntaina 27. marraskuuta 2016, 21.55.44 EET Janne Grunau a
>écrit :
>> > > > On 2016-11-27 22:32:12 +0200, Rémi Denis-Courmont wrote:
>> > > > > Same problems as previous version, AFAICT.
>> > > > 
>> > > > which are?
>> > > > 
>> > > > emms is instruction/function without arguments and return value
>but side
>> > > > effects. So it will be used exactly in the it is supposed to be
>> > > 
>> > > The ARM assembler code does not rely on unwarranted C compiler
>> > > AFAICT.
>> > 
>> > neither does the x86 yasm asm
>> AFAICT, if the calling code does not rely on UB, then this function
>> have no useful effects. So something is very wrong here, even if this
>> proper does not strictly speaking rely on UB.
>It is out of scope of the C spec. The function is required to handled 
>defined behavior of x86 CPUs (explictly the implementation details of 
>the mmx/3dnow mm registers). The state of the FPU register file has to 
>be restored after using mm registers. So this function has the side 
>effect of cleaning up certain side effects of the earlier call to asm 
>functions which clobber the fpu register file.
>It would of course be nicer if the function could do the cleanup
>But since all the deinterlace asm functions handle only a single output
>line it is optimized away to do the cleanup only once after the
>picture is processed. This patch doesn't change any of that. It adds
>external asm to replace several inline asm functions doing the same.
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:

Err...  This is very much in scope of the hypothetical applicable architecture-specific ABI specification which ought to define the C calling convention.

I am no authority on x86, but I can hardly conceive a calling convention where this function would make sense of its own.
Rémi Denis-Courmont

More information about the vlc-devel mailing list