Vector data types

XL C/C++ V2R1M1 web deliverable for z/OS® 2.1 includes vector programming support, which provides an efficient and expressive mechanism for programmers to make use of the Vector Facility for z/Architecture® from the C and C++ programming languages. This section describes the supported vector data types.

In this syntax, type qualifiers and storage class specifiers can precede the keyword vector (or its alternative spelling, __vector) in a declaration. Most of the legal forms of the syntax are captured in the following diagram. Some variations have been omitted from the diagram for the sake of clarity: type qualifiers such as const and storage class specifiers such as static can appear in any order within the declaration, as long as neither immediately follows the keyword vector (or __vector).

Read syntax diagramSkip visual syntax diagram
Vector declaration syntax

   .-----------------------------.   
   V                             |   
>>---+-------------------------+-+------------------------------>
     +-type_qualifier----------+     
     '-storage_class_specifier-'     

>--+-vector---+-+-+-bool-----+--+-char-----------+-+-----------><
   '-__vector-' | +-signed---+  +-short--+-----+-+ |   
                | '-unsigned-'  |        '-int-' | |   
                |               +-int------------+ |   
                |               '-long long------' |   
                '-double---------------------------'   

Notes:
  1. The keyword vector is recognized in a declaration context only when used as a type specifier and when vector support is enabled. The keyword bool is recognized as a valid type specifier only when preceded by the keyword vector or __vector.
  2. Duplicate type specifiers are ignored in a vector declaration context.
  3. The vector double data type is only available with FLOAT(IEEE). The use of vector double without FLOAT(IEEE) would result in a syntax error on the declaration.
  4. The vector bool long long, vector signed long long, and vector unsigned long long data types are only available with LANGLVL(LONGLONG), which is implied by the VECTOR option.
The following table lists the supported vector data types, the size and possible values for each type.
Table 1. 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 (FALSE), 255 (TRUE)
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 (FALSE), 65535 (TRUE)
vector bool short int
vector unsigned int 4 unsigned int 0..232-1
vector signed int 4 signed int -231..231-1
vector bool int 4 unsigned int 0 (FALSE), 232-1 (TRUE)
vector unsigned long long 2 unsigned long long 0..264-1
vector signed long long 2 signed long long -263..263-1
vector bool long long 2 unsigned long long 0 (FALSE), 264-1 (TRUE)
vector double 2 double IEEE-754 double (64 bit) precision floating-point values

All vector types are aligned on an 8-byte boundary. An aggregate that contains one or more vector types is aligned on an 8-byte boundary, and padded, if necessary, so that each member of vector type is also 8-byte aligned.