-maltivec (-qaltivec)

Pragma equivalent

None.

Purpose

Enables the compiler support for vector data types and operators.

Syntax

Read syntax diagramSkip visual syntax diagram
                   .-=le-.     
        .-altivec--+-=be-+-.   
>>- -m--+-noaltivec--------+-----------------------------------><

Read syntax diagramSkip visual syntax diagram
                   .-=le-.     
        .-altivec--+-=be-+-.   
>>- -q--+-noaltivec--------+-----------------------------------><

Defaults

-maltivec=le(-qaltivec=le)

Parameters

be
Specifies big endian element order. Vectors are laid out in vector registers from left to right, so that element 0 is the leftmost element in the register.
le
Specifies little endian element order. Vectors are laid out in vector registers from right to left, so that element 0 is the rightmost element in the register.

Usage

The -maltivec (-qaltivec) option takes effect only when you include the altivec.h file and set or imply -mcpu to be an architecture that supports vector instructions. Otherwise, the compiler ignores -maltivec (-qaltivec) and issues a warning message.

The -maltivec (-qaltivec) option affects the following categories of functions:
  • Vector Multimedia Extension (VMX) load and store built-in functions
  • Vector Scalar Extension (VSX) load and store built-in functions
  • The nonload and nonstore built-in functions referring to the vector element order
The following list shows all the functions affected:
  • Load functions
    • VMX load functions: vec_ld
    • VSX load functions: vec_xld2, vec_xlw4, and vec_xl
  • Store functions
    • VMX store functions: vec_st
    • VSX store functions: vec_xstd2, vec_xstw4, and vec_xst
  • Nonload and nonstore functions: __vpermxor, vec_extract, vec_insert, vec_mergee, vec_mergeh, vec_mergel, vec_mergeo, vec_pack, vec_perm, vec_promote, vec_splat, vec_unpackh, and vec_unpackl

Predefined macros

__ALTIVEC__ is defined to 1 and __VEC__ is defined to 10206 when -maltivec (-qaltivec) is in effect; otherwise, they are undefined.

__VEC_ELEMENT_REG_ORDER__ is defined to __ORDER_LITTLE_ENDIAN__ when -maltivec=le (-qaltivec=le) is in effect, or to __ORDER_BIG_ENDIAN__ when -maltivec=be (-qaltivec=be) is in effect.

Examples

  • To enable compiler support for vector programming, enter the following command:
    xlc myprogram.c -mcpu=pwr8 -maltivec
  • To change the vector element sequence to big endian element order in registers, enter the following command:
    xlc myprogram.c -maltivec=be


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us