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

Janne Grunau janne-vlc at jannau.net
Sun Nov 27 23:16:38 CET 2016


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 used.
> > > 
> > > The ARM assembler code does not rely on unwarranted C compiler behaviour
> > > AFAICT.
> > 
> > neither does the x86 yasm asm
> 
> AFAICT, if the calling code does not rely on UB, then this function should 
> have no useful effects. So something is very wrong here, even if this patch 
> 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 itself.  
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 complete 
picture is processed. This patch doesn't change any of that. It adds the 
external asm to replace several inline asm functions doing the same.

Janne


More information about the vlc-devel mailing list