Vector built-in functions

Individual elements of vectors can be accessed by using the Vector Multimedia Extension (VMX) or the Vector Scalar Extension (VSX) built-in functions. This section provides an alphabetical reference to the VMX and the VSX built-in functions. You can use these functions to manipulate vectors.

You must specify appropriate compiler options for your architecture when you use the built-in functions. Built-in functions that use or return a vector unsigned long long, vector signed long long, vector bool long long, or vector double type require an architecture that supports the VSX instruction set extensions, such as POWER7. You must specify an appropriate -mcpu suboption, such as -mcpu=power7, when you use these types.

Function syntax

This section uses pseudocode description to represent function syntax, as shown below:

d=func_name(a, b, c)
In the description,
  • d represents the return value of the function.
  • a, b, and c represent the arguments of the function.
  • func_name is the name of the function.

For example, the syntax for the function vector double vec_xld2(int, double*); is represented by d=vec_xld2(a, b).

Note:
  • This section only describes the IBM specific vector built-in functions and the AltiVec built-in functions with IBM extensions. For information about the other AltiVec built-in functions, see the AltiVec Application Programming Interface specification.
  • To use the built-in functions, you must specify the -maltivec option and include the altivec.h file.