Appendix C. Vector data types and literals

This appendix presents the supported vector data types and literals. Note that these types are only recognized when all of the following compiler options are enabled:

  1. -qarch=ppc970
  2. -qenablevmx
  3. -qaltivec

The following table lists the supported vector data types and the size and possible values for each type.

Table 44. Vector data types
Type Interpretation of content Range of values
vector unsigned char 16 unsigned char 0..255
vector signed char 16 signed char -128..127
vector bool char 16 unsigned char 0, 255
vector unsigned short 8 unsigned short 0..65535
vector unsigned short int
vector signed short 8 signed short -32768..32767
vector signed short int
vector bool short 8 unsigned short 0, 65535
vector bool short int
vector unsigned int 4 unsigned int 0..232-1
vector unsigned long
vector unsigned long int
vector signed int 4 signed int -231..231-1
vector signed long
vector signed long int
vector bool int 4 unsigned int 0, 232-1
vector bool long
vector bool long int
vector float 4 float IEEE-754 values
vector pixel 8 unsigned short 1/5/5/5 pixel

The compiler considers any long vector data type compatible with the corresponding int vector type.

Note:
§ The long vector types are deprecated.

The following table shows the supported vector literals and how the compiler interprets them to determine their values.

Table 45. Vector literals
Syntax Interpreted by the compiler as
(vector unsigned char)(single unsigned int value) A set of 16 unsigned constants with a value specified by the integer constant expression.
(vector unsigned char)(unsigned int value, ..., unsigned int value) A set of 16 unsigned constants with a value specified by the 16 integer constant expressions.
(vector signed char)(single int value) A set of 16 signed constants with a value specified by the integer constant expression.
(vector signed char)(int value, ..., int value) A set of 16 signed constants with a value specified by the 16 integer constant expressions.
(vector bool char)(single unsigned int) A set of 16 unsigned constants with a value specified by the integer constant expression.
(vector bool char)(unsigned int value, ..., unsigned int value) A set of 16 unsigned constants with a value specified by the 16 integer constant expressions.
(vector unsigned short)(single unsigned int value) A set of 8 unsigned constants with a value specified by the integer constant expression.
(vector unsigned short)(unsigned int value, ..., unsigned int value) A set of 8 unsigned constants with a value specified by the 8 integer constant expressions.
(vector signed short)(single int value) A set of 8 signed constants with a value specified by the integer constant expression.
(vector signed short)(int value, ..., int value) A set of 8 signed constants with a value specified by the 8 integer constant expressions.
(vector bool short)(single unsigned int value) A set of 8 unsigned constants with a value specified by the integer constant expression.
(vector bool short)(unsigned int value, ..., unsigned int value) A set of 8 unsigned constants with a value specified by the 8 integer constant expressions.
(vector unsigned int)(single unsigned int value) A set of 4 unsigned constants with a value specified by the integer constant expression.
(vector unsigned int)(unsigned int value, ..., unsigned int value) A set of 4 unsigned constants with a value specified by the 4 integer constant expressions.
(vector signed int)(single int value) A set of 4 signed constants with a value specified by the integer constant expression.
(vector signed int)(int value, ..., int value) A set of 4 signed constants with a value specified by the 4 integer constant expressions.
(vector bool int)(single unsigned int value) A set of 4 unsigned constants with a value specified by the integer constant expression.
(vector bool int)(unsigned int value, ..., unsigned int value) A set of 4 unsigned constants with a value specified by the 4 integer constant expressions.
(vector float)(single float value) A set of 4 floating-point constants with a value specified by the floating-point constant expression.
(vector float)(float value, ... float value) A set of 4 floating-point constants with a value specified by the 4 floating-point constant expressions.
(vector pixel)(single unsigned int value) A set of 8 unsigned constants with a value specified by the integer constant expression.
(vector pixel)(unsigned int value, ..., unsigned int value) A set of 8 unsigned constants with a value specified by the 8 integer constant expressions.