-maltivec (-qaltivec)

Pragma equivalent

None.

Purpose

Enables the compiler support for vector data types and operators.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-no--altivec-.   
>>- -m--+-altivec-----+----------------------------------------><

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

Defaults

By default, -mno-altivec or -qnoaltivec is effective. Specifying -maltivec is equivalent to specifying -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 or -qaltivec option has effect only when you set or imply -mcpu to be an architecture that supports vector instructions. Otherwise, the compiler ignores -maltivec or -qaltivec and issues a warning message.

The -maltivec or -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_mergeh, vec_mergel, 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 or -qaltivec is in effect; otherwise, they are undefined.

__VEC_ELEMENT_REG_ORDER__ is defined to __ORDER_LITTLE_ENDIAN__ when -qaltivec=le (-maltivec) is in effect, or to __ORDER_BIG_ENDIAN__ when -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 -qaltivec=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