Vector Intrinsic Reference
Some front matter should go here, describing conventions
used throughout the chapter.
Built-In Vector Functions
Some front matter should go here, describing conventions
specific to this section.
vec_abs
Vector Absolute Value
r = vec_abs (a)
Purpose:
Returns a vector r that contains the
absolute values of the contents of the given vector
a.
Result value:
The value of each element of r is the
absolute value of the corresponding element of
a. For integer vectors, the arithmetic
is modular.
Endian considerations:
None.
Supported type signatures for vec_abs
r
a
Example Implementation
vector signed char
vector signed char
vspltisw t,0
vsububm t,t,a
vmaxsb r,t,a
vector signed short
vector signed short
vspltisw t,0
vsubuhm t,t,a
vmaxsh r,t,a
vector signed int
vector signed int
vspltisw t,0
vsubuwm t,t,a
vmaxsw r,t,a
vector signed long long
vector signed long long
vspltisw t,0
vsubudm t,t,a
vmaxsd r,t,a
vector float
vector float
xvabssp r,a
vector double
vector double
xvabsdp r,a
vec_absd
Vector Absolute Difference
r = vec_absd (a, b)
Purpose:
Computes the absolute difference of two vectors.
Result value:
The value of each element of r is the
absolute difference of the corresponding elements of a and b, using
modulo arithmetic.
Endian considerations:
None.
Supported type signatures for vec_absd
r
a
b
Example Implementation
Restrictions
vector unsigned char
vector unsigned char
vector unsigned char
vabsdub r,a,b
ISA 3.0 or later
vector unsigned short
vector unsigned short
vector unsigned short
vabsduh r,a,b
ISA 3.0 or later
vector unsigned int
vector unsigned int
vector unsigned int
vabsduw r,a,b
ISA 3.0 or later
vec_abss
Vector Absolute Value Saturated
r = vec_abss (a)
Purpose:
Returns a vector r that contains the
saturated absolute values of the contents of the given vector
a.
Result value:
The value of each element of r is the
saturated absolute value of the corresponding element of
a.
Endian considerations:
None.
Supported type signatures for vec_abss
r
a
Example Implementation
vector signed char
vector signed char
vspltisb t,0
vsubsbs t,t,a
vmaxsb r,t,a
vector signed short
vector signed short
vspltish t,0
vsubshs t,t,a
vmaxsh r,t,a
vector signed int
vector signed int
vspltisw t,0
vsubsws t,t,a
vmaxsw r,t,a
vec_add
Vector Addition
r = vec_add (a, b)
Purpose:
Computes the sum of two vectors.
Result value:
The value of each element of r is the
sum of the corresponding elements of a and b. Modular
arithmetic is used for both signed and unsigned integers.
Endian considerations:
None.
Supported type signatures for vec_add
r
a
b
Example Implementation
vector signed char
vector signed char
vector signed char
vaddubm r,a,b
vector unsigned char
vector unsigned char
vector unsigned char
vaddubm r,a,b
vector signed short
vector signed short
vector signed short
vadduhm r,a,b
vector unsigned short
vector unsigned short
vector unsigned short
vadduhm r,a,b
vector signed int
vector signed int
vector signed int
vadduwm r,a,b
vector unsigned int
vector unsigned int
vector unsigned int
vadduwm r,a,b
vector signed long long
vector signed long long
vector signed long long
vaddudm r,a,b
vector unsigned long long
vector unsigned long long
vector unsigned long long
vaddudm r,a,b
vector signed __int128
vector signed __int128
vector signed __int128
vadduqm r,a,b
vector unsigned __int128
vector unsigned __int128
vector unsigned __int128
vadduqm r,a,b
vector float
vector float
vector float
xvaddsp r,a,b
vector double
vector double
vector double
xvadddp r,a,b
vec_addc
Vector Add Carrying
r = vec_addc (a, b)
Purpose:
Returns a vector of carry bits produced by adding two vectors.
Result value:
The value of each element of r is the
carry produced by adding the corresponding elements of a and b (1
if there is a carry, 0 otherwise).
Endian considerations:
None.
Supported type signatures for vec_addc
r
a
b
Example Implementation
vector signed int
vector signed int
vector signed int
vaddcuw r,a,b
vector unsigned int
vector unsigned int
vector unsigned int
vaddcuw r,a,b
vector signed __int128
vector signed __int128
vector signed __int128
vaddcuq r,a,b
vector unsigned __int128
vector unsigned __int128
vector unsigned __int128
vaddcuq r,a,b
vec_adde
Vector Add Extended
r = vec_adde (a, b, c)
Purpose:
Returns a vector formed as the sum of two vectors and a carry vector.
Result value:
The value of each element of r is
produced by adding the corresponding elements of a and b with
a carry specified in the corresponding element of c (1 if there is a carry, 0 otherwise).
Endian considerations:
None.
Supported type signatures for vec_adde
r
a
b
c
Example Implementation
vector signed int
vector signed int
vector signed int
vector signed int
vspltisw t,1
vadduwm r,a,b
xxland c,c,t
vadduwm r,r,c
vector unsigned int
vector unsigned int
vector unsigned int
vector unsigned int
vspltisw t,1
vadduwm r,a,b
xxland c,c,t
vadduwm r,r,c
vector signed __int128
vector signed __int128
vector signed __int128
vector signed __int128
vaddeuqm r,a,b,c
vector unsigned __int128
vector unsigned __int128
vector unsigned __int128
vector unsigned __int128
vaddeuqm r,a,b,c
vec_addec
Vector Add Extended Carrying
r = vec_addec (a, b, c)
Purpose:
Returns a vector of carry bits produced by adding two vectors and
a carry vector.
Result value:
The value of each element of r is
the carry produced by adding the corresponding elements of a and b and
a carry specified in the corresponding element of c (1 if there is a carry, 0 otherwise).
Endian considerations:
None.
Supported type signatures for vec_addec
r
a
b
c
Example Implementation
vector signed int
vector signed int
vector signed int
vector signed int
vspltisw t,1
xxland u,c,t
vadduwm v,a,b
vaddcuw w,a,b
vaddcuw x,v,u
xxlor r,w,x
vector unsigned int
vector unsigned int
vector unsigned int
vector unsigned int
vspltisw t,1
xxland u,c,t
vadduwm v,a,b
vaddcuw w,a,b
vaddcuw x,v,u
xxlor r,w,x
vector signed __int128
vector signed __int128
vector signed __int128
vector signed __int128
vaddecuq r,a,b,c
vector unsigned __int128
vector unsigned __int128
vector unsigned __int128
vector unsigned __int128
vaddecuq r,a,b,c
vec_adds
Vector Add Saturating
r = vec_adds (a, b)
Purpose:
Computes the saturated sum of two vectors.
Result value:
The value of each element of r is the
saturated sum of the corresponding elements of a and b.
Endian considerations:
None.
Supported type signatures for vec_adds
r
a
b
Example Implementation
vector signed char
vector signed char
vector signed char
vaddsbs r,a,b
vector unsigned char
vector unsigned char
vector unsigned char
vaddubs r,a,b
vector signed short
vector signed short
vector signed short
vaddshs r,a,b
vector unsigned short
vector unsigned short
vector unsigned short
vadduhs r,a,b
vector signed int
vector signed int
vector signed int
vaddsws r,a,b
vector unsigned int
vector unsigned int
vector unsigned int
vadduws r,a,b
vec_and
Vector AND
r = vec_and (a, b)
Purpose:
Performs a bitwise AND of two vectors.
Result value:
The value of r is the bitwise AND
of a and b.
Endian considerations:
None.
Supported type signatures for vec_and
r
a
b
Example Implementation
Restrictions
vector bool char
vector bool char
vector bool char
xxland r,a,b
vector signed char
vector signed char
vector signed char
xxland r,a,b
vector unsigned char
vector unsigned char
vector unsigned char
xxland r,a,b
vector bool short
vector bool short
vector bool short
xxland r,a,b
vector signed short
vector signed short
vector signed short
xxland r,a,b
vector unsigned short
vector unsigned short
vector unsigned short
xxland r,a,b
vector signed int
vector signed int
vector signed int
xxland r,a,b
vector bool int
vector bool int
vector bool int
xxland r,a,b
vector unsigned int
vector unsigned int
vector unsigned int
xxland r,a,b
vector bool long long
vector bool long long
vector bool long long
xxland r,a,b
Phased in
vector signed long long
vector signed long long
vector signed long long
xxland r,a,b
Phased in
vector unsigned long long
vector unsigned long long
vector unsigned long long
xxland r,a,b
Phased in
vector float
vector float
vector float
xxland r,a,b
vector double
vector double
vector double
xxland r,a,b
vec_andc
Vector AND with Complement
r = vec_andc (a, b)
Purpose:
Performs a bitwise AND of one vector with the bitwise complement of
another vector.
Result value:
The value of r is the bitwise AND
of a with the bitwise complement
of b.
Endian considerations:
None.
Supported type signatures for vec_andc
r
a
b
Example Implementation
Restrictions
vector bool char
vector bool char
vector bool char
xxlandc r,a,b
vector signed char
vector signed char
vector signed char
xxlandc r,a,b
vector unsigned char
vector unsigned char
vector unsigned char
xxlandc r,a,b
vector bool short
vector bool short
vector bool short
xxlandc r,a,b
vector signed short
vector signed short
vector signed short
xxlandc r,a,b
vector unsigned short
vector unsigned short
vector unsigned short
xxlandc r,a,b
vector signed int
vector signed int
vector signed int
xxlandc r,a,b
vector bool int
vector bool int
vector bool int
xxlandc r,a,b
vector unsigned int
vector unsigned int
vector unsigned int
xxlandc r,a,b
vector bool long long
vector bool long long
vector bool long long
xxlandc r,a,b
Phased in
vector signed long long
vector signed long long
vector signed long long
xxlandc r,a,b
Phased in
vector unsigned long long
vector unsigned long long
vector unsigned long long
xxlandc r,a,b
Phased in
vector float
vector float
vector float
xxlandc r,a,b
vector double
vector double
vector double
xxlandc r,a,b
vec_avg
Vector Average
r = vec_avg (a, b)
Purpose:
Returns a vector containing the elementwise average of two vectors.
Result value:
The value of each element of r is the
average of the value of the corresponding elements of a and b.
Endian considerations:
None.
Supported type signatures for vec_avg
r
a
b
Example Implementation
vector signed char
vector signed char
vector signed char
vavgsb r,a,b
vector unsigned char
vector unsigned char
vector unsigned char
vavgub r,a,b
vector signed short
vector signed short
vector signed short
vavgsh r,a,b
vector unsigned short
vector unsigned short
vector unsigned short
vavguh r,a,b
vector signed int
vector signed int
vector signed int
vavgsw r,a,b
vector unsigned int
vector unsigned int
vector unsigned int
vavguw r,a,b
vec_bperm
Vector Bit Permute
r = vec_bperm (a, b)
Purpose:
Gathers up to 16 one-bit values from a quadword or from each
doubleword element in the specified order, zeroing other bits.
Result value:
When the type of a is vector
unsigned char or vector unsigned __int128:
For each i
(0 ≤ i < 16),
let bit index j denote the byte value of the
ith
element of b.
If bit index j is greater than or equal to
128, bit i of
r is set to 0.
If bit index j is smaller than 128, bit
i of r
is set to the value of the
jth bit of
a.
All other bits of r are zeroed.
When the type of a is vector
unsigned long long:
For each doubleword element i
(0 ≤ i < 2)
of a:
For each j
(0 ≤ j < 8),
let bit index k denote the byte
value of the
jth
element of b.
If bit index k is greater than or
equal to 64, bit j of element
i of r is set to 0.
If bit index k is less than 64,
bit j of element
i of r is set to the value of the
kth
bit of element i of input
a.
All other bits are zeroed.
Endian considerations:
All bit and byte numberings within each element in the above
description denote big-endian (i.e., left-to-right) order,
reflecting the underlying hardware instruction. Unlike most
of the vector intrinsics in this chapter, vec_bperm
does not follow the bi-endian programming model.
Supported type signatures for vec_bperm
r
a
b
Example Implementation
Restrictions
vector unsigned char
vector unsigned char
vector unsigned char
vbpermq r,a,b
vector unsigned long long
vector unsigned __int128
vector unsigned char
vbpermq r,a,b
Phased in
vector unsigned long long
vector unsigned long long
vector unsigned char
vbpermd r,a,b
ISA 3.0 or later
Phased in
vec_ceil
Vector Ceiling
r = vec_ceil (a)
Purpose:
Returns a vector r that contains the
result of applying the floating-point ceiling function to each
element of a.
Result value:
The value of each element of r is the
smallest representable floating-point integral value greater than or
equal to the value of the corresponding element of
a.
Endian considerations:
None.
Supported type signatures for vec_ceil
r
a
Example Implementation
vector float
vector float
xvrspip r,a
vector double
vector double
xvrdpip r,a
vec_cmpb
Vector Compare Bytes
r = vec_cmpb (a, b)
Purpose:
Performs a bounds comparison of each set of corresponding elements
of the given vectors.
Result value:
Each element of r has the value 0
if the value of the corresponding element of a is less than or equal to the value of
the corresponding element of b
and greater than or equal to the negated value of the corresponding
element of b. Otherwise:
If an element of b is greater
than or equal to 0, then the value of the corresponding
element of r is 0 if the
absolute value of the corresponding element of a is equal to the value of the
corresponding element of b.
The value is negative if it is greater than the value of the
corresponding element of b.
It is positive if it is less than the value of the corresponding
element of b.
If an element of b is less
than 0, then the value of the element of r is positive if the value of the
corresponding element of a is
less than or equal to the value of the element of b. Otherwise, it is negative.
Endian considerations:
None.
Supported type signatures for vec_cmpb
r
a
b
Example Implementation
vector signed int
vector float
vector float
vcmpbfp r,a,b
vec_cmpeq
Vector Compare Equal
r = vec_cmpeq (a, b)
Purpose:
Returns a vector containing the results of comparing each set of
corresponding elements of the given vectors for equality.
Result value:
For each element of r, the value
of each bit is 1 if the corresponding elements of a and b
are equal. Otherwise, the value of each bit is 0.
Endian considerations:
None.
Supported type signatures for vec_cmpeq
r
a
b
Example Implementation
vector bool char
vector bool char
vector bool char
vcmpequb r,a,b
vector bool char
vector signed char
vector signed char
vcmpequb r,a,b
vector bool char
vector unsigned char
vector unsigned char
vcmpequb r,a,b
vector bool short
vector bool short
vector bool short
vcmpequh r,a,b
vector bool short
vector signed short
vector signed short
vcmpequh r,a,b
vector bool short
vector unsigned short
vector unsigned short
vcmpequh r,a,b
vector bool int
vector bool int
vector bool int
vcmpequw r,a,b
vector bool int
vector signed int
vector signed int
vcmpequw r,a,b
vector bool int
vector unsigned int
vector unsigned int
vcmpequw r,a,b
vector bool long long
vector bool long long
vector bool long long
vcmpequd r,a,b
vector bool long long
vector signed long long
vector signed long long
vcmpequd r,a,b
vector bool long long
vector unsigned long long
vector unsigned long long
vcmpequd r,a,b
vector bool int
vector float
vector float
xvcmpeqsp r,a,b
vector bool long long
vector double
vector double
xvcmpeqdp r,a,b
vec_cmpge
Vector Compare Greater or Equal
r = vec_cmpge (a, b)
Purpose:
Returns a vector containing the results of a greater-than-or-equal-to
comparison between each set of corresponding elements of the given
vectors.
Result value:
For each element of r, the value
of each bit is 1 if the corresponding element of a is greater than or equal to the corresponding
element of b. Otherwise, the value
of each bit is 0.
Endian considerations:
None.
Supported type signatures for vec_cmpge
r
a
b
Example Implementation
vector bool char
vector signed char
vector signed char
vcmpgtsb t,b,a
xxlnor r,t,t
vector bool char
vector unsigned char
vector unsigned char
vcmpgtub t,b,a
xxlnor r,t,t
vector bool short
vector signed short
vector signed short
vcmpgtsh t,b,a
xxlnor r,t,t
vector bool short
vector unsigned short
vector unsigned short
vcmpgtuh t,b,a
xxlnor r,t,t
vector bool int
vector signed int
vector signed int
vcmpgtsw t,b,a
xxlnor r,t,t
vector bool int
vector unsigned int
vector unsigned int
vcmpgtuw t,b,a
xxlnor r,t,t
vector bool long long
vector signed long long
vector signed long long
vcmpgtsd t,b,a
xxlnor r,t,t
vector bool long long
vector unsigned long long
vector unsigned long long
vcmpgtud t,b,a
xxlnor r,t,t
vector bool int
vector float
vector float
xvcmpgesp r,a,b
vector bool long long
vector double
vector double
xvcmpgedp r,a,b
vec_cmpgt
Vector Compare Greater Than
r = vec_cmpgt (a, b)
Purpose:
Returns a vector containing the results of a greater-than
comparison between each set of corresponding elements of the given
vectors.
Result value:
For each element of r, the value
of each bit is 1 if the corresponding element of a is greater than the corresponding
element of b. Otherwise, the value
of each bit is 0.
Endian considerations:
None.
Supported type signatures for vec_cmpgt
r
a
b
Example Implementation
vector bool char
vector signed char
vector signed char
vcmpgtsb r,a,b
vector bool char
vector unsigned char
vector unsigned char
vcmpgtub r,a,b
vector bool short
vector signed short
vector signed short
vcmpgtsh r,a,b
vector bool short
vector unsigned short
vector unsigned short
vcmpgtuh r,a,b
vector bool int
vector signed int
vector signed int
vcmpgtsw r,a,b
vector bool int
vector unsigned int
vector unsigned int
vcmpgtuw r,a,b
vector bool long long
vector signed long long
vector signed long long
vcmpgtsd r,a,b
vector bool long long
vector unsigned long long
vector unsigned long long
vcmpgtud r,a,b
vector bool int
vector float
vector float
xvcmpgtsp r,a,b
vector bool long long
vector double
vector double
xvcmpgtdp r,a,b
vec_cmple
Vector Compare Less Than or Equal
r = vec_cmple (a, b)
Purpose:
Returns a vector containing the results of a less-than-or-equal
comparison between each set of corresponding elements of the given
vectors.
Result value:
For each element of r, the value
of each bit is 1 if the corresponding element of a is less than or equal to the corresponding
element of b. Otherwise, the value
of each bit is 0.
Endian considerations:
None.
Supported type signatures for vec_cmple
r
a
b
Example Implementation
vector bool char
vector signed char
vector signed char
vcmpgtsb t,a,b
xxlnor r,t,t
vector bool char
vector unsigned char
vector unsigned char
vcmpgtub t,a,b
xxlnor r,t,t
vector bool short
vector signed short
vector signed short
vcmpgtsh t,a,b
xxlnor r,t,t
vector bool short
vector unsigned short
vector unsigned short
vcmpgtuh t,a,b
xxlnor r,t,t
vector bool int
vector signed int
vector signed int
vcmpgtsw t,a,b
xxlnor r,t,t
vector bool int
vector unsigned int
vector unsigned int
vcmpgtuw t,a,b
xxlnor r,t,t
vector bool long long
vector signed long long
vector signed long long
vcmpgtsd t,a,b
xxlnor r,t,t
vector bool long long
vector unsigned long long
vector unsigned long long
vcmpgtud t,a,b
xxlnor r,t,t
vector bool int
vector float
vector float
xvcmpgesp r,b,a
vector bool long long
vector double
vector double
xvcmpgedp r,b,a
vec_cmplt
Vector Compare Less Than
r = vec_cmplt (a, b)
Purpose:
Returns a vector containing the results of a less-than
comparison between each set of corresponding elements of the given
vectors.
Result value:
For each element of r, the value
of each bit is 1 if the corresponding element of a is less than the corresponding
element of b. Otherwise, the value
of each bit is 0.
Endian considerations:
None.
Supported type signatures for vec_cmplt
r
a
b
Example Implementation
vector bool char
vector signed char
vector signed char
vcmpgtsb r,b,a
vector bool char
vector unsigned char
vector unsigned char
vcmpgtub r,b,a
vector bool short
vector signed short
vector signed short
vcmpgtsh r,b,a
vector bool short
vector unsigned short
vector unsigned short
vcmpgtuh r,b,a
vector bool int
vector signed int
vector signed int
vcmpgtsw r,b,a
vector bool int
vector unsigned int
vector unsigned int
vcmpgtuw r,b,a
vector bool long long
vector signed long long
vector signed long long
vcmpgtsd r,b,a
vector bool long long
vector unsigned long long
vector unsigned long long
vcmpgtud r,b,a
vector bool int
vector float
vector float
xvcmpgtsp r,b,a
vector bool long long
vector double
vector double
xvcmpgtdp r,b,a
vec_cmpne
Vector Compare Not Equal
r = vec_cmpne (a, b)
Purpose:
Returns a vector containing the results of comparing each set of
corresponding elements of the given vectors for inequality.
Result value:
For each element of r, the value
of each bit is 1 if the corresponding elements of a and b
are not equal. Otherwise, the value of each bit is 0.
Endian considerations:
None.
Supported type signatures for vec_cmpne
r
a
b
Example Implementation
vector bool char
vector bool char
vector bool char
vcmpneb r,a,b
vector bool char
vector signed char
vector signed char
vcmpneb r,a,b
vector bool char
vector unsigned char
vector unsigned char
vcmpneb r,a,b
vector bool short
vector bool short
vector bool short
vcmpneh r,a,b
vector bool short
vector signed short
vector signed short
vcmpneh r,a,b
vector bool short
vector unsigned short
vector unsigned short
vcmpneh r,a,b
vector bool int
vector bool int
vector bool int
vcmpnew r,a,b
vector bool int
vector signed int
vector signed int
vcmpnew r,a,b
vector bool int
vector unsigned int
vector unsigned int
vcmpnew r,a,b
vector bool long long
vector bool long long
vector bool long long
vcmpequd t,a,b
xxlnor r,t,t
vector bool long long
vector signed long long
vector signed long long
vcmpequd t,a,b
xxlnor r,t,t
vector bool long long
vector unsigned long long
vector unsigned long long
vcmpequd t,a,b
xxlnor r,t,t
vector bool int
vector float
vector float
xvcmpeqsp t,a,b
xxlnor r,t,t
vector bool long long
vector double
vector double
xvcmpeqdp t,a,b
xxlnor r,t,t
vec_cmpnez
Vector Compare Not Equal or Zero
r = vec_cmpnez (a, b)
Purpose:
Returns a vector containing the results of comparing each set of
corresponding elements of the given vectors for inequality, or for
an element with a zero value.
Result value:
For each element of r, the value
of each bit is 1 if the corresponding elements of a and b
are not equal, or if the a element or
the b element is zero. Otherwise,
the value of each bit is 0.
Endian considerations:
None.
Supported type signatures for vec_cmpnez
r
a
b
Example Implementation
Restrictions
vector bool char
vector signed char
vector signed char
vcmpnezb r,a,b
ISA 3.0 or later
vector bool char
vector unsigned char
vector unsigned char
vcmpnezb r,a,b
ISA 3.0 or later
vector bool short
vector signed short
vector signed short
vcmpnezh r,a,b
ISA 3.0 or later
vector bool short
vector unsigned short
vector unsigned short
vcmpnezh r,a,b
ISA 3.0 or later
vector bool int
vector signed int
vector signed int
vcmpnezw r,a,b
ISA 3.0 or later
vector bool int
vector unsigned int
vector unsigned int
vcmpnezw r,a,b
ISA 3.0 or later
vec_cntlz
Vector Count Leading Zeros
r = vec_cntlz (a)
Purpose:
Returns a vector containing the number of most-significant bits
equal to zero of each corresponding element of the given vector.
Result value:
The value of each element of r is
set to the number of leading zeros of the corresponding element
of a.
Endian considerations:
None.
Supported type signatures for vec_cntlz
r
a
Example Implementation
Restrictions
vector signed char
vector signed char
vclzb r,a
Phased in
vector unsigned char
vector unsigned char
vclzb r,a
Phased in
vector signed short
vector signed short
vclzh r,a
Phased in
vector unsigned short
vector unsigned short
vclzh r,a
Phased in
vector signed int
vector signed int
vclzw r,a
Phased in
vector unsigned int
vector unsigned int
vclzw r,a
Phased in
vector signed long long
vector signed long long
vclzd r,a
Phased in
vector unsigned long long
vector unsigned int long long
vclzd r,a
Phased in
vec_cntlz_lsbb
Vector Count Leading Zero Least-Significant Bits by
Byte
r = vec_cntlz_lsbb (a)
Purpose:
Returns the number of leading byte elements (starting at the
lowest-numbered element) of a vector that have a least-significant
bit of zero.
Result value:
The value of r is set to the
number of leading byte elements (starting at the lowest-numbered
element) of a that have a
least-significant bit of zero.
Endian considerations:
None.
Supported type signatures for vec_cntlz_lsbb
r
a
Example Implementation
Restrictions
signed int
vector signed char
vclzlsbb r,a
ISA 3.0 or later
signed int
vector unsigned char
vclzlsbb r,a
ISA 3.0 or later
vec_cnttz
Vector Count Trailing Zeros
r = vec_cnttz (a)
Purpose:
Returns a vector containing the number of least-significant bits
equal to zero of each corresponding element of the given vector.
Result value:
The value of each element of r is
set to the number of trailing zeros of the corresponding element
of a.
Endian considerations:
None.
Supported type signatures for vec_cnttz
r
a
Example Implementation
Restrictions
vector signed char
vector signed char
vctzb r,a
ISA 3.0 or later
vector unsigned char
vector unsigned char
vctzb r,a
ISA 3.0 or later
vector signed short
vector signed short
vctzh r,a
ISA 3.0 or later
vector unsigned short
vector unsigned short
vctzh r,a
ISA 3.0 or later
vector signed int
vector signed int
vctzw r,a
ISA 3.0 or later
vector unsigned int
vector unsigned int
vctzw r,a
ISA 3.0 or later
vector signed long long
vector signed long long
vctzd r,a
ISA 3.0 or later
vector unsigned long long
vector unsigned int long long
vctzd r,a
ISA 3.0 or later
vec_cnttz_lsbb
Vector Count Trailing Zero Least-Significant Bits by
Byte
r = vec_cnttz_lsbb (a)
Purpose:
Returns the number of trailing byte elements (starting at the
highest-numbered element) of a vector that have a least-significant
bit of zero.
Result value:
The value of r is set to the
number of trailing byte elements (starting at the highest-numbered
element) of a that have a
least-significant bit of zero.
Endian considerations:
None.
Supported type signatures for vec_cnttz_lsbb
r
a
Example Implementation
Restrictions
signed int
vector signed char
vctzlsbb r,a
ISA 3.0 or later
signed int
vector unsigned char
vctzlsbb r,a
ISA 3.0 or later
vec_cpsgn
Vector Copy Sign
r = vec_cpsgn (a, b)
Purpose:
Returns a vector by copying the sign of the elements in one
vector to the sign of the corresponding elements of another
vector.
Result value:
The value of each element of r is set
to the corresponding element of b
with its sign replaced by the sign from the corresponding element of
a.
Endian considerations:
None.
Supported type signatures for vec_cpsgn
r
a
b
Example Implementation
Restrictions
vector float
vector float
vector float
xvcpsgnsp r,b,a
Phased in
vector double
vector double
vector double
xvcpsgndp r,b,a
Phased in
vec_ctf
Vector Convert to Floating-Point
r = vec_ctf (a, b)
Purpose:
Converts an integer vector into a floating-point vector.
Result value:
The value of each element of r is the
closest floating-point approximation of the value of the
corresponding element of a divided
by 2 to the power of b, which should
be in the range 0–31.
Endian considerations:
None.
Supported type signatures for vec_ctf
r
a
b
Example Implementation
vector float
vector signed int
const int
vcfsx r,a,b
vector float
vector unsigned int
const int
vcfux r,a,b
vec_cts
Vector Convert to Signed Integer
r = vec_cts (a, b)
Purpose:
Converts a floating-point vector into a signed integer vector.
Result value:
The value of each element of r is the
saturated signed-integer value, truncated towards zero, obtained by
multiplying the corresponding element of a multiplied by 2 to the power of b, which should be in the range 0–31.
Endian considerations:
None.
Supported type signatures for vec_cts
r
a
b
Example Implementation
vector signed int
vector float
const int
vctsxs r,a,b
vec_ctu
Vector Convert to Unsigned Integer
r = vec_ctu (a, b)
Purpose:
Converts a floating-point vector into an unsigned integer vector.
Result value:
The value of each element of r is the
saturated unsigned-integer value, truncated towards zero, obtained by
multiplying the corresponding element of a multiplied by 2 to the power of b, which should be in the range 0–31.
Endian considerations:
None.
Supported type signatures for vec_ctu
r
a
b
Example Implementation
vector unsigned int
vector float
const int
vctuxs r,a,b
vec_div
Vector Divide
r = vec_div (a, b)
Purpose:
Divides the elements in one vector by the corresponding elements
in another vector and places the quotients in the result vector.
Division is emulated using scalar arithmetic for integer types.
Result value:
The value of each element of r is
obtained by dividing the corresponding element of a by the corresponding element of b.
Endian considerations:
None.
Supported type signatures for vec_div
r
a
b
Example Implementation
vector signed long long
vector signed long long
vector signed long long
xxspltd t,a,1
mfvsrd u,t
xxspltd v,b,1
mfvsrd w,v
divd x,u,w
mfvsrd u,a
mtvsrd y,x
mfvsrd w,b
divd x,u,w
mtvsrd z,x
xxmrghd r,z,y
vector unsigned long long
vector unsigned long long
vector unsigned long long
xxspltd t,a,1
mfvsrd u,t
xxspltd v,b,1
mfvsrd w,v
divd x,u,w
mfvsrd u,a
mtvsrd y,x
mfvsrd w,b
divd x,u,w
mtvsrd z,x
xxmrghd r,z,y
vector float
vector float
vector float
xvdivsp r,a,b
vector double
vector double
vector double
xvdivdp r,a,b
vec_double
Vector Convert to Double Precision
r = vec_double (a)
Purpose:
Converts a vector of long integers into a vector of double-precision
numbers.
Result value:
The value of each element of r is
obtained by converting the corresponding element of a to double precision floating-point.
Endian considerations:
None.
Supported type signatures for vec_double
r
a
Example Implementation
vector double
vector signed long long
xvcvsxddp r,a
vector double
vector unsigned long long
xvcvuxddp r,a
vec_doublee
Vector Convert Even Elements to Double Precision
r = vec_doublee (a)
Purpose:
Converts the even elements of a vector into a vector of double-precision
numbers.
Result value:
Elements 0 and 1 of r are set to
the converted values of elements 0 and 2 of a.
Endian considerations:
None.
Supported type signatures for vec_doublee
r
a
Example Implementation
Restrictions
vector double
vector signed int
[TBD]
Phased in
vector double
vector unsigned int
[TBD]
Phased in
vector double
vector float
[TBD]
Phased in
vec_doubleh
Vector Convert High Elements to Double Precision
r = vec_doubleh (a)
Purpose:
Converts the high-order elements of a vector into a vector
of double-precision numbers.
Result value:
Elements 0 and 1 of r are set to
the converted values of elements 0 and 1 of a.
Endian considerations:
None.
Supported type signatures for vec_doubleh
r
a
Example Implementation
Restrictions
vector double
vector signed int
[TBD]
Phased in
vector double
vector unsigned int
[TBD]
Phased in
vector double
vector float
[TBD]
Phased in
vec_doublel
Vector Convert Low Elements to Double Precision
r = vec_doublel (a)
Purpose:
Converts the low-order elements of a vector into a vector
of double-precision numbers.
Result value:
Elements 0 and 1 of r are set to
the converted values of elements 2 and 3 of a.
Endian considerations:
None.
Supported type signatures for vec_doublel
r
a
Example Implementation
Restrictions
vector double
vector signed int
[TBD]
Phased in
vector double
vector unsigned int
[TBD]
Phased in
vector double
vector float
[TBD]
Phased in
vec_doubleo
Vector Convert Odd Elements to Double Precision
r = vec_doubleo (a)
Purpose:
Converts the odd elements of a vector into a vector
of double-precision numbers.
Result value:
Elements 0 and 1 of r are set to
the converted values of elements 1 and 3 of a.
Endian considerations:
None.
Supported type signatures for vec_doubleo
r
a
Example Implementation
Restrictions
vector double
vector signed int
[TBD]
Phased in
vector double
vector unsigned int
[TBD]
Phased in
vector double
vector float
[TBD]
Phased in
vec_eqv
Vector Equivalence
r = vec_eqv (a, b)
Purpose:
Performs a bitwise equivalence (exclusive NOR) of two vectors.
Result value:
The value of r is the bitwise XNOR
of a and b.
Endian considerations:
None.
Supported type signatures for vec_eqv
r
a
b
Example Implementation
vector bool char
vector bool char
vector bool char
xxleqv r,a,b
vector signed char
vector signed char
vector signed char
xxleqv r,a,b
vector unsigned char
vector unsigned char
vector unsigned char
xxleqv r,a,b
vector bool short
vector bool short
vector bool short
xxleqv r,a,b
vector signed short
vector signed short
vector signed short
xxleqv r,a,b
vector unsigned short
vector unsigned short
vector unsigned short
xxleqv r,a,b
vector signed int
vector signed int
vector signed int
xxleqv r,a,b
vector bool int
vector bool int
vector bool int
xxleqv r,a,b
vector unsigned int
vector unsigned int
vector unsigned int
xxleqv r,a,b
vector bool long long
vector bool long long
vector bool long long
xxleqv r,a,b
vector signed long long
vector signed long long
vector signed long long
xxleqv r,a,b
vector unsigned long long
vector unsigned long long
vector unsigned long long
xxleqv r,a,b
vector float
vector float
vector float
xxleqv r,a,b
vector double
vector double
vector double
xxleqv r,a,b
vec_expte
Vector Exponential Estimate
r = vec_expte (a)
Purpose:
Returns a vector r containing
estimates of 2 raised to the power of the corresponding elements
of a.
Result value:
The value of each element of r is the
estimated value of 2 raised to the power of the corresponding element of
a.
Endian considerations:
None.
Supported type signatures for vec_expte
r
a
Example Implementation
vector float
vector float
vexptefp r,a
vec_extract
Vector Extract
r = vec_extract (a, b)
Purpose:
Returns the value of the bth
element of vector a.
Result value:
The value of each element of r is the
element of a at position
b modulo the number of elements of
a.
Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
Supported type signatures for vec_extract
r
a
b
Example LE Implementation
Example BE Implementation
signed char
vector signed char
signed int
vexptefp r,a
vexptefp r,a