[vlc-devel] [PATCH] configure: Fix illegal instructions on PPC when --enable-altivec used

Lennart Sorensen lsorense at csclub.uwaterloo.ca
Tue Nov 8 22:29:25 CET 2016


On Tue, Nov 08, 2016 at 10:59:10PM +0200, Rémi Denis-Courmont wrote:
> Le tiistaina 8. marraskuuta 2016, 15.48.12 EET Lennart Sorensen a écrit :
> > From: Len Sorensen <lsorense at csclub.uwaterloo.ca>
> > 
> > When --enable-altivec is used on powerpc, -maltivec is passed to gcc
> > along with -O4.  When -O3 or higher is used along with -maltivec, gcc
> > enabled -ftree-vectorize, which generates vector instructions from C
> > code.
> 
> Hmm well, as far as I can tell, there are no warranties that disabling tree 
> vectorization will disable emission of Altivec opcodes. It is just the most 
> obvious use case.

Unfortunately it seems the way altivec is done with compilers they did
not seem to make it possible to have optional code using altivec with
a cpu check around it easily.

> It would not be unheard of for the compiler to employ SIMD instructions for 
> single (useful) data operations. It is definitely supported on some 
> architectures.
> 
> So it seems to me that this is just moving the problem (again). Instead, -
> matltivec should not be passed at all. Depending on the case, that might 
> involve:
> - building Altivec functions in a separate static library,

That would seem good.

> - passing -maltivec only to the assembler,

It has to be passed to the c compiler allow use of the C vector functions
on powerpc.  Without -maltivec you can not #include <vector.h>.  The need
for that header file seems to be a huge part of the hassle.  This is
not done with inline assembly.

> - using the target function attribute (like VLC_SSE and VLC_MMX).

Well for ibi420_yuy2_altivec that is already the case.  It is built as
an independant module.  That one is done nicely, at least once the leak
into CPPFLAGS of -maltivec was dealt with.

For libdeinterlace on the other hand, the function is part of the main
library, and I was not up for the task of splitting it out, especially
since automake does not support specific CFLAGS for one object file,
only per link target.

I do think it would be safer long term to somehow split out the
AltivecMerge function from libdeinterlace so that it can be compiled
with -maltivec while nothing else in that library was.

-- 
Len Sorensen


More information about the vlc-devel mailing list