POWER9 built-in functions

A number of built-in functions are available to exploit the POWER9 architecture.

Note: The following built-in functions are valid only when -qarch(-mcpu) is set to utilize the POWER9 technology.

Fixed-point built-in functions

__builtin_addex
Adds Extended using Overflow Bit.
__builtin_cmpeqb
Compares the corresponding bytes of the given parameters and returns the result.
__builtin_cmprb
Compares the ranged byte.
__builtin_setb
Sets boolean extension.
__builtin_maddhd
Fixed-point Multiply-Add signed high doubleword.
__builtin_maddhdu
Fixed-point Multiply-Add high doubleword unsigned.
__builtin_maddld
Fixed-point Multiply-Add low doubleword.
__builtin_darn, __builtin_darn_32, __builtin_darn_raw
Delivers a random number.

Binary floating-point built-in functions

__builtin_compare_exp_uo, __builtin_compare_exp_lt, __builtin_compare_exp_eq, __builtin_compare_exp_gt
Compares the exponents of two parameters.
__builtin_extract_exp
Returns the exponent of the given parameter.
__builtin_extract_sig
Returns the significand of the given parameter.
__builtin_insert_exp
Replaces the exponent of the first parameter with the second parameter and returns the result.
__builtin_test_data_class
Determines the data class of the given parameter.

Binary-coded decimal built-in functions

__builtin_bcdcopysign
Returns the decimal value of the first parameter combined with the sign code of the second parameter.

This built-in function is valid only when you include the altivec.h file.

__builtin_bcdsetsign
Set the sign code of the input parameter in packed decimal format.

This built-in function is valid only when you include the altivec.h file.

__builtin_bcdshift
Decimal shift.

This built-in function is valid only when you include the altivec.h file.

__builtin_bcdshiftround
Decimal shift and round.

This built-in function is valid only when you include the altivec.h file.

__builtin_bcdtruncate
Decimal truncate.

This built-in function is valid only when you include the altivec.h file.

__builtin_bcdunsignedshift
Decimal unsigned shift.

This built-in function is valid only when you include the altivec.h file.

__builtin_bcdunsignedtruncate
Decimal unsigned truncate.

This built-in function is valid only when you include the altivec.h file.

__builtin_national2packed
Transforms the national decimal value to packed decimal format.

This built-in function is valid only when you include the altivec.h file.

__builtin_packed2national
Transforms the packed decimal value to national decimal format.

This built-in function is valid only when you include the altivec.h file.

__builtin_packed2zoned
Transforms the packed decimal value to zoned decimal format.

This built-in function is valid only when you include the altivec.h file.

__builtin_zoned2packed
Transforms the zoned decimal value to packed decimal format.

This built-in function is valid only when you include the altivec.h file.

Vector built-in functions

vec_absd
Returns a vector that contains the absolute difference of the corresponding elements of the given vectors.

This built-in function is valid only when you include the altivec.h file.

vec_cmpne
Returns a vector containing the results of comparing each set of the corresponding elements of the given vectors for inequality.

This built-in function is valid only when you include the altivec.h file.

vec_cmpnez
Returns a vector that contains the results of comparing each set of the corresponding elements of the given vectors for inequality, or the results of testing the corresponding element of given vectors for the value of zero.

This built-in function is valid only when you include the altivec.h file.

vec_cntlz
Counts the most significant zero bits of each element of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_cntlz_lsbb
Counts the leading byte elements of the given vector that have a least significant bit of 0.

This built-in function is valid only when you include the altivec.h file.

vec_cnttz
Counts the least significant zero bits of each element of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_cnttz_lsbb
Counts the trailing byte elements of the given vector that have a least significant bit of 0.

This built-in function is valid only when you include the altivec.h file.

vec_extract_exp
Returns a vector that contains the exponent of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_extract_sig
Returns a vector that contains the significand of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_extsbd
Sign-extends the rightmost byte of each doubleword element of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_extsbw
Sign-extends the rightmost byte of each word element of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_extshd
Sign-extends the rightmost halfword of each doubleword element of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_extshw
Sign-extends the rightmost halfword of each word element of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_extswd
Sign-extends the rightmost word of each doubleword element of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_first_match_index
Compares each set of the corresponding elements of the given vectors and returns the first position of equality.

This built-in function is valid only when you include the altivec.h file.

vec_first_match_or_eos_index
Compares each set of the corresponding elements of the given vectors and returns the first position of equality or the position of the end-of-string terminator

This built-in function is valid only when you include the altivec.h file.

vec_first_mismatch_index
Compares each set of the corresponding elements of the given vectors and returns the first position of inequality.

This built-in function is valid only when you include the altivec.h file.

vec_first_mismatch_or_eos_index
Compares each set of the corresponding elements of the given vectors and returns the first position of inequality or the position of the end-of-string terminator

This built-in function is valid only when you include the altivec.h file.

vec_insert_exp
Returns a vector that combines the exponents of elements from one vector with the signs and the significands of elements from another vector.

This built-in function is valid only when you include the altivec.h file.

vec_load_splats
Loads a 4-byte element from the memory address specified by the displacement

This built-in function is valid only when you include the altivec.h file.

vec_parity_lsbb
Returns a vector that computes parity on the least significant bit of each byte of each element of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_rlmi
Returns a vector that contains each element of the given vector rotated left and inserted under a mask into another vector.

This built-in function is valid only when you include the altivec.h file.

vec_rlnm
Returns a vector that contains each element of the given vector rotated left and intersected with a mask.

This built-in function is valid only when you include the altivec.h file.

vec_slv
Left shifts the elements of a given vector by a given number of bits.

This built-in function is valid only when you include the altivec.h file.

vec_srv
Right-shifts the elements of a given vector by a given number of bits.

This built-in function is valid only when you include the altivec.h file.

vec_test_data_class
Determines the data class of the elements of the given vector.

This built-in function is valid only when you include the altivec.h file.

vec_xl_len
Returns a vector that loads a given number of bytes from the given address.

This built-in function is valid only when you include the altivec.h file.

vec_xl_len_r
Loads a string of bytes into vector register, right-justified. Sets the leftmost elements (16-cnt) to 0.

This built-in function is valid only when you include the altivec.h file.

vec_xst_len
Stores a given byte length of a vector to a given address.

This built-in function is valid only when you include the altivec.h file.

vec_xst_len_r
Stores a right-justified string of bytes.

This built-in function is valid only when you include the altivec.h file.



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