5.45.7 PowerPC AltiVec Built-in Functions

GCC provides an interface for the PowerPC family of processors to access
the AltiVec operations described in Motorola's AltiVec Programming
Interface Manual. The interface is made available by including
<altivec.h> and using -maltivec and
-mabi=altivec. The interface supports the following vector
types.

GCC's implementation of the high-level language interface available from
C and C++ code differs from Motorola's documentation in several ways.

A vector constant is a list of constant expressions within curly braces.

A vector initializer requires no cast if the vector constant is of the
same type as the variable it is initializing.

If signed or unsigned is omitted, the signedness of the
vector type is the default signedness of the base type. The default
varies depending on the operating system, so a portable program should
always specify the signedness.

Compiling with -maltivec adds keywords __vector,
__pixel, and __bool. Macros vector,
pixel, and bool are defined in <altivec.h> and can
be undefined.

GCC allows using a typedef name as the type specifier for a
vector type.

For C, overloaded functions are implemented with macros so the following
does not work:

vec_add ((vector signed int){1, 2, 3, 4}, foo);

Since vec_add is a macro, the vector constant in the example
is treated as four separate arguments. Wrap the entire argument in
parentheses for this to work.

Note: Only the <altivec.h> interface is supported.
Internally, GCC uses built-in functions to achieve the functionality in
the aforementioned header file, but they are not supported and are
subject to change without notice.

The following interfaces are supported for the generic and specific
AltiVec operations and the AltiVec predicates. In cases where there
is a direct mapping between generic and specific operations, only the
generic names are shown here, although the specific operations can also
be used.

Arguments that are documented as const int require literal
integral values within the range required for that operation.