Appendix C. AltiVec Data Types and Literals

This appendix presents the supported AltiVec data types and literals, which are supersets of those needed for strict conformance with the AltiVec specification.


Vector Data Types

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

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

Note:
§ The AltiVec specification has deprecated long vector types.

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


Vector Literals

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

Syntax Interpreted by the compiler as
(vector unsigned char)(unsigned int) A set of 16 unsigned constants with a value specified by the integer constant expression.
(vector unsigned char)(unsigned int, ..., unsigned int) A set of 16 unsigned constants with a value specified by the 16 integer constant expressions.
(vector signed char)(int) A set of 16 signed constants with a value specified by the integer constant expression.
(vector signed char)(int, ..., int) A set of 16 signed constants with a value specified by the 16 integer constant expressions.
(vector bool char)(unsigned int)§ A set of 16 unsigned constants with a value specified by the integer constant expression.
(vector bool char)(unsigned int, ..., unsigned int)§ A set of 16 unsigned constants with a value specified by the 16 integer constant expressions.
(vector unsigned short)(unsigned int) A set of 8 unsigned constants with a value specified by the integer constant expression.
(vector unsigned short)(unsigned int, ..., unsigned int) A set of 8 unsigned constants with a value specified by the 8 integer constant expressions.
(vector signed short)(int) A set of 8 signed constants with a value specified by the integer constant expression.
(vector signed short)(int, ..., int) A set of 8 signed constants with a value specified by the 8 integer constant expressions.
(vector bool short)(unsigned int)§ A set of 8 unsigned constants with a value specified by the integer constant expression.
(vector bool short)(unsigned int, ..., unsigned int)§ A set of 8 unsigned constants with a value specified by the 8 integer constant expressions.
(vector unsigned int)(unsigned int) A set of 4 unsigned constants with a value specified by the integer constant expression.
(vector unsigned int)(unsigned int, ..., unsigned int) A set of 4 unsigned constants with a value specified by the 4 integer constant expressions.
(vector signed int)(int) A set of 4 signed constants with a value specified by the integer constant expression.
(vector signed int)(int, ..., int) A set of 4 signed constants with a value specified by the 4 integer constant expressions.
(vector bool int)(unsigned int)§ A set of 4 unsigned constants with a value specified by the integer constant expression.
(vector bool int)(unsigned int, ..., unsigned int)§ A set of 4 unsigned constants with a value specified by the 4 integer constant expressions.
(vector float)(float) A set of 4 floating-point constants with a value specified by the floating-point constant expression.
(vector float)(float, float, float, float) A set of 4 floating-point constants with a value specified by the 4 floating-point constant expressions.
(vector pixel)(unsigned int)§ A set of 8 unsigned constants with a value specified by the integer constant expression.
(vector pixel)(unsigned int, ..., unsigned int)§ A set of 8 unsigned constants with a value specified by the 8 integer constant expressions.
Note:
§ Denotes extension to the AltiVec programming interface.
IBM Copyright 2003