This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Don't #error if including <altivec.h> without -maltivec
Declarations. It's a good way to make sure that, although some source
code uses some AltiVec data types and/or PIM functions, the generated
object code will not contain any AltiVec instructions.
I actually have some code like that, and it breaks with TOT compiler.
Can you give me an example? I still can't quite picture what you
mean. :-)
Something like:
#include <altivec.h>
union { vector int v; int i[4]; } convert;
... and never use it in vector mode.
For example, this is useful if you're compiling code that should work
whether or not AltiVec is available at run-time.
It's also useful for testcases.
And for specialized code that depends on the property that GCC will not
use AltiVec instructions (and, as such, will not touch any of the vector
registers).
The documented meaning of -maltivec is: allow the compiler to generate
AltiVec instructions -- and nothing more. The fact that my patch
"breaks"
C++ just means that C++ already was broken ;-)
Segher