6.65.25 PowerPC AltiVec/VSX Built-in Functions

GCC provides an interface for the PowerPC family of processors to access the AltiVec operations described in Motorola’s AltiVec Programming Interface Manual. The interface is made available by including <altivec.h> and using -maltivec and -mabi=altivec. The interface supports the following vector types.

vector unsigned char
vector signed char
vector bool char

vector unsigned short
vector signed short
vector bool short
vector pixel

vector unsigned int
vector signed int
vector bool int
vector float

GCC’s implementation of the high-level language interface available from C and C++ code differs from Motorola’s documentation in several ways.

Note: Only the <altivec.h> interface is supported. Internally, GCC uses built-in functions to achieve the functionality in the aforementioned header file, but they are not supported and are subject to change without notice.

GCC complies with the Power Vector Intrinsic Programming Reference (PVIPR), which may be found at https://openpowerfoundation.org/?resource_lib=power-vector-intrinsic-programming-reference. Chapter 4 of this document fully documents the vector API interfaces that must be provided by compliant compilers. Programmers should preferentially use the interfaces described therein. However, historically GCC has provided additional interfaces for access to vector instructions. These are briefly described below. Where the PVIPR provides a portable interface, other functions in GCC that provide the same capabilities should be considered deprecated.

The PVIPR documents the following overloaded functions:

vec_absvec_absdvec_abss
vec_addvec_addcvec_adde
vec_addecvec_addsvec_all_eq
vec_all_gevec_all_gtvec_all_in
vec_all_levec_all_ltvec_all_nan
vec_all_nevec_all_ngevec_all_ngt
vec_all_nlevec_all_nltvec_all_numeric
vec_andvec_andcvec_any_eq
vec_any_gevec_any_gtvec_any_le
vec_any_ltvec_any_nanvec_any_ne
vec_any_ngevec_any_ngtvec_any_nle
vec_any_nltvec_any_numericvec_any_out
vec_avgvec_bpermvec_ceil
vec_cipher_bevec_cipherlast_bevec_cmpb
vec_cmpeqvec_cmpgevec_cmpgt
vec_cmplevec_cmpltvec_cmpne
vec_cmpnezvec_cntlzvec_cntlz_lsbb
vec_cnttzvec_cnttz_lsbbvec_cpsgn
vec_ctfvec_ctsvec_ctu
vec_divvec_doublevec_doublee
vec_doublehvec_doublelvec_doubleo
vec_eqvvec_exptevec_extract
vec_extract_expvec_extract_fp32_from_shorthvec_extract_fp32_from_shortl
vec_extract_sigvec_extract_4bvec_first_match_index
vec_first_match_or_eos_indexvec_first_mismatch_indexvec_first_mismatch_or_eos_index
vec_floatvec_float2vec_floate
vec_floatovec_floorvec_gb
vec_insertvec_insert_expvec_insert4b
vec_ldvec_ldevec_ldl
vec_logevec_maddvec_madds
vec_maxvec_mergeevec_mergeh
vec_mergelvec_mergeovec_mfvscr
vec_minvec_mraddsvec_msub
vec_msumvec_msumsvec_mtvscr
vec_mulvec_mulevec_mulo
vec_nabsvec_nandvec_ncipher_be
vec_ncipherlast_bevec_nearbyintvec_neg
vec_nmaddvec_nmsubvec_nor
vec_orvec_orcvec_pack
vec_pack_to_short_fp32vec_packpxvec_packs
vec_packsuvec_parity_lsbbvec_perm
vec_permxorvec_pmsum_bevec_popcnt
vec_revec_recipdivvec_revb
vec_revevec_rintvec_rl
vec_rlmivec_rlnmvec_round
vec_rsqrtvec_rsqrtevec_sbox_be
vec_selvec_shasigma_bevec_signed
vec_signed2vec_signedevec_signedo
vec_slvec_sldvec_sldw
vec_sllvec_slovec_slv
vec_splatvec_splat_s8vec_splat_s16
vec_splat_s32vec_splat_u8vec_splat_u16
vec_splat_u32vec_splatsvec_sqrt
vec_srvec_sravec_srl
vec_srovec_srvvec_st
vec_stevec_stlvec_sub
vec_subcvec_subevec_subec
vec_subsvec_sum2svec_sum4s
vec_sumsvec_test_data_classvec_trunc
vec_unpackhvec_unpacklvec_unsigned
vec_unsigned2vec_unsignedevec_unsignedo
vec_xlvec_xl_bevec_xl_len
vec_xl_len_rvec_xorvec_xst
vec_xst_bevec_xst_lenvec_xst_len_r