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

Rémi Denis-Courmont remi at remlab.net
Tue Dec 6 21:07:51 CET 2016


Le mardi 6 décembre 2016, 20:43:53 Janne Grunau a écrit :
> > 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.
> 
> the emms instruction has the global/CPU 'side effect' of restoring the
> state of the fpu register file after using mmx instructions. So we call
> the this function/instruction entirely for the side effect. I don't see
> what would forbid 'void func(void)' with side effects.

I don't think I ever stated that a valid void(*)(void) could not have side 
effects. Obviously such a function could modify global variables or static 
variables within its own module, or memory directly or indirectly pointed by 
any such variable, for one thing.

> There are
> sequence points between the functions clobbering the fpu register file
> status and vlcpriv_emms_ext_asm.

And? If the calling convention allows the clobber, then the emms function is 
useless. If it does not, then the call site is UB and the function is 
therefore also useless.

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list