Vector Intrinsic ReferenceHow to Use This Reference
This chapter contains reference material for each supported
vector intrinsic. The information for each intrinsic includes:
The intrinsic name and extended name;
A type-free example of the intrinsic's usage;
A description of the intrinsic's purpose;
A description of the value(s) returned from the intrinsic,
if any;
A description of any unusual characteristics of the
intrinsic when different target endiannesses are in force.
If the semantics of the intrinsic in big-endian and
little-endian modes are identical, the description will read
"None.";
Optionally, additional explanatory notes about the
intrinsic; and
A table of supported type signatures for the intrinsic.
Most intrinsics are overloaded, supporting multiple type
signatures. The types of the input arguments always determine
the type of the result argument; that is, it is not possible to
define two intrinsic overloads with the same input argument
types and different result argument types.
The type-free example of the intrinsic's usage uses the
convention that r represents
the result of the intrinsic, and a, b,
etc., represent the input arguments. The allowed type
combinations of these variables are shown as rows in the table
of supported type signatures.
Each row contains at least one example implementation. This
shows one way that a conforming compiler might achieve the
intended semantics of the intrinsic, but compilers are not
required to generate this code specifically. The letters
r, a, b,
etc., in the examples represent vector registers containing the
values of those variables. The letters t, u,
etc., represent vector registers containing temporary
intermediate results. The same register is assumed to be used
for each instance of one of these letters.
When implementations differ for big- and little-endian targets,
separate example implementations are shown for each endianness.
The implementations show a sequence of instructions that may be
used in the implementation of a particular intrinsic, and
usually include vector instructions. When trying to
determine which intrinsic to use, it can be useful to have a
cross-reference from a specific vector instruction to the
intrinsics whose implementations make use of it. This manual
contains such a cross-reference () for the programmer's
convenience.
For some intrinsics, restrictions are shown in the
implementation table for some of the rows. Possible
restrictions include:
ISA 3.0 or later. This
form is only available starting with PowerISA 3.0,
corresponding to POWER9 servers. The Power Vector Library
(see provides equivalent
POWER7/POWER8 implementations for many ISA 3.0 vector
instructions, which may be preferred for portability.
ISA 3.1 or later. This form
is only available starting with PowerISA 3.1, corresponding to
POWER10 servers.
Deprecated. This form of
the intrinsic is currently available, but may be removed in
the future. Programmers are discouraged from using it.
Terminology
Some intrinsic descriptions indicate that either
modular arithmetic or
saturating arithmetic is used. This
refers to what happens when an operation overflows the number
of available bits. A modular operation that overflows
truncates the result on the left, also known as wrapping the
result. A saturating operation that overflows produces the
largest (or smallest) possible result representable in the
output element type.
Operands are sometimes represented as having a const
int type. In such cases, the programmer is expected to
provide an integer literal. When the literal has specific
required bounds, this is often represented instead by such
phrases as "5-bit signed literal" or "2-bit unsigned literal"
to specify them. In such cases, compilers are encouraged to
at least warn upon detecting an out-of-range value. Providing
a variable when a literal is required is a compile-time error.
Built-In Vector Functionsvec_absVector Absolute Value
r = vec_abs (a)
Purpose:
Returns a vector r that contains the
absolute values of the contents of the 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.
vspltiswvec_absvsububmvec_absvmaxsbvec_absvsubuwmvec_absvmaxswvec_absvsubudmvec_absvmaxsdvec_absxvabsspvec_absxvabsdpvec_absSupported type signatures for vec_absraExample Implementationvector signed charvector signed char
vspltisw t,0
vsububm t,t,a
vmaxsb r,t,a
vector signed shortvector signed short
vspltisw t,0
vsubuhm t,t,a
vmaxsh r,t,a
vector signed intvector signed int
vspltisw t,0
vsubuwm t,t,a
vmaxsw r,t,a
vector signed long longvector signed long long
vspltisw t,0
vsubudm t,t,a
vmaxsd r,t,a
vector floatvector float
xvabssp r,a
vector doublevector double
xvabsdp r,a

vec_absdVector 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
modular arithmetic.
Endian considerations:
None.
vabsdubvec_absdvabsduhvec_absdvabsduwvec_absdSupported type signatures for vec_absdrabExample ImplementationRestrictionsvector unsigned charvector unsigned charvector unsigned char
vabsdub r,a,b
ISA 3.0 or latervector unsigned shortvector unsigned shortvector unsigned short
vabsduh r,a,b
ISA 3.0 or latervector unsigned intvector unsigned intvector unsigned int
vabsduw r,a,b
ISA 3.0 or later

vec_abssVector Absolute Value Saturated
r = vec_abss (a)
Purpose:
Returns a vector r that contains the
saturated absolute values of the contents of the 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.
vspltisbvec_abssvsubsbsvec_abssvmaxsbvec_abssvspltishvec_abssvsubshsvec_abssvmaxshvec_abssvspltiswvec_abssvsubswsvec_abssvmaxswvec_abssSupported type signatures for vec_abssraExample Implementationvector signed charvector signed char
vspltisb t,0
vsubsbs t,t,a
vmaxsb r,t,a
vector signed shortvector signed short
vspltish t,0
vsubshs t,t,a
vmaxsh r,t,a
vector signed intvector signed int
vspltisw t,0
vsubsws t,t,a
vmaxsw r,t,a

vec_addVector 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.
vaddubmvec_addvadduhmvec_addvadduwmvec_addvaddudmvec_addvadduqmvec_addxvaddspvec_addxvadddpvec_addSupported type signatures for vec_addrabExample Implementationvector signed charvector signed charvector signed char
vaddubm r,a,b
vector unsigned charvector unsigned charvector unsigned char
vaddubm r,a,b
vector signed shortvector signed shortvector signed short
vadduhm r,a,b
vector unsigned shortvector unsigned shortvector unsigned short
vadduhm r,a,b
vector signed intvector signed intvector signed int
vadduwm r,a,b
vector unsigned intvector unsigned intvector unsigned int
vadduwm r,a,b
vector signed long longvector signed long longvector signed long long
vaddudm r,a,b
vector unsigned long longvector unsigned long longvector unsigned long long
vaddudm r,a,b
vector signed __int128vector signed __int128vector signed __int128
vadduqm r,a,b
vector unsigned __int128vector unsigned __int128vector unsigned __int128
vadduqm r,a,b
vector floatvector floatvector float
xvaddsp r,a,b
vector doublevector doublevector double
xvadddp r,a,b

vec_addcVector Add Carrying
r = vec_addc (a, b)
Purpose:
Returns a vector of carries 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.
vaddcuwvec_addcvaddcuqvec_addcSupported type signatures for vec_addcrabExample Implementationvector signed intvector signed intvector signed int
vaddcuw r,a,b
vector unsigned intvector unsigned intvector unsigned int
vaddcuw r,a,b
vector signed __int128vector signed __int128vector signed __int128
vaddcuq r,a,b
vector unsigned __int128vector unsigned __int128vector unsigned __int128
vaddcuq r,a,b

vec_addeVector 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.
Notes:
Code generated for this intrinsic should ensure only the
low-order bit of c participates
in the sum.
vspltiswvec_addevadduwmvec_addexxlandvec_addevaddeuqmvec_addeSupported type signatures for vec_adderabcExample Implementationvector signed intvector signed intvector signed intvector signed int
vspltisw t,1
vadduwm r,a,b
xxland c,c,t
vadduwm r,r,c
vector unsigned intvector unsigned intvector unsigned intvector unsigned int
vspltisw t,1
vadduwm r,a,b
xxland c,c,t
vadduwm r,r,c
vector signed __int128vector signed __int128vector signed __int128vector signed __int128
vaddeuqm r,a,b,c
vector unsigned __int128vector unsigned __int128vector unsigned __int128vector unsigned __int128
vaddeuqm r,a,b,c

vec_addecVector Add Extended Carrying
r = vec_addec (a, b, c)
Purpose:
Returns a vector of carries 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.
Notes:
Code generated for this intrinsic should ensure only the
low-order bit of c participates
in the sum.
vspltiswvec_addecxxlandvec_addecvadduwmvec_addecvaddcuwvec_addecxxlorvec_addecvaddecuqvec_addecSupported type signatures for vec_addecrabcExample Implementationvector signed intvector signed intvector signed intvector 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 intvector unsigned intvector unsigned intvector 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 __int128vector signed __int128vector signed __int128vector signed __int128
vaddecuq r,a,b,c
vector unsigned __int128vector unsigned __int128vector unsigned __int128vector unsigned __int128
vaddecuq r,a,b,c

vec_addsVector 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.
vaddsbsvec_addsvaddubsvec_addsvaddshsvec_addsvadduhsvec_addsvaddswsvec_addsvadduwsvec_addsSupported type signatures for vec_addsrabExample Implementationvector signed charvector signed charvector signed char
vaddsbs r,a,b
vector unsigned charvector unsigned charvector unsigned char
vaddubs r,a,b
vector signed shortvector signed shortvector signed short
vaddshs r,a,b
vector unsigned shortvector unsigned shortvector unsigned short
vadduhs r,a,b
vector signed intvector signed intvector signed int
vaddsws r,a,b
vector unsigned intvector unsigned intvector unsigned int
vadduws r,a,b

vec_all_eqVector All Equal
r = vec_all_eq (a, b)
Purpose:
Tests whether all elements of a
are equal to the corresponding elements of b.
Result value: r is 1 if each
element of a is equal to the
corresponding element of b. Otherwise,
r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpequb.vec_all_eqmfocrfvec_all_eqrlwinmvec_all_eqvcmpequw.vec_all_eqvcmpequd.vec_all_eqvcmpequq.vec_all_eqvcmpequh.vec_all_eqxvcmpeqdp.vec_all_eqxvcmpeqsp.vec_all_eqsetbcvec_all_eqSupported type signatures for vec_all_eqrabExample ImplementationRestrictionsintvector bool char vector bool char
vcmpequb. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed char vector signed char
vcmpequb. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned char vector unsigned char
vcmpequb. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector bool short vector bool short
vcmpequh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed short vector signed short
vcmpequh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned short vector unsigned short
vcmpequh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector pixel vector pixel
vcmpequh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector bool int vector bool int
vcmpequw. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed int vector signed int
vcmpequw. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned int vector unsigned int
vcmpequw. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector bool long long vector bool long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed long long vector signed long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned long long vector unsigned long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector bool __int128vector bool __int128
vcmpequq. t,a,b
setbc r,24
ISA 3.1 or later
intvector signed __int128vector signed __int128
vcmpequq. t,a,b
setbc r,24
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpequq. t,a,b
setbc r,24
ISA 3.1 or later
intvector float vector float
xvcmpeqsp. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector double vector double
xvcmpeqdp. t,a,b
mfocrf u,2
rlwinm r,u,25,1

vec_all_geVector All Greater or Equal
r = vec_all_ge (a, b)
Purpose:
Tests whether all elements of a are
greater than or equal to the corresponding elements of b.
Result value: r is 1 if
all elements of a are greater
than or equal to the corresponding elements of b. Otherwise, r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpgtsb.vec_all_gemfocrfvec_all_gerlwinmvec_all_gevcmpgtub.vec_all_gevcmpgtsw.vec_all_gevcmpgtuw.vec_all_gevcmpgtsd.vec_all_gevcmpgtud.vec_all_gevcmpgtsq.vec_all_gevcmpgtuq.vec_all_gevcmpgtsh.vec_all_gevcmpgtuh.vec_all_gexvcmpgedp.vec_all_gexvcmpgesp.vec_all_gesetbcvec_all_geSupported type signatures for vec_all_gerabExample ImplementationRestrictionsintvector signed char vector signed char
vcmpgtsb. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned char vector unsigned char
vcmpgtub. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector signed short vector signed short
vcmpgtsh. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned short vector unsigned short
vcmpgtuh. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector signed int vector signed int
vcmpgtsw. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned int vector unsigned int
vcmpgtuw. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector signed long long vector signed long long
vcmpgtsd. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned long long vector unsigned long long
vcmpgtud. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector signed __int128vector signed __int128
vcmpgtsq. t,b,a
setbc r,26
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpgtuq. t,b,a
setbc r,26
ISA 3.1 or later
intvector float vector float
xvcmpgesp. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector double vector double
xvcmpgedp. t,a,b
mfocrf u,2
rlwinm r,u,25,1

vec_all_gtVector All Greater Than
r = vec_all_gt (a, b)
Purpose:
Tests whether all elements of a are
greater than the corresponding elements of b.
Result value: r is 1 if
all elements of a are greater
than the corresponding elements of b. Otherwise, r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpgtsb.vec_all_gtmfocrfvec_all_gtrlwinmvec_all_gtvcmpgtub.vec_all_gtvcmpgtsw.vec_all_gtvcmpgtuw.vec_all_gtvcmpgtsd.vec_all_gtvcmpgtud.vec_all_gtvcmpgtsq.vec_all_gtvcmpgtuq.vec_all_gtvcmpgtsh.vec_all_gtvcmpgtuh.vec_all_gtxvcmpgtdp.vec_all_gtxvcmpgtsp.vec_all_gtsetbcvec_all_gtSupported type signatures for vec_all_gtrabExample ImplementationRestrictionsintvector signed char vector signed char
vcmpgtsb. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned char vector unsigned char
vcmpgtub. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed short vector signed short
vcmpgtsh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned short vector unsigned short
vcmpgtuh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed int vector signed int
vcmpgtsw. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned int vector unsigned int
vcmpgtuw. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed long long vector signed long long
vcmpgtsd. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned long long vector unsigned long long
vcmpgtud. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed __int128vector signed __int128
vcmpgtsq. t,a,b
setbc r,24
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpgtuq. t,a,b
setbc r,24
ISA 3.1 or later
intvector float vector float
xvcmpgtsp. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector double vector double
xvcmpgtdp. t,a,b
mfocrf u,2
rlwinm r,u,25,1

vec_all_inVector All In Range
r = vec_all_in (a, b)
Purpose:
Tests whether all elements of a vector are within a given range.
Result value: r is 1 if each
element of a has a value less than or
equal to the value of the corresponding element of b, and greater than or equal to the negative of
the value of the corresponding element of b. Otherwise, r
is 0.Endian considerations:
None.
vcmpbfp.vec_all_inmfocrfvec_all_inrlwinmvec_all_inSupported type signatures for vec_all_inrabExample Implementationintvector float vector float
vcmpbfp. t,a,b
mfocrf u,2
rlwinm r,u,27,1

vec_all_leVector All Less or Equal
r = vec_all_le (a, b)
Purpose:
Tests whether all elements of a are
less than or equal to the corresponding elements of b.
Result value: r is 1 if all
elements of a are less than or equal to
the corresponding elements of b.
Otherwise, r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpgtsb.vec_all_lemfocrfvec_all_lerlwinmvec_all_levcmpgtub.vec_all_levcmpgtsw.vec_all_levcmpgtuw.vec_all_levcmpgtsd.vec_all_levcmpgtud.vec_all_levcmpgtsq.vec_all_levcmpgtuq.vec_all_levcmpgtsh.vec_all_levcmpgtuh.vec_all_lexvcmpgedp.vec_all_lexvcmpgesp.vec_all_lesetbc.vec_all_leSupported type signatures for vec_all_lerabExample ImplementationRestrictionsintvector signed char vector signed char
vcmpgtsb. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned char vector unsigned char
vcmpgtub. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector signed short vector signed short
vcmpgtsh. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned short vector unsigned short
vcmpgtuh. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector signed int vector signed int
vcmpgtsw. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned int vector unsigned int
vcmpgtuw. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector signed long long vector signed long long
vcmpgtsd. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned long long vector unsigned long long
vcmpgtud. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector signed __int128vector signed __int128
vcmpgtsq. t,a,b
setbc r,26
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpgtuq. t,a,b
setbc r,26
ISA 3.1 or later
intvector float vector float
xvcmpgesp. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector double vector double
xvcmpgedp. t,b,a
mfocrf u,2
rlwinm r,u,25,1

vec_all_ltVector All Less Than
r = vec_all_lt (a, b)
Purpose:
Tests whether all elements of a are
less than the corresponding elements of b.
Result value: r is 1 if all
elements of a are less than the
corresponding elements of b. Otherwise,
r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpgtsb.vec_all_ltmfocrfvec_all_ltrlwinmvec_all_ltvcmpgtub.vec_all_ltvcmpgtsw.vec_all_ltvcmpgtuw.vec_all_ltvcmpgtsd.vec_all_ltvcmpgtud.vec_all_ltvcmpgtsq.vec_all_ltvcmpgtuq.vec_all_ltvcmpgtsh.vec_all_ltvcmpgtuh.vec_all_ltxvcmpgtdp.vec_all_ltxvcmpgtsp.vec_all_ltsetbcvec_all_ltSupported type signatures for vec_all_ltrabExample ImplementationRestrictionsintvector signed char vector signed char
vcmpgtsb. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned char vector unsigned char
vcmpgtub. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector signed short vector signed short
vcmpgtsh. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned short vector unsigned short
vcmpgtuh. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector signed int vector signed int
vcmpgtsw. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned int vector unsigned int
vcmpgtuw. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector signed long long vector signed long long
vcmpgtsd. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned long long vector unsigned long long
vcmpgtud. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector signed __int128vector signed __int128
vcmpgtsq. t,b,a
setbc r,24
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpgtuq. t,b,a
setbc r,24
ISA 3.1 or later
intvector float vector float
xvcmpgtsp. t,b,a
mfocrf u,2
rlwinm r,u,25,1
intvector double vector double
xvcmpgtdp. t,b,a
mfocrf u,2
rlwinm r,u,25,1

vec_all_nanVector All Not-a-Number
r = vec_all_nan (a)
Purpose:
Tests whether all elements of a
are not-a-number (NaN).
Result value: r is 1 if
all elements of a are
NaN. Otherwise, r is 0.Endian considerations:
None.
xvcmpeqdp.vec_all_nanmfocrfvec_all_nanrlwinmvec_all_nanxvcmpeqsp.vec_all_nanSupported type signatures for vec_all_nanraExample Implementationintvector float
xvcmpeqsp. t,a,a
mfocrf u,2
rlwinm r,u,27,1
intvector double
xvcmpeqdp. t,a,a
mfocrf u,2
rlwinm r,u,27,1

vec_all_neVector All Not Equal
r = vec_all_ne (a, b)
Purpose:
Tests whether all elements of a
are not equal to the corresponding elements of b.
Result value: r is 1 if
all elements of a are not equal
to the corresponding elements of b. Otherwise, r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpneb.vec_all_nemfocrfvec_all_nerlwinmvec_all_nevcmpnew.vec_all_nevcmpequd.vec_all_nevcmpequq.vec_all_nevcmpneh.vec_all_nexvcmpeqdp.vec_all_nexvcmpeqsp.vec_all_nesetbcvec_all_neSupported type signatures for vec_all_nerabExample ImplementationRestrictionsintvector bool char vector bool char
vcmpneb. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed char vector signed char
vcmpneb. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned char vector unsigned char
vcmpneb. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector bool short vector bool short
vcmpneh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed short vector signed short
vcmpneh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned short vector unsigned short
vcmpneh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector pixel vector pixel
vcmpneh. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector bool int vector bool int
vcmpnew. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector signed int vector signed int
vcmpnew. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector unsigned int vector unsigned int
vcmpnew. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector bool long long vector bool long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector signed long long vector signed long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector unsigned long long vector unsigned long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector bool __int128vector bool __int128
vcmpequq. t,a,b
setbc r,26
ISA 3.1 or later
intvector signed __int128vector signed __int128
vcmpequq. t,a,b
setbc r,26
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpequq. t,a,b
setbc r,26
ISA 3.1 or later
intvector float vector float
xvcmpeqsp. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector double vector double
xvcmpeqdp. t,a,b
mfocrf u,2
rlwinm r,u,27,1

vec_all_ngeVector All Not Greater or Equal
r = vec_all_nge (a, b)
Purpose:
Tests whether all elements of a
are not greater than or equal to the corresponding elements of
b.
Result value: r is 1 if
all elements of a are not
greater than or equal to the corresponding elements of b. Otherwise, r is 0.Endian considerations:
None.
xvcmpeqdp.vec_all_ngemfocrfvec_all_ngerlwinmvec_all_ngexvcmpeqsp.vec_all_ngeSupported type signatures for vec_all_ngerabExample Implementationintvector float vector float
xvcmpgesp. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector double vector double
xvcmpgedp. t,a,b
mfocrf u,2
rlwinm r,u,27,1

vec_all_ngtVector All Not Greater Than
r = vec_all_ngt (a, b)
Purpose:
Tests whether all elements of a
are not greater than the corresponding elements of b.
Result value: r is 1 if
all elements of a are not
greater than the corresponding elements of b. Otherwise, r is 0.Endian considerations:
None.
xvcmpgtdp.vec_all_ngtmfocrfvec_all_ngtrlwinmvec_all_ngtxvcmpgtsp.vec_all_ngtSupported type signatures for vec_all_ngtrabExample Implementationintvector float vector float
xvcmpgtsp. t,a,b
mfocrf u,2
rlwinm r,u,27,1
intvector double vector double
xvcmpgtdp. t,a,b
mfocrf u,2
rlwinm r,u,27,1

vec_all_nleVector All Not Less or Equal
r = vec_all_nle (a, b)
Purpose:
Tests whether all elements of a
are not less than or equal to the corresponding elements of
b.
Result value: r is 1 if
all elements of a are not less
than or equal to the corresponding elements of b. Otherwise, r is 0.Endian considerations:
None.
xvcmpgedp.vec_all_nlemfocrfvec_all_nlerlwinmvec_all_nlexvcmpgesp.vec_all_nleSupported type signatures for vec_all_nlerabExample Implementationintvector float vector float
xvcmpgesp. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector double vector double
xvcmpgedp. t,b,a
mfocrf u,2
rlwinm r,u,27,1

vec_all_nltVector All Not Less Than
r = vec_all_nlt (a, b)
Purpose:
Tests whether all elements of a
are not less than the corresponding elements of b.
Result value: r is 1 if
all elements of a are not less
than the corresponding elements of b. Otherwise, r is 0.Endian considerations:
None.
xvcmpgtdp.vec_all_nltmfocrfvec_all_nltrlwinmvec_all_nltxvcmpgtsp.vec_all_nltSupported type signatures for vec_all_nltrabExample Implementationintvector float vector float
xvcmpgtsp. t,b,a
mfocrf u,2
rlwinm r,u,27,1
intvector double vector double
xvcmpgtdp. t,b,a
mfocrf u,2
rlwinm r,u,27,1

vec_all_numericVector All Numeric
r = vec_all_numeric (a)
Purpose:
Tests whether all elements of the vector are numeric (not NaN).
Result value: r is 1 if
all elements of a are numeric
(not NaN). Otherwise, r is
0.Endian considerations:
None.
xvcmpeqdp.vec_all_numericmfocrfvec_all_numericrlwinmvec_all_numericxvcmpeqsp.vec_all_numericSupported type signatures for vec_all_numericraExample Implementationintvector float
xvcmpeqsp. t,a,b
mfocrf u,2
rlwinm r,u,25,1
intvector double
xvcmpeqdp. t,a,b
mfocrf u,2
rlwinm r,u,25,1

vec_andVector 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.
xxlandvec_andSupported type signatures for vec_andrabExample ImplementationRestrictionsvector bool charvector bool charvector bool char
xxland r,a,b
vector signed charvector signed charvector signed char
xxland r,a,b
vector unsigned charvector unsigned charvector unsigned char
xxland r,a,b
vector bool shortvector bool shortvector bool short
xxland r,a,b
vector signed shortvector signed shortvector signed short
xxland r,a,b
vector unsigned shortvector unsigned shortvector unsigned short
xxland r,a,b
vector signed intvector signed intvector signed int
xxland r,a,b
vector bool intvector bool intvector bool int
xxland r,a,b
vector unsigned intvector unsigned intvector unsigned int
xxland r,a,b
vector bool long longvector bool long longvector bool long long
xxland r,a,b
vector signed long longvector signed long longvector signed long long
xxland r,a,b
vector unsigned long longvector unsigned long longvector unsigned long long
xxland r,a,b
vector floatvector floatvector float
xxland r,a,b
vector doublevector doublevector double
xxland r,a,b

vec_andcVector 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.
xxlandcvec_andcSupported type signatures for vec_andcrabExample ImplementationRestrictionsvector bool charvector bool charvector bool char
xxlandc r,a,b
vector signed charvector signed charvector signed char
xxlandc r,a,b
vector unsigned charvector unsigned charvector unsigned char
xxlandc r,a,b
vector bool shortvector bool shortvector bool short
xxlandc r,a,b
vector signed shortvector signed shortvector signed short
xxlandc r,a,b
vector unsigned shortvector unsigned shortvector unsigned short
xxlandc r,a,b
vector signed intvector signed intvector signed int
xxlandc r,a,b
vector bool intvector bool intvector bool int
xxlandc r,a,b
vector unsigned intvector unsigned intvector unsigned int
xxlandc r,a,b
vector bool long longvector bool long longvector bool long long
xxlandc r,a,b
vector signed long longvector signed long longvector signed long long
xxlandc r,a,b
vector unsigned long longvector unsigned long longvector unsigned long long
xxlandc r,a,b
vector floatvector floatvector float
xxlandc r,a,b
vector doublevector doublevector double
xxlandc r,a,b

vec_any_eqVector Any Equal
r = vec_any_eq (a, b)
Purpose:
Tests whether any element of a
is equal to the corresponding element of b.
Result value: r is 1 if any
element of a is equal to the
corresponding element of b. Otherwise,
r is 0.Endian considerations:
None.
Restrictions:
Not yet reviewed.
vcmpneb.vec_any_eqmfocrfvec_any_eqrlwinmvec_any_eqcntlzwvec_any_eqsrwivec_any_eqvcmpnew.vec_any_eqvcmpequd.vec_any_eqvcmpequq.vec_any_eqvcmpneh.vec_any_eqxvcmpeqdp.vec_any_eqxvcmpeqsp.vec_any_eqsetbcrvec_any_eqSupported type signatures for vec_any_eqrabExample ImplementationRestrictionsintvector bool char vector bool char
vcmpneb. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed char vector signed char
vcmpneb. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned char vector unsigned char
vcmpneb. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector bool short vector bool short
vcmpneh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed short vector signed short
vcmpneh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned short vector unsigned short
vcmpneh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector pixel vector pixel
vcmpneh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector bool int vector bool int
vcmpnew. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed int vector signed int
vcmpnew. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned int vector unsigned int
vcmpnew. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector bool long long vector bool long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector bool __int128vector bool __int128
vcmpequq. t,a,b
setbcr r,26
ISA 3.1 or later
intvector signed __int128vector signed __int128
vcmpequq. t,a,b
setbcr r,26
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpequq. t,a,b
setbcr r,26
ISA 3.1 or later
intvector float vector float
xvcmpeqsp. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector double vector double
xvcmpeqdp. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5

vec_any_geVector Any Greater or Equal
r = vec_any_ge (a, b)
Purpose:
Tests whether any element of a is
greater than or equal to the corresponding element of b.
Result value: r is 1 if any
element of a is greater than or equal
to the corresponding element of b.
Otherwise, r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpgtsb.vec_any_gemfocrfvec_any_gerlwinmvec_any_gecntlzwvec_any_gesrwivec_any_gevcmpgtub.vec_any_gevcmpgtsw.vec_any_gevcmpgtuw.vec_any_gevcmpgtsd.vec_any_gevcmpgtud.vec_any_gevcmpgtsq.vec_any_gevcmpgtuq.vec_any_gevcmpgtsh.vec_any_gevcmpgtuh.vec_any_gexvcmpgedp.vec_any_gexvcmpgesp.vec_any_gesetbcrvec_any_geSupported type signatures for vec_any_gerabExample ImplementationRestrictionsintvector signed char vector signed char
vcmpgtsb. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned char vector unsigned char
vcmpgtub. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed short vector signed short
vcmpgtsh. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned short vector unsigned short
vcmpgtuh. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed int vector signed int
vcmpgtsw. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned int vector unsigned int
vcmpgtuw. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpgtsd. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpgtud. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpgtsd. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpgtud. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpgtsd. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpgtud. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed __int128vector signed __int128
vcmpgtsq. t,b,a
setbcr r,24
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpgtuq. t,b,a
setbcr r,24
ISA 3.1 or later
intvector double vector double
xvcmpgedp. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector float vector float
vcmpgesp. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5

vec_any_gtVector Any Greater Than
r = vec_any_gt (a, b)
Purpose:
Tests whether any element of a is
greater than the corresponding element of b.
Result value: r is 1 if any
element of a is greater than the
corresponding element of b. Otherwise,
r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpgtsb.vec_any_gtmfocrfvec_any_gtrlwinmvec_any_gtcntlzwvec_any_gtsrwivec_any_gtvcmpgtub.vec_any_gtvcmpgtsw.vec_any_gtvcmpgtuw.vec_any_gtvcmpgtsd.vec_any_gtvcmpgtud.vec_any_gtvcmpgtsq.vec_any_gtvcmpgtuq.vec_any_gtvcmpgtsh.vec_any_gtvcmpgtuh.vec_any_gtxvcmpgtdp.vec_any_gtxvcmpgtsp.vec_any_gtsetbcrvec_any_gtSupported type signatures for vec_any_gtrabExample ImplementationRestrictionsintvector signed char vector signed char
vcmpgtsb. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned char vector unsigned char
vcmpgtub. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed short vector signed short
vcmpgtsh. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned short vector unsigned short
vcmpgtuh. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed int vector signed int
vcmpgtsw. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned int vector unsigned int
vcmpgtuw. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpgtsd. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpgtud. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed __int128vector signed __int128
vcmpgtsq. t,a,b
setbcr r,26
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpgtuq. t,a,b
setbcr r,26
ISA 3.1 or later
intvector float vector float
xvcmpgtsp. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector double vector double
xvcmpgtdp. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5

vec_any_leVector Any Less or Equal
r = vec_any_le (a, b)
Purpose:
Tests whether any element of a is less
than or equal to the corresponding element of b.
Result value: r is 1 if any
element of a is less than or equal to
the corresponding element of b.
Otherwise, r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpgtsb.vec_any_lemfocrfvec_any_lerlwinmvec_any_lecntlzwvec_any_lesrwivec_any_levcmpgtub.vec_any_levcmpgtsw.vec_any_levcmpgtuw.vec_any_levcmpgtsd.vec_any_levcmpgtud.vec_any_levcmpgtsq.vec_any_levcmpgtuq.vec_any_levcmpgtsh.vec_any_levcmpgtuh.vec_any_lexvcmpgedp.vec_any_lexvcmpgesp.vec_any_lesetbcrvec_any_leSupported type signatures for vec_any_lerabExample ImplementationRestrictionsintvector signed char vector signed char
vcmpgtsb. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned char vector unsigned char
vcmpgtub. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed short vector signed short
vcmpgtsh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned short vector unsigned short
vcmpgtuh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed int vector signed int
vcmpgtsw. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned int vector unsigned int
vcmpgtuw. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpgtsd. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpgtud. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpgtsd. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpgtud. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed __int128vector signed __int128
vcmpgtsq. t,a,b
setbcr 3,24
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpgtuq. t,a,b
setbcr 3,24
ISA 3.1 or later
intvector float vector float
xvcmpgesp. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector double vector double
xvcmpgedp. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5

vec_any_ltVector Any Less Than
r = vec_any_lt (a, b)
Purpose:
Tests whether any element of a is less
than the corresponding element of b.
Result value: r is 1 if any
element of a is less than the
corresponding element of b. Otherwise,
r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpgtsb.vec_any_ltmfocrfvec_any_ltrlwinmvec_any_ltcntlzwvec_any_ltsrwivec_any_ltvcmpgtub.vec_any_ltvcmpgtsw.vec_any_ltvcmpgtuw.vec_any_ltvcmpgtsd.vec_any_ltvcmpgtud.vec_any_ltvcmpgtsq.vec_any_ltvcmpgtuq.vec_any_ltvcmpgtsh.vec_any_ltvcmpgtuh.vec_any_ltxvcmpgtdp.vec_any_ltxvcmpgtsp.vec_any_ltsetbcrvec_any_ltSupported type signatures for vec_any_ltrabExample ImplementationRestrictionsintvector signed char vector signed char
vcmpgtsb. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned char vector unsigned char
vcmpgtub. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed short vector signed short
vcmpgtsh. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned short vector unsigned short
vcmpgtuh. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed int vector signed int
vcmpgtsw. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned int vector unsigned int
vcmpgtuw. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpgtsd. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpgtud. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector signed __int128vector signed __int128
vcmpgtsq. t,b,a
setbcr r,26
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpgtuq. t,b,a
setbcr r,26
ISA 3.1 or later
intvector float vector float
xvcmpgtsp. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector double vector double
xvcmpgtdp. t,b,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5

vec_any_nanVector Any Not-a-Number
r = vec_any_nan (a)
Purpose:
Tests whether any element of the source vector is a NaN.
Result value: r is 1 if any
element of a is a NaN. Otherwise,
r is 0.Endian considerations:
None.
xvcmpeqdp.vec_any_nanmfocrfvec_any_nanrlwinmvec_any_nancntlzwvec_any_nansrwivec_any_nanxvcmpeqsp.vec_any_nanSupported type signatures for vec_any_nanraExample Implementationintvector float
xvcmpeqsp. t,a,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector double
xvcmpeqdp. t,a,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5

vec_any_neVector Any Not Equal
r = vec_any_ne (a, b)
Purpose:
Tests whether any element of a
is not equal to the corresponding element of b.
Result value: r is 1 if any
element of a is not equal to the
corresponding element of b. Otherwise,
r is 0.Endian considerations:
None.
Review status:
Not yet reviewed.
vcmpequb.vec_any_nemfocrfvec_any_nerlwinmvec_any_necntlzwvec_any_nesrwivec_any_nevcmpequw.vec_any_nevcmpequd.vec_any_nevcmpequq.vec_any_nevcmpequh.vec_any_nexvcmpeqdp.vec_any_nexvcmpeqsp.vec_any_nesetbcrvec_any_neSupported type signatures for vec_any_nerabExample ImplementationRestrictionsintvector bool char vector bool char
vcmpequb. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed char vector signed char
vcmpequb. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned char vector unsigned char
vcmpequb. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector bool short vector bool short
vcmpequh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed short vector signed short
vcmpequh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned short vector unsigned short
vcmpequh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector pixel vector pixel
vcmpequh. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector bool int vector bool int
vcmpequw. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed int vector signed int
vcmpequw. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned int vector unsigned int
vcmpequw. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector bool long long vector bool long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector signed long long vector signed long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector unsigned long long vector unsigned long long
vcmpequd. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector bool __int128vector bool __int128
vcmpequq. t,a,b
setbcr r,24
ISA 3.1 or later
intvector signed __int128vector signed __int128
vcmpequq. t,a,b
setbcr r,24
ISA 3.1 or later
intvector unsigned __int128vector unsigned __int128
vcmpequq. t,a,b
setbcr r,24
ISA 3.1 or later
intvector float vector float
xvcmpeqsp. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector double vector double
xvcmpeqdp. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5

vec_any_ngeVector Any Not Greater or Equal
r = vec_any_nge (a, b)
Purpose:
Tests whether any element of a is not
greater than or equal to the corresponding element of b.
Result value: r is 1 if any
element of a is not greater than or
equal to the corresponding element of b. Otherwise, r
is 0.Endian considerations:
None.
xvcmpgedp.vec_any_ngemfocrfvec_any_ngerlwinmvec_any_ngecntlzwvec_any_ngesrwivec_any_ngexvcmpgesp.vec_any_ngeSupported type signatures for vec_any_ngerabExample Implementationintvector floatvector float
xvcmpgesp. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector doublevector double
xvcmpgedp. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5

vec_any_ngtVector Any Not Greater Than
r = vec_any_ngt (a, b)
Purpose:
Tests whether any element of a is not
greater than the corresponding element of b.
Result value: r is 1 if any
element of a is not greater than the
corresponding element of b. Otherwise,
r is 0.Endian considerations:
None.
xvcmpgtdp.vec_any_ngtmfocrfvec_any_ngtrlwinmvec_any_ngtcntlzwvec_any_ngtsrwivec_any_ngtxvcmpgtsp.vec_any_ngtSupported type signatures for vec_any_ngtrabExample Implementationintvector float vector float
xvcmpgtsp. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector double vector double
xvcmpgtdp. t,a,b
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5

vec_any_nleVector Any Not Less or Equal
r = vec_any_nle (a, b)
Purpose:
Tests whether any element of a is not
less than or equal to the corresponding element of b.
Result value: r is 1 if any
element of a is not less than or equal
to the corresponding element of b.
Otherwise, r is 0.Endian considerations:
None.
xvcmpgedp.vec_any_nlemfocrfvec_any_nlerlwinmvec_any_nlecntlzwvec_any_nlesrwivec_any_nlexvcmpgesp.vec_any_nleSupported type signatures for vec_any_nlerabExample Implementationintvector float vector float
xvcmpgesp. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector double vector double
xvcmpgedp. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5

vec_any_nltVector Any Not Less Than
r = vec_any_nlt (a, b)
Purpose:
Tests whether any element of a is not
less than the corresponding element of b.
Result value: r is 1 if any
element of a is not less than the
corresponding element of b. Otherwise,
r is 0.Endian considerations:
None.
xvcmpgtdp.vec_any_nltmfocrfvec_any_nltrlwinmvec_any_nltcntlzwvec_any_nltsrwivec_any_nltxvcmpgtsp.vec_any_nltSupported type signatures for vec_any_nltrabExample Implementationintvector float vector float
xvcmpgtdp. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5
intvector double vector double
xvcmpgtdp. t,b,a
mfocrf u,2
rlwinm v,u,25,1
cntlzw w,v
srwi r,w,5

vec_any_numericVector Any Numeric
r = vec_any_numeric (a)
Purpose:
Tests whether any element of the source vector is numeric (not a NaN).
Result value: r is 1 if any
element of a is numeric (not a NaN).
Otherwise, r is 0.Endian considerations:
None.
xvcmpeqdp.vec_any_numericmfocrfvec_any_numericrlwinmvec_any_numericcntlzwvec_any_numericsrwivec_any_numericxvcmpeqsp.vec_any_numericSupported type signatures for vec_any_numericraExample Implementationintvector float
xvcmpeqsp. t,a,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5
intvector double
xvcmpeqdp. t,a,a
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5

vec_any_outVector Any Out of Range
r = vec_any_out (a, b)
Purpose:
Tests whether the value of any element of a vector is outside of a
given range.
Result value: r is 1 if the
value of any element of a is greater
than the value of the corresponding element of b or less than the negative of the value of the
corresponding element of b. Otherwise,
r is 0.Endian considerations:
None.
vcmpbfp.vec_any_outmfocrfvec_any_outrlwinmvec_any_outcntlzwvec_any_outsrwivec_any_outSupported type signatures for vec_any_outrabExample Implementationintvector float vector float
vcmpbfp. t,a,b
mfocrf u,2
rlwinm v,u,27,1
cntlzw w,v
srwi r,w,5

vec_avgVector 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.
vavgsbvec_avgvavgubvec_avgvavgshvec_avgvavguhvec_avgvavgswvec_avgvavguwvec_avgSupported type signatures for vec_avgrabExample Implementationvector signed charvector signed charvector signed char
vavgsb r,a,b
vector unsigned charvector unsigned charvector unsigned char
vavgub r,a,b
vector signed shortvector signed shortvector signed short
vavgsh r,a,b
vector unsigned shortvector unsigned shortvector unsigned short
vavguh r,a,b
vector signed intvector signed intvector signed int
vavgsw r,a,b
vector unsigned intvector unsigned intvector unsigned int
vavguw r,a,b

vec_bpermVector 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
48+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 (8i +
j)th
element of b.
If bit index k is greater than or
equal to 64, bit 56+j of element
i of r is set to 0.
If bit index k is less than 64,
bit 56+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.
An example for input a
of type vector unsigned char follows:
byte index0123456789101112131415aFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA9b7F7E7D7C7B7A79787776757473727170
Zoom in to view just the two bytes in a
([14..15]) containing the bits referenced by the bit indices
b[i]
(0 ≤ i < 16),
([7F..70]):
byte index1415bit index707172737475767778797A7B7C7D7E7FaFFA9bitabit index1111111110101001bitab[i]1001010111111111intermediate result95FFbyte index0123456789101112131415r00000000000095FF0000000000000000Endian 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.
vbpermqvec_bpermvbpermdvec_bpermSupported type signatures for vec_bpermrabExample ImplementationRestrictionsvector unsigned charvector unsigned charvector unsigned char
vbpermq r,a,b
vector unsigned long longvector unsigned __int128vector unsigned char
vbpermq r,a,b
vector unsigned long longvector unsigned long longvector unsigned char
vbpermd r,a,b
ISA 3.0 or later

vec_ceilVector 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.
xvrspipvec_ceilxvrdpipvec_ceilSupported type signatures for vec_ceilraExample Implementationvector floatvector float
xvrspip r,a
vector doublevector double
xvrdpip r,a

vec_cfugeVector Centrifuge
r = vec_cfuge (a, b)
Purpose:
For each element in an input vector, separates its bits to the
right and left within a target vector element, according to the
mask in the corresponding element of a second input vector.
Result value:
For each element of a, the bits
whose corresponding bits in the mask in the corresponding
element of b equal 1 are placed
in the rightmost bits in the corresponding element of r, maintaining their original relative
order. The other bits of the element of a are placed in the leftmost bits in the
corresponding element of r,
maintaining their original relative order.
An example for doubleword inputs follows:
Element 0Element 1a0x0123456789abcdef0x0123456789abcdefb0x0f0f0f0f0f0f0f0f0xffff0000ffff0000r0x02468ace13579bdf0x4567cdef012389abEndian considerations:
None.
Review status:
Not yet reviewed.
vcfugedvec_cfugeSupported type signatures for vec_cfugerabExample ImplementationRestrictionsvector unsigned long longvector unsigned long longvector unsigned long long
vcfuged r,a,b
ISA 3.1 or later

vec_cipher_beVector AES Cipher Big-Endian
r = vec_cipher_be (a, b)
Purpose:
Performs one round of the AES cipher operation on an intermediate state
array a by using a given round key
b.
Result value: r contains the
resulting intermediate state, after one round of the AES cipher
operation on intermediate state array a,
using the round key specified by b.
Endian considerations:
All element and bit numberings of the AES cipher operation use
big-endian (i.e., left-to-right) order, reflecting the underlying
hardware instruction. Unlike most of the vector intrinsics in this
chapter, vec_cipher_be does not follow the bi-endian
programming model.
vciphervec_cipher_beSupported type signatures for vec_cipher_berabExample Implementationvector unsigned charvector unsigned char vector unsigned char
vcipher r,a,b

vec_cipherlast_beVector AES Cipher Last Big-Endian
r = vec_cipherlast_be (a, b)
Purpose:
Performs the final round of the AES cipher operation on an intermediate
state array a using the specified
round key b.
Result value: r contains the
resulting final state, after the final round of the AES cipher
operation on intermediate state array a,
using the round key specified by b.
Endian considerations:
All element and bit numberings of the AES cipher-last operation use
big-endian (i.e., left-to-right) order, reflecting the underlying
hardware instruction. Unlike most of the vector intrinsics in this
chapter, vec_cipherlast_be does not follow the bi-endian
programming model.
vcipherlastvec_cipherlast_beSupported type signatures for vec_cipherlast_berabExample Implementationvector unsigned charvector unsigned char vector unsigned char
vcipherlast r,a,b

vec_clr_firstVector Clear First
r = vec_clr_first (a, b)
Purpose:
Clear the first N elements of a vector to zero.
Result value:
Let N be the value of b.
The first N elements of r are
set to zero. The remaining elements of r are copied from the corresponding
elements of a.
b must have a value between 1
and the number of elements of a, inclusive, but need not be a literal
constant.
Endian considerations:
The element numbering within a register is left-to-right for
big-endian targets, and right-to-left for little-endian targets.
Review status:
Not yet reviewed.
vclrlbvec_clr_firstvclrrbvec_clr_firstSupported type signatures for vec_clr_firstrabExample LE ImplementationExample BE ImplementationRestrictionsvector signed charvector signed charunsigned int
vclrrb r,a,16-b
vclrlb r,a,16-b
ISA 3.1 or latervector unsigned charvector unsigned charunsigned int
vclrrb r,a,16-b
vclrlb r,a,16-b
ISA 3.1 or later

vec_clr_lastVector Clear Last
r = vec_clr_last (a, b)
Purpose:
Clear the last N elements of a vector to zero.
Result value:
Let N be the value of b.
The last N elements of r are
set to zero. The remaining elements of r are copied from the corresponding
elements of a.
b must have a value between 1
and the number of elements of a, inclusive, but need not be a literal
constant.
Endian considerations:
The element numbering within a register is left-to-right for
big-endian targets, and right-to-left for little-endian targets.
Review status:
Not yet reviewed.
vclrlbvec_clr_lastvclrrbvec_clr_lastSupported type signatures for vec_clr_lastrabExample LE ImplementationExample BE ImplementationRestrictionsvector signed charvector signed charunsigned int
vclrlb r,a,16-b
vclrrb r,a,16-b
ISA 3.1 or latervector unsigned charvector unsigned charunsigned int
vclrlb r,a,16-b
vclrrb r,a,16-b
ISA 3.1 or later

vec_cmpbVector Compare Bytes
r = vec_cmpb (a, b)
Purpose:
Performs a bounds comparison of each set of corresponding elements
of two 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.
vcmpbfpvec_cmpbSupported type signatures for vec_cmpbrabExample Implementationvector signed intvector floatvector float
vcmpbfp r,a,b

vec_cmpeqVector Compare Equal
r = vec_cmpeq (a, b)
Purpose:
Returns a vector containing the results of comparing each set of
corresponding elements of two 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.
Review status:
Not yet reviewed.
vcmpequbvec_cmpeqvcmpequhvec_cmpeqvcmpequwvec_cmpeqvcmpequdvec_cmpeqvcmpequqvec_cmpeqxvcmpeqspvec_cmpeqxvcmpeqdpvec_cmpeqSupported type signatures for vec_cmpeqrabExample ImplementationRestrictionsvector bool charvector bool charvector bool char
vcmpequb r,a,b
vector bool charvector signed charvector signed char
vcmpequb r,a,b
vector bool charvector unsigned charvector unsigned char
vcmpequb r,a,b
vector bool shortvector bool shortvector bool short
vcmpequh r,a,b
vector bool shortvector signed shortvector signed short
vcmpequh r,a,b
vector bool shortvector unsigned shortvector unsigned short
vcmpequh r,a,b
vector bool intvector bool intvector bool int
vcmpequw r,a,b
vector bool intvector signed intvector signed int
vcmpequw r,a,b
vector bool intvector unsigned intvector unsigned int
vcmpequw r,a,b
vector bool long longvector bool long longvector bool long long
vcmpequd r,a,b
vector bool long longvector signed long longvector signed long long
vcmpequd r,a,b
vector bool long longvector unsigned long longvector unsigned long long
vcmpequd r,a,b
vector bool __int128vector bool __int128vector bool __int128
vcmpequq r,a,b
ISA 3.1 or later
vector bool __int128vector signed __int128vector signed __int128
vcmpequq r,a,b
ISA 3.1 or later
vector bool __int128vector unsigned __int128vector unsigned __int128
vcmpequq r,a,b
ISA 3.1 or later
vector bool intvector floatvector float
xvcmpeqsp r,a,b
vector bool long longvector doublevector double
xvcmpeqdp r,a,b

vec_cmpgeVector 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 two
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.
Review status:
Not yet reviewed.
vcmpgtsbvec_cmpgexxlnorvec_cmpgevcmpgtubvec_cmpgevcmpgtshvec_cmpgevcmpgtuhvec_cmpgevcmpgtswvec_cmpgevcmpgtuwvec_cmpgevcmpgtsdvec_cmpgevcmpgtudvec_cmpgevcmpgtsqvec_cmpgevcmpgtuqvec_cmpgexvcmpgespvec_cmpgexvcmpgedpvec_cmpgeSupported type signatures for vec_cmpgerabExample ImplementationRestrictionsvector bool charvector signed charvector signed char
vcmpgtsb t,b,a
xxlnor r,t,t
vector bool charvector unsigned charvector unsigned char
vcmpgtub t,b,a
xxlnor r,t,t
vector bool shortvector signed shortvector signed short
vcmpgtsh t,b,a
xxlnor r,t,t
vector bool shortvector unsigned shortvector unsigned short
vcmpgtuh t,b,a
xxlnor r,t,t
vector bool intvector signed intvector signed int
vcmpgtsw t,b,a
xxlnor r,t,t
vector bool intvector unsigned intvector unsigned int
vcmpgtuw t,b,a
xxlnor r,t,t
vector bool long longvector signed long longvector signed long long
vcmpgtsd t,b,a
xxlnor r,t,t
vector bool long longvector unsigned long longvector unsigned long long
vcmpgtud t,b,a
xxlnor r,t,t
vector bool __int128vector signed __int128vector signed __int128
vcmpgtsq t,b,a
xxlnor r,t,t
ISA 3.1 or later
vector bool __int128vector unsigned __int128vector unsigned __int128
vcmpgtuq t,b,a
xxlnor r,t,t
ISA 3.1 or later
vector bool intvector floatvector float
xvcmpgesp r,a,b
vector bool long longvector doublevector double
xvcmpgedp r,a,b

vec_cmpgtVector 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 two
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.
Review status:
Not yet reviewed.
vcmpgtsbvec_cmpgtvcmpgtubvec_cmpgtvcmpgtshvec_cmpgtvcmpgtuhvec_cmpgtvcmpgtswvec_cmpgtvcmpgtuwvec_cmpgtvcmpgtsdvec_cmpgtvcmpgtudvec_cmpgtvcmpgtsqvec_cmpgtvcmpgtuqvec_cmpgtxvcmpgtspvec_cmpgtxvcmpgtdpvec_cmpgtSupported type signatures for vec_cmpgtrabExample ImplementationRestrictionsvector bool charvector signed charvector signed char
vcmpgtsb r,a,b
vector bool charvector unsigned charvector unsigned char
vcmpgtub r,a,b
vector bool shortvector signed shortvector signed short
vcmpgtsh r,a,b
vector bool shortvector unsigned shortvector unsigned short
vcmpgtuh r,a,b
vector bool intvector signed intvector signed int
vcmpgtsw r,a,b
vector bool intvector unsigned intvector unsigned int
vcmpgtuw r,a,b
vector bool long longvector signed long longvector signed long long
vcmpgtsd r,a,b
vector bool long longvector unsigned long longvector unsigned long long
vcmpgtud r,a,b
vector bool __int128vector signed __int128vector signed __int128
vcmpgtsq r,a,b
ISA 3.1 or later
vector bool __int128vector unsigned __int128vector unsigned __int128
vcmpgtuq r,a,b
ISA 3.1 or later
vector bool intvector floatvector float
xvcmpgtsp r,a,b
vector bool long longvector doublevector double
xvcmpgtdp r,a,b

vec_cmpleVector 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 two
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.
Review status:
Not yet reviewed.
vcmpgtsbvec_cmplexxlnorvec_cmplevcmpgtubvec_cmplevcmpgtshvec_cmplevcmpgtuhvec_cmplevcmpgtswvec_cmplevcmpgtuwvec_cmplevcmpgtsdvec_cmplevcmpgtudvec_cmplevcmpgtsqvec_cmplevcmpgtuqvec_cmplexvcmpgespvec_cmplexvcmpgedpvec_cmpleSupported type signatures for vec_cmplerabExample ImplementationRestrictionsvector bool charvector signed charvector signed char
vcmpgtsb t,a,b
xxlnor r,t,t
vector bool charvector unsigned charvector unsigned char
vcmpgtub t,a,b
xxlnor r,t,t
vector bool shortvector signed shortvector signed short
vcmpgtsh t,a,b
xxlnor r,t,t
vector bool shortvector unsigned shortvector unsigned short
vcmpgtuh t,a,b
xxlnor r,t,t
vector bool intvector signed intvector signed int
vcmpgtsw t,a,b
xxlnor r,t,t
vector bool intvector unsigned intvector unsigned int
vcmpgtuw t,a,b
xxlnor r,t,t
vector bool long longvector signed long longvector signed long long
vcmpgtsd t,a,b
xxlnor r,t,t
vector bool long longvector unsigned long longvector unsigned long long
vcmpgtud t,a,b
xxlnor r,t,t
vector bool __int128vector signed __int128vector signed __int128
vcmpgtsq t,a,b
xxlnor r,t,t
ISA 3.1 or later
vector bool __int128vector unsigned __int128vector unsigned __int128
vcmpgtuq t,a,b
xxlnor r,t,t
ISA 3.1 or later
vector bool intvector floatvector float
xvcmpgesp r,b,a
vector bool long longvector doublevector double
xvcmpgedp r,b,a

vec_cmpltVector 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 two
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.
Review status:
Not yet reviewed.
vcmpgtsbvec_cmpltvcmpgtubvec_cmpltvcmpgtshvec_cmpltvcmpgtuhvec_cmpltvcmpgtswvec_cmpltvcmpgtuwvec_cmpltvcmpgtsdvec_cmpltvcmpgtudvec_cmpltvcmpgtsqvec_cmpltvcmpgtuqvec_cmpltxvcmpgtspvec_cmpltxvcmpgtdpvec_cmpltSupported type signatures for vec_cmpltrabExample ImplementationRestrictionsvector bool charvector signed charvector signed char
vcmpgtsb r,b,a
vector bool charvector unsigned charvector unsigned char
vcmpgtub r,b,a
vector bool shortvector signed shortvector signed short
vcmpgtsh r,b,a
vector bool shortvector unsigned shortvector unsigned short
vcmpgtuh r,b,a
vector bool intvector signed intvector signed int
vcmpgtsw r,b,a
vector bool intvector unsigned intvector unsigned int
vcmpgtuw r,b,a
vector bool long longvector signed long longvector signed long long
vcmpgtsd r,b,a
vector bool long longvector unsigned long longvector unsigned long long
vcmpgtud r,b,a
vector bool __int128vector signed __int128vector signed __int128
vcmpgtsq r,b,a
ISA 3.1 or later
vector bool __int128vector unsigned __int128vector unsigned __int128
vcmpgtuq r,b,a
ISA 3.1 or later
vector bool intvector floatvector float
xvcmpgtsp r,b,a
vector bool long longvector doublevector double
xvcmpgtdp r,b,a

vec_cmpneVector Compare Not Equal
r = vec_cmpne (a, b)
Purpose:
Returns a vector containing the results of comparing each set of
corresponding elements of two 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.
Review status:
Not yet reviewed.
vcmpnebvec_cmpnevcmpnehvec_cmpnevcmpnewvec_cmpnevcmpequdvec_cmpnevcmpequqvec_cmpnexxlnorvec_cmpnexvcmpeqspvec_cmpnexvcmpeqdpvec_cmpneSupported type signatures for vec_cmpnerabExample ImplementationRestrictionsvector bool charvector bool charvector bool char
vcmpneb r,a,b
vector bool charvector signed charvector signed char
vcmpneb r,a,b
vector bool charvector unsigned charvector unsigned char
vcmpneb r,a,b
vector bool shortvector bool shortvector bool short
vcmpneh r,a,b
vector bool shortvector signed shortvector signed short
vcmpneh r,a,b
vector bool shortvector unsigned shortvector unsigned short
vcmpneh r,a,b
vector bool intvector bool intvector bool int
vcmpnew r,a,b
vector bool intvector signed intvector signed int
vcmpnew r,a,b
vector bool intvector unsigned intvector unsigned int
vcmpnew r,a,b
vector bool long longvector bool long longvector bool long long
vcmpequd t,a,b
xxlnor r,t,t
vector bool long longvector signed long longvector signed long long
vcmpequd t,a,b
xxlnor r,t,t
vector bool long longvector unsigned long longvector unsigned long long
vcmpequd t,a,b
xxlnor r,t,t
vector bool __int128vector bool __int128vector bool __int128
vcmpequq t,a,b
xxlnor r,t,t
ISA 3.1 or later
vector bool __int128vector signed __int128vector signed __int128
vcmpequq t,a,b
xxlnor r,t,t
ISA 3.1 or later
vector bool __int128vector unsigned __int128vector unsigned __int128
vcmpequq t,a,b
xxlnor r,t,t
ISA 3.1 or later
vector bool intvector floatvector float
xvcmpeqsp t,a,b
xxlnor r,t,t
vector bool long longvector doublevector double
xvcmpeqdp t,a,b
xxlnor r,t,t

vec_cmpnezVector 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 two 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.
vcmpnezbvec_cmpnezvcmpnezhvec_cmpnezvcmpnezwvec_cmpnezSupported type signatures for vec_cmpnezrabExample ImplementationRestrictionsvector bool charvector signed charvector signed char
vcmpnezb r,a,b
ISA 3.0 or latervector bool charvector unsigned charvector unsigned char
vcmpnezb r,a,b
ISA 3.0 or latervector bool shortvector signed shortvector signed short
vcmpnezh r,a,b
ISA 3.0 or latervector bool shortvector unsigned shortvector unsigned short
vcmpnezh r,a,b
ISA 3.0 or latervector bool intvector signed intvector signed int
vcmpnezw r,a,b
ISA 3.0 or latervector bool intvector unsigned intvector unsigned int
vcmpnezw r,a,b
ISA 3.0 or later

vec_cntlzVector 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 source vector.
Result value:
The value of each element of r is
set to the number of leading zeros of the corresponding element
of a.
An example for input a
of type vector unsigned char follows:
byte index0123456789101112131415a00102030485864748292A1B1C0D0E0F0r08030202010101010000000000000000Endian considerations:
None.
vclzbvec_cntlzvclzhvec_cntlzvclzwvec_cntlzvclzdvec_cntlzSupported type signatures for vec_cntlzraExample ImplementationRestrictionsvector signed charvector signed char
vclzb r,a
vector unsigned charvector unsigned char
vclzb r,a
vector signed shortvector signed short
vclzh r,a
vector unsigned shortvector unsigned short
vclzh r,a
vector signed intvector signed int
vclzw r,a
vector unsigned intvector unsigned int
vclzw r,a
vector signed long longvector signed long long
vclzd r,a
vector unsigned long longvector unsigned int long long
vclzd r,a

vec_cntlz_lsbbVector 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.
An example for input a
of type vector unsigned char follows:
byte index n 0123456789101112131415a00102030485864748292A1B1C0D0E0F0least-significant bit ofan0000000000110000r0x0A (10)Endian considerations:
The element numbering within a register is left-to-right for
big-endian targets, and right-to-left for little-endian
targets.
vclzlsbbvec_cntlz_lsbbSupported type signatures for vec_cntlz_lsbbraExample BE ImplementationExample LE ImplementationRestrictionssigned intvector signed char
vclzlsbb r,a
vctzlsbb r,a
ISA 3.0 or latersigned intvector unsigned char
vclzlsbb r,a
vctzlsbb r,a
ISA 3.0 or later

vec_cntlzmVector Count Leading Zeros Under Mask
r = vec_cntlzm (a, b)
Purpose:
For each element, returns the number of leading consecutive zero
bits in the first argument that correspond to one bits in the
second argument.
Result value:
Each element of r is set to the
number of consecutive zero bits, starting on the left, in the
corresponding element of a that
correspond to one bits in the corresponding element of b.
An example for doubleword inputs follows:
Element 0Element 1a0x0123456789abcdef0x0123456789abcdefb0xaaaaaaaaaaaaaaaa0xccccccccccccccccr59Endian considerations:
None.
Review status:
Not yet reviewed.
vclzdmvec_cntlzmSupported type signatures for vec_cntlzmrabExample ImplementationRestrictionsvector unsigned long longvector unsigned long longvector unsigned long long
vclzdm r,a,b
ISA 3.1 or later

vec_cntmVector Count Mask
r = vec_cntm (a, b)
Purpose:
Count the number of elements with their high-order bit equal to
a specific value.
Result value:
Let N be 7 when a is a vector
unsigned char, 6 when a is a
vector unsigned short, 5 when a
is a vector unsigned int, and 4 when a is a vector unsigned long long. Then
bits 0:N of r are set to the
number of elements in a whose
high-order bit is equal to b,
which must be either 0 or 1. Bits N+1:53 of r are set to 0.
Endian considerations:
None.
Notes:
The somewhat odd definition of the result value is intended to
allow r to be consumed
efficiently by the VSX Load Vector with Length
(lxvl) instruction.
Review status:
Not yet reviewed.
vcntmbbvec_cntmvcntmbhvec_cntmvcntmbwvec_cntmvcntmbdvec_cntmSupported type signatures for vec_cntmrabExample ImplementationRestrictionsunsigned long longvector unsigned charconst unsigned char
vcntmbb r,a,b
ISA 3.1 or laterunsigned long longvector unsigned shortconst unsigned char
vcntmbh r,a,b
ISA 3.1 or laterunsigned long longvector unsigned intconst unsigned char
vcntmbw r,a,b
ISA 3.1 or laterunsigned long longvector unsigned long longconst unsigned char
vcntmbd r,a,b
ISA 3.1 or later

vec_cnttzVector 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 source vector.
Result value:
The value of each element of r is
set to the number of trailing zeros of the corresponding element
of a.
An example for input a
of type vector unsigned char follows:
byte index0123456789101112131415a00102030485864748292A1B1C0D0E0F0r08040504030302020101000006040504Endian considerations:
None.
vctzbvec_cnttzvctzhvec_cnttzvctzwvec_cnttzvctzdvec_cnttzSupported type signatures for vec_cnttzraExample ImplementationRestrictionsvector signed charvector signed char
vctzb r,a
ISA 3.0 or latervector unsigned charvector unsigned char
vctzb r,a
ISA 3.0 or latervector signed shortvector signed short
vctzh r,a
ISA 3.0 or latervector unsigned shortvector unsigned short
vctzh r,a
ISA 3.0 or latervector signed intvector signed int
vctzw r,a
ISA 3.0 or latervector unsigned intvector unsigned int
vctzw r,a
ISA 3.0 or latervector signed long longvector signed long long
vctzd r,a
ISA 3.0 or latervector unsigned long longvector unsigned int long long
vctzd r,a
ISA 3.0 or later

vec_cnttz_lsbbVector 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.
An example for input a
of type vector unsigned char follows:
byte index n 0123456789101112131415a00102030485864748292A1B1C0D0E0F0least-significant bit ofan0000000000110000r0x04 (4)Endian considerations:
The element numbering within a register is left-to-right for
big-endian targets, and right-to-left for little-endian
targets.
vctzlsbbvec_cnttz_lsbbSupported type signatures for vec_cnttz_lsbbraExample BE ImplementationExample LE ImplementationRestrictionssigned intvector signed char
vctzlsbb r,a
vclzlsbb r,a
ISA 3.0 or latersigned intvector unsigned char
vctzlsbb r,a
vclzlsbb r,a
ISA 3.0 or later

vec_cnttzmVector Count Trailing Zeros Under Mask
r = vec_cnttzm (a, b)
Purpose:
For each element, returns the number of trailing consecutive
zero bits in the first argument that correspond to one bits in
the second argument.
Result value:
Each element of r is set to the
number of consecutive zero bits, starting on the right, in the
corresponding element of a that
correspond to one bits in the corresponding element of b.
An example for doubleword inputs follows:
Element 0Element 1a0xfedcba98765432100xfedcba9876543210b0xaaaaaaaaaaaaaaaa0xccccccccccccccccr48Endian considerations:
None.
Review status:
Not yet reviewed.
vctzdmvec_cnttzmSupported type signatures for vec_cnttzmrabExample ImplementationRestrictionsvector unsigned long longvector unsigned long longvector unsigned long long
vctzdm r,a,b
ISA 3.1 or later

vec_cpsgnVector 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.
xvcpsgnspvec_cpsgnxvcpsgndpvec_cpsgnSupported type signatures for vec_cpsgnrabExample ImplementationRestrictionsvector floatvector floatvector float
xvcpsgnsp r,b,a
vector doublevector doublevector double
xvcpsgndp r,b,a

vec_ctfVector 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 must
be in the range 0–31.
Endian considerations:
None.
Notes:
The example implementations below assume b is zero, so that the scaling code
is omitted. Scaling is accomplished by multiplying each
element of r by 2 to the
power of –b.
vcfsxvec_ctfvcfuxvec_ctfSupported type signatures for vec_ctfrabExample Implementationvector floatvector signed int5-bit unsigned literal
vcfsx r,a,b
vector floatvector unsigned int5-bit unsigned literal
vcfux r,a,b
vector doublevector signed long long5-bit unsigned literal
xvcvsxddp r,a,b
vector doublevector unsigned long long5-bit unsigned literal
xvcvuxddp r,a,b

vec_ctsVector 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 must be in the range 0–31.
Endian considerations:
None.
Review status:
Not yet reviewed.
Notes:
The example implementation when a is a vector double assumes that the
constant 2 to the power of b
has been loaded into floating-point register c.
vctsxsvec_ctsxvcvdpsxdsvec_ctsxvmuldpvec_ctsSupported type signatures for vec_ctsrabExample Implementationvector signed intvector float5-bit unsigned literal
vctsxs r,a,b
vector signed long longvector double5-bit unsigned literal
xvmuldp t,a,c
xvcvdpsxds r,t

vec_ctuVector 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 must be in the range 0–31.
Endian considerations:
None.
Review status:
Not yet reviewed.
Notes:
The example implementation when a is a vector double assumes that the
constant 2 to the power of b
has been loaded into floating-point register c.
vctuxsvec_ctuxvcvdpuxdsvec_ctuxvmuldpvec_ctuSupported type signatures for vec_cturabExample Implementationvector unsigned intvector float5-bit unsigned literal
vctuxs r,a,b
vector unsigned long longvector double5-bit unsigned literal
xvmuldp t,a,c
xvcvdpuxds r,t

vec_divVector 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.
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.
Notes:
For integer division, when any element of b is zero, the corresponding element of
r is undefined. For signed
integer division, when an element of a is the negative number with maximum
cardinality (e.g., 0x8000_0000 for 32-bit signed integers) and
the corresponding element of b is negative one, the corresponding
element of r is undefined.
Review status:
Changes other than __int128 reviewed by Paul Clarke and
Jinsong Ji. Added 0x8000_0000 example per Jinsong's comment.
Changes for __int128 have not yet been reviewed.
xxspltdvec_divmfvsrdvec_divdivdvec_divmtvsrdvec_divxxmrghdvec_divxvdivspvec_divxvdivdpvec_divvdivswvec_divvdivuwvec_divvdivsdvec_divvdivudvec_divvdivsqvec_divvdivuqvec_divSupported type signatures for vec_divrabExample ISA 2.07 and 3.0
ImplementationExample ISA 3.1
ImplementationRestrictionsvector signed intvector signed intvector signed intNot required
vdivsw r,a,b
ISA 3.1 or latervector unsigned intvector unsigned intvector unsigned intNot required
vdivuw r,a,b
ISA 3.1 or latervector signed long longvector signed long longvector 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
vdivsd r,a,b
vector unsigned long longvector unsigned long longvector 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
vdivud r,a,b
vector signed __int128vector signed __int128vector signed __int128Not required
vdivsq r,a,b
ISA 3.1 or latervector unsigned __int128vector unsigned __int128vector unsigned __int128Not required
vdivuq r,a,b
ISA 3.1 or latervector floatvector floatvector float
xvdivsp r,a,b
xvdivsp r,a,b
vector doublevector doublevector double
xvdivdp r,a,b
xvdivdp r,a,b

vec_diveVector Divide Extended
r = vec_dive (a, b)
Purpose:
Divides the left-shifted elements in one vector by the
corresponding elements in another vector and places the
quotients in the result vector.
Result value:
The value of each element of r is
obtained by shifting the corresponding element of a left by the element size in bits, and
then dividing that value by the corresponding element of b. For example, the shift amount is 32
bits for "int" and 64 bits for "long long."
Endian considerations:
None.
Notes:
When any element of b is
zero, the corresponding element of r is undefined. If any quotient cannot
be represented in the element type of r, the corresponding element of
r is undefined.
Review status:
Changes other than __int128 were reviewed by Paul Clarke and
Jinsong Ji. Updated language about the shift amount per
Jinsong's comment. Changes for __int128 have not yet been
reviewed.
vdiveswvec_divevdiveuwvec_divevdivesdvec_divevdiveudvec_divevdivesqvec_divevdiveuqvec_diveSupported type signatures for vec_diverabExample ImplementationRestrictionsvector signed intvector signed intvector signed int
vdivesw r,a,b
ISA 3.1 or latervector unsigned intvector unsigned intvector unsigned int
vdiveuw r,a,b
ISA 3.1 or latervector signed long longvector signed long longvector signed long long
vdivesd r,a,b
ISA 3.1 or latervector unsigned long longvector unsigned long longvector unsigned long long
vdiveud r,a,b
ISA 3.1 or latervector signed __int128vector signed __int128vector signed __int128
vdivesq r,a,b
ISA 3.1 or latervector unsigned __int128vector unsigned __int128vector unsigned __int128
vdiveuq r,a,b
ISA 3.1 or later

vec_doubleVector 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.
xvcvsxddpvec_doublexvcvuxddpvec_doubleSupported type signatures for vec_doubleraExample Implementationvector doublevector signed long long
xvcvsxddp r,a
vector doublevector unsigned long long
xvcvuxddp r,a

vec_doubleeVector 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.
An example for input a
of type vector signed int follows:
doubleword index01word index0123a00000001(ignored)FFFFFFFF(ignored)r1.0-1.0Endian considerations:
Differences in element numbering require different implementations
for big- and little-endian code generation.
xxsldwivec_doubleexvcvsxwdpvec_doubleexvcvuxwdpvec_doubleexvcvspdpvec_doubleeSupported type signatures for vec_doubleeraExample LE ImplementationExample BE ImplementationRestrictionsvector doublevector signed int
xxsldwi t,a,a,1
xvcvsxwdp r,t
xvcvsxwdp r,a
vector doublevector unsigned int
xxsldwi t,a,a,1
xvcvuxwdp r,t
xvcvuxwdp r,a
vector doublevector float
xxsldwi t,a,a,1
xvcvspdp r,t
xvcvspdp r,a

vec_doublehVector 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.
An example for input a
of type vector signed int follows:
doubleword index01word index0123a00000001FFFFFFFF(ignored)(ignored)r1.0-1.0Endian considerations:
Differences in element numbering require different implementations
for big- and little-endian code generation.
xxsldwivec_doublehxvcvsxwdpvec_doublehxvcvuxwdpvec_doublehxvcvspdpvec_doublehSupported type signatures for vec_doublehraExample LE ImplementationExample BE ImplementationRestrictionsvector doublevector signed int
xxsldwi t,a,a,3
xxsldwi u,a,t,2
xvcvsxwdp r,u
xxsldwi t,a,a,1
xxsldwi u,t,a,3
xvcvsxwdp r,u
vector doublevector unsigned int
xxsldwi t,a,a,3
xxsldwi u,a,t,2
xvcvuxwdp r,u
xxsldwi t,a,a,1
xxsldwi u,t,a,3
xvcvuxwdp r,u
vector doublevector float
xxsldwi t,a,a,3
xxsldwi u,a,t,2
xvcvspdp r,u
xxsldwi t,a,a,1
xxsldwi u,t,a,3
xvcvspdp r,u

vec_doublelVector 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.
An example for input a
of type vector signed int follows:
doubleword index01word index0123a(ignored)(ignored)00000001FFFFFFFFr1.0-1.0Endian considerations:
Differences in element numbering require different implementations
for big- and little-endian code generation.
xxsldwivec_doublelxvcvsxwdpvec_doublelxvcvuxwdpvec_doublelxvcvspdpvec_doublelSupported type signatures for vec_doublelraExample LE ImplementationExample BE ImplementationRestrictionsvector doublevector signed int
xxsldwi t,a,a,1
xxsldwi u,t,a,3
xvcvsxwdp r,u
xxsldwi t,a,a,3
xxsldwi u,a,t,2
xvcvsxwdp r,u
vector doublevector unsigned int
xxsldwi t,a,a,1
xxsldwi u,t,a,3
xvcvuxwdp r,u
xxsldwi t,a,a,3
xxsldwi u,a,t,2
xvcvuxwdp r,u
vector doublevector float
xxsldwi t,a,a,1
xxsldwi u,t,a,3
xvcvspdp r,u
xxsldwi t,a,a,3
xxsldwi u,a,t,2
xvcvspdp r,u

vec_doubleoVector 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.
An example for input a
of type vector signed int follows:
doubleword index01word index0123a(ignored)00000001(ignored)FFFFFFFFr1.0-1.0Endian considerations:
Differences in element numbering require different implementations
for big- and little-endian code generation.
xvcvsxwdpvec_doubleoxxsldwivec_doubleoxvcvuxwdpvec_doubleoxvcvspdpvec_doubleoSupported type signatures for vec_doubleoraExample LE ImplementationExample BE ImplementationRestrictionsvector doublevector signed int
xvcvsxwdp r,a
xxsldwi t,a,a,1
xvcvsxwdp r,t
vector doublevector unsigned int
xvcvuxwdp r,a
xxsldwi t,a,a,1
xvcvuxwdp r,t
vector doublevector float
xvcvspdp r,a
xxsldwi t,a,a,1
xvcvspdp r,t

vec_eqvVector 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.
xxleqvvec_eqvSupported type signatures for vec_eqvrabExample Implementationvector bool charvector bool charvector bool char
xxleqv r,a,b
vector signed charvector signed charvector signed char
xxleqv r,a,b
vector unsigned charvector unsigned charvector unsigned char
xxleqv r,a,b
vector bool shortvector bool shortvector bool short
xxleqv r,a,b
vector signed shortvector signed shortvector signed short
xxleqv r,a,b
vector unsigned shortvector unsigned shortvector unsigned short
xxleqv r,a,b
vector signed intvector signed intvector signed int
xxleqv r,a,b
vector bool intvector bool intvector bool int
xxleqv r,a,b
vector unsigned intvector unsigned intvector unsigned int
xxleqv r,a,b
vector bool long longvector bool long longvector bool long long
xxleqv r,a,b
vector signed long longvector signed long longvector signed long long
xxleqv r,a,b
vector unsigned long longvector unsigned long longvector unsigned long long
xxleqv r,a,b
vector floatvector floatvector float
xxleqv r,a,b
vector doublevector doublevector double
xxleqv r,a,b

vec_expandmVector Expand Mask
r = vec_expandm (a)
Purpose:
Create an element mask based on high-order bits in the input
elements.
Result value:
Each element of r is set to all
zeros if the high-order bit of the corresponding element of
a is equal to 0; otherwise it
is set to all ones.
Endian considerations:
None.
Review status:
Not yet reviewed.
vexpandbmvec_expandmvexpandhmvec_expandmvexpandwmvec_expandmvexpanddmvec_expandmvexpandqmvec_expandmSupported type signatures for vec_expandmraExample ImplementationRestrictionsvector unsigned charvector unsigned char
vexpandbm r,a
ISA 3.1 or latervector unsigned shortvector unsigned short
vexpandhm r,a
ISA 3.1 or latervector unsigned intvector unsigned int
vexpandwm r,a
ISA 3.1 or latervector unsigned long longvector unsigned long long
vexpanddm r,a
ISA 3.1 or latervector unsigned __int128vector unsigned __int128
vexpandqm r,a
ISA 3.1 or later

vec_expteVector 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.
vexptefpvec_expteSupported type signatures for vec_expteraExample Implementationvector floatvector float
vexptefp r,a

vec_extractVector 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.
Notes:
Prior to ISA 3.0, less efficient code sequences must be used to
implement vec_extract.
vextubrxvec_extractextsbvec_extractvextublxvec_extractslwivec_extractvextuwrxvec_extractextswvec_extractvextuwlxvec_extractxorivec_extractrldicvec_extractmtvsrddvec_extractvslovec_extractmfvsrdvec_extractvextuhrxvec_extractextshvec_extractvextuhlxvec_extractrldiclvec_extractsubficvec_extractsldivec_extractxscvspdpvec_extractSupported type signatures for vec_extractrabExample ISA 3.0 LE
ImplementationExample ISA 3.0 BE
Implementationsigned charvector signed charsigned int
vextubrx t,b,a
extsb r,t
vextublx t,b,a
extsb r,t
unsigned charvector bool char signed int
vextubrx t,b,a
vextublx t,b,a
unsigned charvector unsigned char signed int
vextubrx t,b,a
vextublx t,b,a
signed shortvector signed short signed int
slwi t,b,1
vextuhrx u,t,a
extsh r,u
slwi t,b,1
vextuhlx u,t,a
extsh r,u
unsigned shortvector bool short signed int
slwi t,b,1
vextuhrx r,t,a
slwi t,b,1
vextuhlx r,t,a
unsigned shortvector unsigned short signed int
slwi t,b,1
vextuhrx r,t,a
slwi t,b,1
vextuhlx r,t,a
signed intvector signed int signed int
slwi t,b,2
vextuwrx u,t,a
extsw r,u
slwi t,b,2
vextuwlx u,t,a
extsw r,u
unsigned intvector bool int signed int
slwi t,b,2
vextuwrx r,t,a
slwi t,b,2
vextuwlx r,t,a
unsigned intvector unsigned int signed int
slwi t,b,2
vextuwrx r,t,a
slwi t,b,2
vextuwlx r,t,a
signed long longvector signed long long signed int
xori t,b,0x1
rldic u,t,6,57
mtvsrdd v,u,u
vslo w,a,v
mfvsrd r,w
rldic t,b,6,57
mtvsrdd u,t,t
vslo v,a,u
mfvsrd r,v
unsigned long longvector bool long long signed int
xori t,b,0x1
rldic u,t,6,57
mtvsrdd v,u,u
vslo w,a,v
mfvsrd r,w
rldic t,b,6,57
mtvsrdd u,t,t
vslo v,a,u
mfvsrd r,v
unsigned long longvector unsigned long long signed int
xori t,b,0x1
rldic u,t,6,57
mtvsrdd v,u,u
vslo w,a,v
mfvsrd r,w
rldic t,b,6,57
mtvsrdd u,t,t
vslo v,a,u
mfvsrd r,v
floatvector float signed int
rldicl t,b,0,62
subfic u,t,3
sldi v,u,5
mtvsrdd w,v,v
vslo x,a,w
xscvspdp r,x
sldi t,b,5
mtvsrdd u,t,t
vslo v,a,u
xscvspdp r,v
doublevector double signed int
xori t,b,0x1
rldic u,t,6,57
mtvsrdd v,u,u
vslo r,a,v
rldic t,b,6,57
mtvsrdd u,t,t
vslo r,a,u

vec_extract_expVector Extract Exponent
r = vec_extract_exp (a)
Purpose:
Extracts exponents from a vector of floating-point numbers.
Result value:
Each element of r is extracted
from the exponent field of the corresponding floating-point
vector element of a.
The extracted exponents of a
are returned as right-justified unsigned integers containing biased
exponents, in accordance with the exponent representation specified
by IEEE 754, without further processing.Endian considerations:
None.
xvxexpdpvec_extract_expxvxexpspvec_extract_expSupported type signatures for vec_extract_expraExample ImplementationRestrictionsvector unsigned intvector float
xvxexpsp r,a
ISA 3.0 or latervector unsigned long longvector double
xvxexpdp r,a
ISA 3.0 or later

vec_extract_fp32_from_shorthVector Extract Floats from High Elements of Vector Short Int
r = vec_extract_fp32_from_shorth (a)
Purpose:
Extracts four single-precision floating-point numbers from the high
elements of a vector of eight 16-bit elements, interpreting each
element as a 16-bit floating-point number in IEEE format.
Result value:
The first four elements of a are
interpreted as 16-bit floating-point numbers in IEEE format, and
extended to single-precision format, returning a vector with four
single-precision IEEE numbers.An example follows:
halfword index01234567word index0123a3800(0.5)4200(3.0)4700(7.0)4B80(15.0)4FC0(31.0)53E0(63.0)57F0(127.0)5BF8(255.0)r0.53.07.015.0Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
Notes: The example
implementation assumes that the vperm instruction is used for
big-endian, and the vpermr instruction is used for
little-endian. The permute control vector for the vperm or
vpermr instruction is in a memory location identified by pcv.
The value located at pcv is identical in natural element order
for big- and little-endian: { 15, 14, 0, 0, 13, 12, 0, 0, 11,
10, 0, 0, 9, 8, 0, 0 }.
lxvvec_extract_fp32_from_shorthvpermvec_extract_fp32_from_shorthvpermrvec_extract_fp32_from_shorthxvcvhpspvec_extract_fp32_from_shorthSupported type signatures for vec_extract_fp32_from_shorthraExample ImplementationRestrictionsvector floatvector unsigned short
lxv t,0(pcv)
vperm[r] u,a,a,t
xvcvhpsp r,u
ISA 3.0 or later

vec_extract_fp32_from_shortlVector Extract Floats from Low Elements of Vector Short Int
r = vec_extract_fp32_from_shortl (a)
Purpose:
Extracts four single-precision floating-point numbers from the low
elements of a vector of eight 16-bit elements, interpreting each
element as a 16-bit floating-point number in IEEE format.
Result value:
The last four elements of a are
interpreted as 16-bit floating-point numbers in IEEE format, and
extended to single-precision format, returning a vector with four
single-precision IEEE numbers.An example follows:
halfword index01234567word index0123a3800(0.5)4200(3.0)4700(7.0)4B80(15.0)4FC0(31.0)53E0(63.0)57F0(127.0)5BF8(255.0)r31.063.0127.0255.0Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
Notes: The example
implementation assumes that the vperm instruction is used for
big-endian, and the vpermr instruction is used for
little-endian. The permute control vector for the vperm or
vpermr instruction is in a memory location identified by pcv.
The value located at pcv is identical in natural element order
for big- and little-endian: { 7, 6, 0, 0, 5, 4, 0, 0, 3, 2, 0,
0, 1, 0, 0, 0 }.
lxvvec_extract_fp32_from_shortlvpermvec_extract_fp32_from_shortlvpermrvec_extract_fp32_from_shortlxvcvhpspvec_extract_fp32_from_shortlSupported type signatures for vec_extract_fp32_from_shortlraExample ImplementationRestrictionsvector floatvector unsigned short
lxv t,0(pcv)
vperm[r] u,a,a,t
xvcvhpsp r,u
ISA 3.0 or later

vec_extract_sigVector Extract Significand
r = vec_extract_sig (a)
Purpose:
Extracts a vector of significands (mantissas) from a vector of
floating-point numbers.
Result value: Each element of
r is extracted from the significand
(mantissa) field of the corresponding floating-point element of
a.The significand is from the corresponding floating-point
number in accordance with the IEEE format. The returned result
includes the implicit leading digit. The value of that digit is
not encoded in the IEEE format, but is implied by the exponent.Endian considerations:
None.
xvxsigdpvec_extract_sigxvxsigspvec_extract_sigSupported type signatures for vec_extract_sigraExample ImplementationRestrictionsvector unsigned intvector float
xvxsigsp r,a
ISA 3.0 or latervector unsigned long longvector double
xvxsigdp r,a
ISA 3.0 or later

vec_extractmVector Extract Mask
r = vec_extractm (a)
Purpose:
Collect the high-order bits of each element of the input
vector.
Result value:
The contents of the high-order bit of each element of a are concatenated and placed in the
rightmost bits of r, with other
bits of r set to 0.
Endian considerations:
None.
Review status:
Not yet reviewed.
vextractbmvec_extractmvextracthmvec_extractmvextractwmvec_extractmvextractdmvec_extractmvextractqmvec_extractmSupported type signatures for vec_extractmraExample ImplementationRestrictionsunsigned intvector unsigned char
vextractbm r,a
ISA 3.1 or laterunsigned intvector unsigned short
vextracthm r,a
ISA 3.1 or laterunsigned intvector unsigned int
vextractwm r,a
ISA 3.1 or laterunsigned intvector unsigned long long
vextractdm r,a
ISA 3.1 or laterunsigned intvector unsigned __int128
vextractqm r,a
ISA 3.1 or later

vec_extract4bVector Extract Four Bytes
r = vec_extract4b (a, b)
Purpose:
Extracts a word from vector a at
constant byte position b.
Result value: The first
doubleword element of r contains
the zero-extended extracted word from a.
The second doubleword is set to 0. b
specifies the least-significant byte number (0â€“12) of the word
to be extracted.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xxextractuwvec_extract4bSupported type signatures for vec_extract4brabExample LE ImplementationExample BE ImplementationRestrictionsvector unsigned long longvector unsigned charconst int (range [0,12])
xxextractuw r,a,12-b
xxextractuw r,a,b
ISA 3.0 or later

vec_first_match_indexVector Index of First Match
r = vec_first_match_index (a, b)
Purpose:
Performs a comparison of equality on each of the corresponding
elements of a and b, and returns the first position of
equality.
Result value: Returns the
element index of the position of the first character match in
natural element order. If no match, returns the number of
characters as an element count in the vector argument.An example for input a
of type vector unsigned char follows:
byte index n 0123456789101112131415a0010203040??????????????????????bFFFFFFFF40??????????????????????r4Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vcmpnebvec_first_match_indexvcmpnehvec_first_match_indexvcmpnewvec_first_match_indexxxlnorvec_first_match_indexvctzlsbbvec_first_match_indexvclzlsbbvec_first_match_indexrldiclvec_first_match_indexSupported type signatures for vec_first_match_indexrabExample LE
ImplementationExample BE
ImplementationRestrictionsunsigned intvector signed char vector signed char
vcmpneb t,a,b
xxlnor u,t,t
vctzlsbb r,u
vcmpneb t,a,b
xxlnor u,t,t
vclzlsbb r,u
ISA 3.0 or laterunsigned intvector unsigned char vector unsigned char
vcmpneb t,a,b
xxlnor u,t,t
vctzlsbb r,u
vcmpneb t,a,b
xxlnor u,t,t
vclzlsbb r,u
ISA 3.0 or laterunsigned intvector signed short vector signed short
vcmpneh t,a,b
xxlnor u,t,t
vctzlsbb v,u
rldicl r,v,63,33
vcmpneh t,a,b
xxlnor u,t,t
vclzlsbb v,u
rldicl r,v,63,33
ISA 3.0 or laterunsigned intvector unsigned short vector unsigned short
vcmpneh t,a,b
xxlnor u,t,t
vctzlsbb v,u
rldicl r,v,63,33
vcmpneh t,a,b
xxlnor u,t,t
vclzlsbb v,u
rldicl r,v,63,33
ISA 3.0 or laterunsigned intvector signed int vector signed int
vcmpnew t,a,b
xxlnor u,t,t
vctzlsbb v,u
rldicl r,v,62,34
vcmpnew t,a,b
xxlnor u,t,t
vclzlsbb v,u
rldicl r,v,62,34
ISA 3.0 or laterunsigned intvector unsigned int vector unsigned int
vcmpnew t,a,b
xxlnor u,t,t
vctzlsbb v,u
rldicl r,v,62,34
vcmpnew t,a,b
xxlnor u,t,t
vclzlsbb v,u
rldicl r,v,62,34
ISA 3.0 or later

vec_first_match_or_eos_indexVector Index of First Match or End of String
r = vec_first_match_or_eos_index (a, b)
Purpose:
Performs a comparison of equality on each of the corresponding
elements of a and b. Returns the first position of
equality, or the zero string terminator.
Result value: Returns the
element index of the position, in natural element order, of
either the first character match or an end-of-string (EOS)
terminator. If no match or terminator, returns the number of
characters as an element count in the vector argument.An example for input a
of type vector unsigned char follows:
byte index n 0123456789101112131415a01020300????????????????????????bFFFFFFFF????????????????????????r3Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xxspltibvec_first_match_or_eos_indexvcmpnebvec_first_match_or_eos_indexvcmpnezbvec_first_match_or_eos_indexvcmpnehvec_first_match_or_eos_indexvcmpnezhvec_first_match_or_eos_indexvcmpnewvec_first_match_or_eos_indexvcmpnezwvec_first_match_or_eos_indexxxlandvec_first_match_or_eos_indexxxlnandvec_first_match_or_eos_indexvctzlsbbvec_first_match_or_eos_indexvclzlsbbvec_first_match_or_eos_indexrldiclvec_first_match_or_eos_indexSupported type signatures for vec_first_match_or_eos_indexrabExample LE
ImplementationExample BE
ImplementationRestrictionsunsigned intvector signed char vector signed char
xxspltib t,0
vcmpneb u,a,t
vcmpneb v,b,t
vcmpnezb w,a,b
xxland x,u,v
xxlnand y,x,w
vctzlsbb r,y
xxspltib t,0
vcmpneb u,a,t
vcmpneb v,b,t
vcmpnezb w,a,b
xxland x,u,v
xxlnand y,x,w
vclzlsbb r,y
ISA 3.0 or laterunsigned intvector unsigned char vector unsigned char
xxspltib t,0
vcmpneb u,a,t
vcmpneb v,b,t
vcmpnezb w,a,b
xxland x,u,v
xxlnand y,x,w
vctzlsbb r,y
xxspltib t,0
vcmpneb u,a,t
vcmpneb v,b,t
vcmpnezb w,a,b
xxland x,u,v
xxlnand y,x,w
vclzlsbb r,y
ISA 3.0 or laterunsigned intvector signed short vector signed short
xxspltib t,0
vcmpneh u,a,t
vcmpneh v,b,t
vcmpnezh w,a,b
xxland x,u,v
xxlnand y,x,w
vctzlsbb z,y
rldicl r,z,63,33
xxspltib t,0
vcmpneh u,a,t
vcmpneh v,b,t
vcmpnezh w,a,b
xxland x,u,v
xxlnand y,x,w
vclzlsbb z,y
rldicl r,z,63,33
ISA 3.0 or laterunsigned intvector unsigned short vector unsigned short
xxspltib t,0
vcmpneh u,a,t
vcmpneh v,b,t
vcmpnezh w,a,b
xxland x,u,v
xxlnand y,x,w
vctzlsbb z,y
rldicl r,z,63,33
xxspltib t,0
vcmpneh u,a,t
vcmpneh v,b,t
vcmpnezh w,a,b
xxland x,u,v
xxlnand y,x,w
vclzlsbb z,y
rldicl r,z,63,33
ISA 3.0 or laterunsigned intvector signed int vector signed int
xxspltib t,0
vcmpnew u,a,t
vcmpnew v,b,t
vcmpnezw w,a,b
xxland x,u,v
xxlnand y,x,w
vctzlsbb z,y
rldicl r,z,62,34
xxspltib t,0
vcmpnew u,a,t
vcmpnew v,b,t
vcmpnezw w,a,b
xxland x,u,v
xxlnand y,x,w
vclzlsbb z,y
rldicl r,z,62,34
ISA 3.0 or laterunsigned intvector unsigned int vector unsigned int
xxspltib t,0
vcmpnew u,a,t
vcmpnew v,b,t
vcmpnezw w,a,b
xxland x,u,v
xxlnand y,x,w
vctzlsbb z,y
rldicl r,z,62,34
xxspltib t,0
vcmpnew u,a,t
vcmpnew v,b,t
vcmpnezw w,a,b
xxland x,u,v
xxlnand y,x,w
vclzlsbb z,y
rldicl r,z,62,34
ISA 3.0 or later

vec_first_mismatch_indexVector Index of First Mismatch
r = vec_first_mismatch_index (a, b)
Purpose:
Performs a comparison of inequality on each of the corresponding
elements of a and b, and returns the first position of
inequality.
Result value: Returns the
element index of the position of the first character mismatch in
natural element order. If no mismatch, returns the number of
characters as an element count in the vector argument.An example for input a
of type vector unsigned char follows:
byte index n 0123456789101112131415a0001????????????????????????????b0002????????????????????????????r1Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vcmpnebvec_first_mismatch_indexvcmpnehvec_first_mismatch_indexvcmpnewvec_first_mismatch_indexvctzlsbbvec_first_mismatch_indexvclzlsbbvec_first_mismatch_indexrldiclvec_first_mismatch_indexSupported type signatures for vec_first_mismatch_indexrabExample LE
ImplementationExample BE
ImplementationRestrictionsunsigned intvector signed char vector signed char
vcmpneb t,a,b
vctzlsbb r,t
vcmpneb t,a,b
vclzlsbb r,t
ISA 3.0 or laterunsigned intvector unsigned char vector unsigned char
vcmpneb t,a,b
vctzlsbb r,t
vcmpneb t,a,b
vclzlsbb r,t
ISA 3.0 or laterunsigned intvector signed short vector signed short
vcmpneh t,a,b
vctzlsbb u,t
rldicl r,u,63,33
vcmpneh t,a,b
vclzlsbb u,t
rldicl r,u,63,33
ISA 3.0 or laterunsigned intvector unsigned short vector unsigned short
vcmpneh t,a,b
vctzlsbb u,t
rldicl r,u,63,33
vcmpneh t,a,b
vclzlsbb u,t
rldicl r,u,63,33
ISA 3.0 or laterunsigned intvector signed int vector signed int
vcmpnew t,a,b
vctzlsbb u,t
rldicl r,u,62,34
vcmpnew t,a,b
vclzlsbb u,t
rldicl r,u,62,34
ISA 3.0 or laterunsigned intvector unsigned int vector unsigned int
vcmpnew t,a,b
vctzlsbb u,t
rldicl r,u,62,34
vcmpnew t,a,b
vclzlsbb u,t
rldicl r,u,62,34
ISA 3.0 or later

vec_first_mismatch_or_eos_indexVector Index of First Mismatch or End of String
r = vec_first_mismatch_or_eos_index (a, b)
Purpose:
Performs a comparison of inequality on each of the corresponding
elements of a and b. Returns the first position of
inequality, or the zero string terminator.
Result value: Returns the
element index of the position, in natural element order, of
either the first character mismatch or an end-of-string (EOS)
terminator. If no mismatch or terminator, returns the number of
characters as an element count in the vector argument.An example for input a
of type vector unsigned char follows:
byte index n 0123456789101112131415a01020300????????????????????????b01020300????????????????????????r3Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xxspltibvec_first_mismatch_or_eos_indexvcmpnebvec_first_mismatch_or_eos_indexvcmpnezbvec_first_mismatch_or_eos_indexvcmpnehvec_first_mismatch_or_eos_indexvcmpnezhvec_first_mismatch_or_eos_indexvcmpnewvec_first_mismatch_or_eos_indexvcmpnezwvec_first_mismatch_or_eos_indexxxlandvec_first_mismatch_or_eos_indexxxlorcvec_first_mismatch_or_eos_indexvctzlsbbvec_first_mismatch_or_eos_indexvclzlsbbvec_first_mismatch_or_eos_indexrldiclvec_first_mismatch_or_eos_indexSupported type signatures for
vec_first_mismatch_or_eos_indexrabExample LE
ImplementationExample BE
ImplementationRestrictionsunsigned intvector signed char vector signed char
xxspltib t,0
vcmpneb u,a,t
vcmpneb v,b,t
vcmpnezb w,a,b
xxland x,u,v
xxlorc y,w,x
vctzlsbb r,y
xxspltib t,0
vcmpneb u,a,t
vcmpneb v,b,t
vcmpnezb w,a,b
xxland x,u,v
xxlorc y,w,x
vclzlsbb r,y
ISA 3.0 or laterunsigned intvector unsigned char vector unsigned char
xxspltib t,0
vcmpneb u,a,t
vcmpneb v,b,t
vcmpnezb w,a,b
xxland x,u,v
xxlorc y,w,x
vctzlsbb r,y
xxspltib t,0
vcmpneb u,a,t
vcmpneb v,b,t
vcmpnezb w,a,b
xxland x,u,v
xxlorc y,w,x
vclzlsbb r,y
ISA 3.0 or laterunsigned intvector signed short vector signed short
xxspltib t,0
vcmpneh u,a,t
vcmpneh v,b,t
vcmpnezh w,a,b
xxland x,u,v
xxlorc y,w,x
vctzlsbb z,y
rldicl r,z,63,33
xxspltib t,0
vcmpneh u,a,t
vcmpneh v,b,t
vcmpnezh w,a,b
xxland x,u,v
xxlorc y,w,x
vclzlsbb z,y
rldicl r,z,63,33
ISA 3.0 or laterunsigned intvector unsigned short vector unsigned short
xxspltib t,0
vcmpneh u,a,t
vcmpneh v,b,t
vcmpnezh w,a,b
xxland x,u,v
xxlorc y,w,x
vctzlsbb z,y
rldicl r,z,63,33
xxspltib t,0
vcmpneh u,a,t
vcmpneh v,b,t
vcmpnezh w,a,b
xxland x,u,v
xxlorc y,w,x
vclzlsbb z,y
rldicl r,z,63,33
ISA 3.0 or laterunsigned intvector signed int vector signed int
xxspltib t,0
vcmpnew u,a,t
vcmpnew v,b,t
vcmpnezw w,a,b
xxland x,u,v
xxlorc y,w,x
vctzlsbb z,y
rldicr r,z,62,34
xxspltib t,0
vcmpnew u,a,t
vcmpnew v,b,t
vcmpnezw w,a,b
xxland x,u,v
xxlorc y,w,x
vclzlsbb z,y
rldicr r,z,62,34
ISA 3.0 or laterunsigned intvector unsigned int vector unsigned int
xxspltib t,0
vcmpnew u,a,t
vcmpnew v,b,t
vcmpnezw w,a,b
xxland x,u,v
xxlorc y,w,x
vctzlsbb z,y
rldicr r,z,62,34
xxspltib t,0
vcmpnew u,a,t
vcmpnew v,b,t
vcmpnezw w,a,b
xxland x,u,v
xxlorc y,w,x
vclzlsbb z,y
rldicr r,z,62,34
ISA 3.0 or later

vec_floatVector Convert Integer to Floating-Point
r = vec_float (a)
Purpose:
Converts a vector of integers to a vector of single-precision
floating-point numbers.
Result value: Elements of
r are obtained by converting the
respective elements of a to
single-precision floating-point numbers.Endian considerations:
None.
xvcvsxwspvec_floatxvcvuxwspvec_floatSupported type signatures for vec_floatraExample Implementationvector floatvector signed int
xvcvsxwsp r,a
vector floatvector unsigned int
xvcvuxwsp r,a

vec_float2Vector Convert Two Vectors to Floating-Point
r = vec_float2 (a, b)
Purpose:
Converts two vectors of long long integers or double-precision
floating-point numbers to a vector of single-precision numbers.
Result value: Elements of
r are obtained by converting the
elements of a and
b to single-precision numbers.
Elements 0 and 1 of r are converted
from elements 0 and 1 of a,
respectively, and elements 2 and 3 of r
are converted from elements 0 and 1 of b, respectively. Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xxpermdivec_float2xvcvsxdspvec_float2vmrgowvec_float2vmrgewvec_float2Supported type signatures for vec_float2rabExample LE ImplementationExample BE Implementationvector floatvector signed long long vector signed long long
xxpermdi t,b,a,0
xxpermdi u,b,a,3
xvcvsxdsp v,t
xvcvsxdsp w,u
vmrgow r,v,w
xxpermdi t,b,a,0
xxpermdi u,b,a,3
xvcvsxdsp v,t
xvcvsxdsp w,u
vmrgew r,v,w
vector floatvector unsigned long long vector unsigned long long
xxpermdi t,b,a,0
xxpermdi u,b,a,3
xvcvsxdsp v,t
xvcvsxdsp w,u
vmrgow r,v,w
xxpermdi t,b,a,0
xxpermdi u,b,a,3
xvcvsxdsp v,t
xvcvsxdsp w,u
vmrgew r,v,w
vector floatvector double vector double
xxpermdi t,b,a,0
xxpermdi u,b,a,3
xvcvsxdsp v,t
xvcvsxdsp w,u
vmrgow r,v,w
xxpermdi t,b,a,0
xxpermdi u,b,a,3
xvcvsxdsp v,t
xvcvsxdsp w,u
vmrgew r,v,w

vec_floateVector Convert to Floating-Point in Even Elements
r = vec_floate (a)
Purpose:
Converts the elements of a source vector to single-precision
floating-point and stores the results in the even elements of
the target vector.
Result value: The even-numbered
elements of r are obtained by
converting the elements of a to
single-precision numbers, using the current floating-point rounding
mode.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xvcvsxdspvec_floatevsldoivec_floatexvcvuxdspvec_floatexvcvdpspvec_floateSupported type signatures for vec_floateraExample LE ImplementationExample BE Implementationvector floatvector signed long long
xvcvsxdsp r,a
xvcvsxdsp t,a
vsldoi r,t,t,4
vector floatvector unsigned long long
xvcvuxdsp r,a
xvcvuxdsp t,a
vsldoi r,t,t,4
vector floatvector double
xvcvdpsp r,a
xvcvdpsp t,a
vsldoi r,t,t,4

vec_floatoVector Convert to Floating-Point in Odd Elements
r = vec_floato (a)
Purpose:
Converts the elements of a source vector to single-precision
floating-point and stores the results in the odd elements of the
target vector.
Result value: The odd-numbered
elements of r are obtained by
converting the elements of a to
single-precision numbers, using the current floating-point rounding
mode.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xvcvsxdspvec_floatovsldoivec_floatoxvcvuxdspvec_floatoxvcvdpspvec_floatoSupported type signatures for vec_floatoraExample LE ImplementationExample BE Implementationvector floatvector signed long long
xvcvsxdsp t,a
vsldoi r,t,t,4
xvcvsxdsp r,a
vector floatvector unsigned long long
xvcvuxdsp t,a
vsldoi r,t,t,4
xvcvuxdsp r,a
vector floatvector double
xvcvdpsp t,a
vsldoi r,t,t,4
xvcvdpsp r,a

vec_floorVector Floor
r = vec_floor (a)
Purpose:
Returns a vector containing the largest representable floating-point
integral values less than or equal to the values of the corresponding
elements of the source vector.
Result value: Each element of
r contains the largest representable
floating-point integral value less than or equal to the value of the
corresponding element of a.Endian considerations:
None.
xvrdpimvec_floorxvrspimvec_floorSupported type signatures for vec_floorraExample Implementationvector floatvector float
xvrspim r,a
vector doublevector double
xvrdpim r,a

vec_gbVector Gather Bits by Byte
r = vec_gb (a)
Purpose:
Performs a gather-bits operation on the input.
Result value: Within each
doubleword, let x(i) (0 â‰¤ i < 8) denote the byte elements, with
x(0) the most-significant byte. For each pair of i and j (0 â‰¤ i
< 8, 0 â‰¤ j < 8), the jth bit of the
ith byte element of
r is set to the value of the
ith bit of the jth byte
element of a., taken from the
Power ISA, shows how bits are combined by the
vec_gb intrinsic. Here VR[VRT] is
equivalent to r, and
VR[VRB] is equivalent to a.
Endian considerations:
None.
vgbbdvec_gbSupported type signatures for vec_gbraExample Implementationvector unsigned charvector unsigned char
vgbbd r,a

vec_genbmVector Generate Byte Mask
r = vec_genbm (a)
Purpose:
Create an element mask for byte elements from a bit mask.
Result value:
For each integer i from 0 to 15, do the
following. Counting the leftmost element of r as the 0th element, and the rightmost
element as the 15th element, all bits of the
ith element of r are set to 0 if the
ith bit of the 16-bit value in a is equal to 0. All bits of the
ith element of r are set to 1 if the
ith bit of the 16-bit value in a is equal to 1. The bits in a are likewise numbered from left to
right.
Endian considerations:
Because elements are numbered from left to right in the result
vector regardless of endianness, the semantics of this built-in
function differ on big-endian and little-endian targets.
Review status:
Not yet reviewed.
mtvsrbmvec_genbmSupported type signatures for vec_genbmraExample ImplementationRestrictionsvector unsigned charunsigned long long
mtvsrbm r,a
ISA 3.1 or later

vec_gendmVector Generate Doubleword Mask
r = vec_gendm (a)
Purpose:
Create an element mask for doubleword elements from a bit mask.
Result value:
For each integer i from 0 to 1, do the
following. Counting the leftmost element of r as the 0th element, and the rightmost
element as the 1st element, all bits of the
ith element of r are set to 0 if the
ith bit of the 2-bit value in a is equal to 0. All bits of the
ith element of r are set to 1 if the
ith bit of the 2-bit value in a is equal to 1. The bits in a are likewise numbered from left to
right.
Endian considerations:
Because elements are numbered from left to right in the result
vector regardless of endianness, the semantics of this built-in
function differ on big-endian and little-endian targets.
Review status:
Not yet reviewed.
mtvsrdmvec_gendmSupported type signatures for vec_gendmraExample ImplementationRestrictionsvector unsigned long longunsigned long long
mtvsrdm r,a
ISA 3.1 or later

vec_genhmVector Generate Halfword Mask
r = vec_genhm (a)
Purpose:
Create an element mask for halfword elements from a bit mask.
Result value:
For each integer i from 0 to 7, do the
following. Counting the leftmost element of r as the 0th element, and the rightmost
element as the 7th element, all bits of the
ith element of r are set to 0 if the
ith bit of the 8-bit value in a is equal to 0. All bits of the
ith element of r are set to 1 if the
ith bit of the 8-bit value in a is equal to 1. The bits in a are likewise numbered from left to
right.
Endian considerations:
Because elements are numbered from left to right in the result
vector regardless of endianness, the semantics of this built-in
function differ on big-endian and little-endian targets.
Review status:
Not yet reviewed.
mtvsrhmvec_genhmSupported type signatures for vec_genhmraExample ImplementationRestrictionsvector unsigned shortunsigned long long
mtvsrhm r,a
ISA 3.1 or later

vec_genpcvmVector Generate Permute Control Vector from Mask
r = vec_genpcvm (a, b)
Purpose:
Generate a permute control vector for expanding or compressing a
source vector according to a specified mask.
Result value:b must have a value of 0, 1, 2,
or 3. a contains a bit mask
where the high-order bit in each element is set if the permute
mask should specify expansion or compression of that element, as
explained below.
If b = 0, r is assigned the value of the permute
control vector required to enable a left-indexed permute to
implement an expansion of the leftmost elements of a source
vector into the elements of a result vector specified by the
element mask in a.
If b = 1, r is assigned the value of the permute
control vector required to enable a left-indexed permute to
implement a compression of the sparse elements in a source
vector specified by the element mask in a into the leftmost elements of a
result vector.
If b = 2, r is assigned the value of the permute
control vector required to enable a right-indexed permute to
implement an expansion of the rightmost elements of a source
vector into the elements of a result vector specified by the
element mask in a.
If b = 3, r is assigned the value of the permute
control vector required to enable a right-indexed permute to
implement a compression of the sparse elements in a source
vector specified by the element mask in a into the rightmost elements of a
result vector.
Endian considerations:
The mask argument of the underlying instructions is specified in
big-endian order. For correct bi-endian semantics, the mask
must be reversed by the compiler for little-endian targets.
Notes:
See the descriptions of xxgenpcvbm et al. in the
Power Instruction Set Architecture, Version 3.1B Specification
() for examples of how to use
this function in practice.
Review status:
Not yet reviewed.
xxgenpcvbmvec_genpcvmxxgenpcvhmvec_genpcvmxxgenpcvwmvec_genpcvmxxgenpcvdmvec_genpcvmxxpermdivec_genpcvmSupported type signatures for vec_genpcvmrabExample LE ImplementationExample BE ImplementationRestrictionsvector unsigned charvector unsigned charconst int
xxswapd t,a
xxgenpcvbm r,t,b
xxgenpcvbm r,a,b
ISA 3.1 or latervector unsigned shortvector unsigned shortconst int
xxswapd t,a
xxgenpcvhm r,t,b
xxgenpcvhm r,a,b
ISA 3.1 or latervector unsigned intvector unsigned intconst int
xxswapd t,a
xxgenpcvwm r,t,b
xxgenpcvwm r,a,b
ISA 3.1 or latervector unsigned long longvector unsigned long longconst int
xxswapd t,a
xxgenpcvdm r,t,b
xxgenpcvdm r,a,b
ISA 3.1 or later

vec_genqmVector Generate Quadword Mask
r = vec_genqm (a)
Purpose:
Create an element mask for a quadword from a bit mask.
Result value:
All bits of r are set to 0 if
the bit in a is equal to 0.
Otherwise all bits of r are set
to 1.
Endian considerations:
None.
Review status:
Not yet reviewed.
mtvsrqmvec_genqmSupported type signatures for vec_genqmraExample ImplementationRestrictionsvector unsigned __int128unsigned long long
mtvsrqm r,a
ISA 3.1 or later

vec_genwmVector Generate Word Mask
r = vec_genwm (a)
Purpose:
Create an element mask for word elements from a bit mask.
Result value:
For each integer i from 0 to 3, do the
following. Counting the leftmost element of r as the 0th element, and the rightmost
element as the 3rd element, all bits of the
ith element of r are set to 0 if the
ith bit of the 4-bit value in a is equal to 0. All bits of the
ith element of r are set to 1 if the
ith bit of the 4-bit value in a is equal to 1. The bits in a are likewise numbered from left to
right.
Endian considerations:
Because elements are numbered from left to right in the result
vector regardless of endianness, the semantics of this built-in
function differ on big-endian and little-endian targets.
Review status:
Not yet reviewed.
mtvsrwmvec_genwmSupported type signatures for vec_genwmraExample ImplementationRestrictionsvector unsigned intunsigned long long
mtvsrwm r,a
ISA 3.1 or later

vec_gnbVector Gather Nth Bits
r = vec_gnb (a, b)
Purpose:
Copies every Nth bit of the input vector into the leftmost
positions of the target value.
Result value:
Let N be the constant value of b. Starting with bit 0, the contents of
every Nth bit of a are
concatenated and placed in the leftmost bits of r. The remaining bits of r are set to 0.
b must have a value between 2
and 7, inclusive.
As an example, if a has a
value of 0x0123456789abcdef0123456789abcdef and b has a value of 4, then r will have a value of
0x00ff00ff00000000.
Endian considerations:
None.
Review status:
Not yet reviewed.
vgnbvec_gnbSupported type signatures for vec_gnbrabExample ImplementationRestrictionsunsigned long longvector unsigned __int128const unsigned int
vgnb r,a,b
ISA 3.1 or later

vec_insertVector Insert
r = vec_insert (a, b, c)
Purpose:
Returns a copy of vector b with
element c replaced by the value of
a.
Result value: r contains a copy of vector
b with element c replaced by the value of a. This function uses modular arithmetic on
c to determine the element number.
For example, if c is out of range, the
compiler uses c modulo the number of
elements in the vector to determine the element position.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
Notes: The sample
implementations are given for ISA 3.0 when c is a constant. For earlier target
architectures, or when c is
variable, less efficient sequences are required. The sample
implementations also assume that c is in range; that is, any required
modulus operations have already been performed on the constant
index.
mtvsrwzvec_insertvinsertbvec_insertxxinsertwvec_insertmtvsrdvec_insertxxpermdivec_insertvinserthvec_insertxscvdpspnvec_insertxxextractuwvec_insertSupported type signatures for vec_insertrabcExample ISA 3.0 LE ImplementationExample ISA 3.0 BE Implementationvector signed charsigned char vector signed char signed int
mtvsrwz t,b
vinsertb r,t,15-c
mtvsrwz t,b
vinsertb r,t,c
vector unsigned charunsigned char vector unsigned char signed int
mtvsrwz t,b
vinsertb r,t,15-c
mtvsrwz t,b
vinsertb r,t,c
vector signed shortsigned short vector signed short signed int
mtvsrwz t,b
vinserth r,t,a,(7-c)*2
mtvsrd t,b
vinserth r,t,a,c*2
vector unsigned shortunsigned short vector unsigned short signed int
mtvsrwz t,b
vinserth r,t,a,(7-c)*2
mtvsrd t,b
vinserth r,t,a,c*2
vector signed intsigned int vector signed int signed int
mtvsrwz t,b
xxinsertw r,t,(3-c)*4
mtvsrwz t,b
vinsertb r,t,c*4
vector unsigned intunsigned int vector unsigned int signed int
mtvsrwz t,b
xxinsertw r,t,(3-c)*4
mtvsrwz t,b
vinsertb r,t,c*4
vector signed long longsigned long long vector signed long long signed int
mtvsrd t,b
xxpermdi r,t,a,c
mtvsrd t,b
xxpermdi r,t,a,1-c
vector unsigned long longunsigned long long vector unsigned long long signed int
mtvsrd t,b
xxpermdi r,t,a,c
mtvsrd t,b
xxpermdi r,t,a,1-c
vector floatfloat vector float signed int
xscvdpspn t,a
xxextractuw u,t,0
xxinsertw r/b,u,(3-c)*4
xscvdpspn t,a
xxextractuw u,t,0
xxinsertw r/b,u,c*4
vector doubledouble vector double signed int
xxpermdi r,b,a,1 [c=0]
[or]
xxpermdi r,a,b,1 [c=1]
xxpermdi r,a,b,1 [c=0]
[or]
xxpermdi r,b,a,1 [c=1]

vec_insert_expVector Insert Exponent
r = vec_insert_exp (a, b)
Purpose:
Inserts exponents into a vector of floating-point numbers.
Result value: Each element of
r is generated by combining the exponent
specified by the corresponding element of b with the sign and significand of the
corresponding element of a.The inserted exponent of b is
treated as a right-justified unsigned integer containing a biased
exponent, in accordance with the exponent representation specified by
IEEE 754. It is combined with the sign and significand of
a without further processing.Endian considerations:
None.
xviexpdpvec_insert_expxviexpspvec_insert_expSupported type signatures for vec_insert_exprabExample ImplementationRestrictionsvector floatvector unsigned int vector unsigned int
xviexpsp r,a,b
ISA 3.0 or latervector floatvector float vector unsigned int
xviexpsp r,a,b
ISA 3.0 or latervector doublevector unsigned long long vector unsigned long long
xviexpdp r,a,b
ISA 3.0 or latervector doublevector double vector unsigned long long
xviexpdp r,a,b
ISA 3.0 or later

vec_insert4bVector Insert Four Bytes
r = vec_insert4b (a, b, c)
Purpose:
Inserts a word into a vector at a byte position.
Result value: Let W be the first
doubleword element of a, truncated to
32 bits. The result vector r is formed
by inserting W into b at the byte
position (0â€“12) specified by c.Endian considerations:
The element and byte numbering within a register is left-to-right for
big-endian targets, and right-to-left for little-endian targets.
xxpermdivec_insert4bxxinsertwvec_insert4bSupported type signatures for vec_insert4brabcExample LE ImplementationExample BE ImplementationRestrictionsvector unsigned charvector signed intvector unsigned charconst int (range [0,12])
xxpermdi t,a,a,1
xxinsertw b,t,12-c
xxinsertw b,t,c
ISA 3.0 or latervector unsigned charvector unsigned intvector unsigned charconst int (range [0,12])
xxpermdi t,a,a,1
xxinsertw b,t,12-c
xxinsertw b,t,c
ISA 3.0 or later

vec_ldVector Load Indexed
r = vec_ld (a, b)
Purpose:
Loads a 16-byte vector from the memory address specified by the
displacement and the pointer, ignoring the four low-order bits
of the calculated address.
Result value: The value of
r is obtained by adding a and b,
masking off the four low-order bits of the result, and
loading the 16-byte vector from the resultant memory address.Endian considerations:
None.
lvxvec_ldSupported type signatures for vec_ldrabExample ISA 3.0
Implementationvector bool charsigned longconst vector bool char *
lvx r,b,a
vector signed charsigned longconst signed char *
lvx r,b,a
vector signed charsigned longconst vector signed char *
lvx r,b,a
vector unsigned charsigned longconst unsigned char *
lvx r,b,a
vector unsigned charsigned longconst vector unsigned char *
lvx r,b,a
vector bool shortsigned longconst vector bool short *
lvx r,b,a
vector signed shortsigned longconst signed short *
lvx r,b,a
vector signed shortsigned longconst vector signed short *
lvx r,b,a
vector unsigned shortsigned longconst unsigned short *
lvx r,b,a
vector unsigned shortsigned longconst vector unsigned short *
lvx r,b,a
vector pixelsigned longconst vector pixel *
lvx r,b,a
vector bool intsigned longconst vector bool int *
lvx r,b,a
vector signed intsigned longconst signed int *
lvx r,b,a
vector signed intsigned longconst vector signed int *
lvx r,b,a
vector unsigned intsigned longconst unsigned int *
lvx r,b,a
vector unsigned intsigned longconst vector unsigned int *
lvx r,b,a
vector bool long longsigned longconst vector bool long long *
lvx r,b,a
vector signed long longsigned longconst signed long long *
lvx r,b,a
vector signed long longsigned longconst vector signed long long *
lvx r,b,a
vector unsigned long longsigned longconst unsigned long long *
lvx r,b,a
vector unsigned long longsigned longconst vector unsigned long long *
lvx r,b,a
vector signed __int128signed longconst signed __int128 *
lvx r,b,a
vector signed __int128signed longconst vector signed __int128 *
lvx r,b,a
vector unsigned __int128signed longconst unsigned __int128 *
lvx r,b,a
vector unsigned __int128signed longconst vector unsigned __int128 *
lvx r,b,a
vector floatsigned longconst float *
lvx r,b,a
vector floatsigned longconst vector float *
lvx r,b,a
vector doublesigned longconst double *
lvx r,b,a
vector doublesigned longconst vector double *
lvx r,b,a

vec_ldeVector Load Element Indexed
r = vec_lde (a, b)
Purpose:
Loads a single element into the position in the vector register
corresponding to its address, leaving the remaining elements of
the register undefined.
Result value:
The integer value a is added to the
pointer value b. The resulting
address is rounded down to the nearest address that is a multiple of
es, where es is 1 for
char pointers, 2 for short pointers, and 4 for float or int pointers.
The element at this address is loaded into an element of r, leaving all other elements of r undefined. The position of the loaded
element in r is determined by taking the
address modulo 16.
Endian considerations:
None.
Notes:
Be careful to note that the address (b+c) is aligned to an
element boundary. Do not attempt to load unaligned data
with this intrinsic.
lvebxvec_ldelvewxvec_ldelvehxvec_ldeSupported type signatures for vec_lderabExample ISA 3.0
Implementationvector signed charsigned longconst signed char *
lvebx r,b,a
vector unsigned charsigned longconst unsigned char *
lvebx r,b,a
vector signed shortsigned longconst signed short *
lvehx r,b,a
vector unsigned shortsigned longconst unsigned short *
lvehx r,b,a
vector signed intsigned longconst signed int *
lvewx r,b,a
vector unsigned intsigned longconst unsigned int *
lvewx r,b,a
vector floatsigned longconst float *
lvewx r,b,a

vec_ldlVector Load Indexed Least Recently Used
r = vec_ldl (a, b)
Purpose:
Loads a 16-byte vector from the memory address specified by the
displacement and the pointer, ignoring the four low-order bits
of the calculated address, and marks the cache line loaded from
as least recently used.
Result value: The value of
r is obtained by adding a and b,
masking off the four low-order bits of the result, and
loading the 16-byte vector from the resultant memory address.Endian considerations:
None.
Notes:
This intrinsic can be used to indicate the last access to a
portion of memory, as a hint to the data cache controller that
the associated cache line can be replaced without performance
loss.
lvxlvec_ldlSupported type signatures for vec_ldlrabExample ISA 3.0
Implementationvector bool charsigned longconst vector bool char *
lvxl r,b,a
vector signed charsigned longconst signed char *
lvxl r,b,a
vector signed charsigned longconst vector signed char *
lvxl r,b,a
vector unsigned charsigned longconst unsigned char *
lvxl r,b,a
vector unsigned charsigned longconst vector unsigned char *
lvxl r,b,a
vector bool shortsigned longconst vector bool short *
lvxl r,b,a
vector signed shortsigned longconst signed short *
lvxl r,b,a
vector signed shortsigned longconst vector signed short *
lvxl r,b,a
vector unsigned shortsigned longconst unsigned short *
lvxl r,b,a
vector unsigned shortsigned longconst vector unsigned short *
lvxl r,b,a
vector pixelsigned longconst vector pixel *
lvxl r,b,a
vector bool intsigned longconst vector bool int *
lvxl r,b,a
vector signed intsigned longconst signed int *
lvxl r,b,a
vector signed intsigned longconst vector signed int *
lvxl r,b,a
vector unsigned intsigned longconst unsigned int *
lvxl r,b,a
vector unsigned intsigned longconst vector unsigned int *
lvxl r,b,a
vector bool long longsigned longconst vector bool long long *
lvxl r,b,a
vector signed long longsigned longconst signed long long *
lvxl r,b,a
vector signed long longsigned longconst vector signed long long *
lvxl r,b,a
vector unsigned long longsigned longconst unsigned long long *
lvxl r,b,a
vector unsigned long longsigned longconst vector unsigned long long *
lvxl r,b,a
vector floatsigned longconst float *
lvxl r,b,a
vector floatsigned longconst vector float *
lvxl r,b,a
vector doublesigned longconst double *
lvxl r,b,a
vector doublesigned longconst vector double *
lvxl r,b,a

vec_logeVector Base-2 Logarithm Estimate
r = vec_loge (a)
Purpose:
Returns a vector containing estimates of the base-2 logarithms of the
corresponding elements of the source vector.
Result value: Each element of
r contains an estimated value of the
base-2 logarithm of the corresponding element of a.Endian considerations:
None.
vlogefpvec_logeSupported type signatures for vec_logeraExample Implementationvector floatvector float
vlogefp r,a

vec_maddVector Multiply-Add
r = vec_madd (a, b, c)
Purpose:
Returns a vector containing the results of performing a fused
multiply-add operation for each corresponding set of elements of the
source vectors.
Result value: The value of each
element of r is the product of the
values of the corresponding elements of a and b, added
to the value of the corresponding element of c.Endian considerations:
None.
vmladduhmvec_maddxvmaddmdpvec_maddxvmaddmspvec_maddSupported type signatures for vec_maddrabcExample Implementationvector signed shortvector signed short vector signed short vector signed short
vmladduhm r,a,b,c
vector signed shortvector signed short vector unsigned short vector unsigned short
vmladduhm r,a,b,c
vector signed shortvector unsigned short vector signed short vector signed short
vmladduhm r,a,b,c
vector unsigned shortvector unsigned short vector unsigned short vector unsigned short
vmladduhm r,a,b,c
vector floatvector float vector float vector float
xvmaddmsp r/a,b,c
vector doublevector double vector double vector double
xvmaddmdp r/a,b,c

vec_maddsVector Multiply-Add Saturated
r = vec_madds (a, b, c)
Purpose:
Returns a vector containing the results of performing a saturated
multiply-high-and-add operation for each corresponding set of elements
of the source vectors.
Result value: The value of each
element of r is produced as follows:
The values of the corresponding elements of a and b are
multiplied. The value of the 17 most-significant bits of this product
is then added, using 16-bit-saturated addition, to the value of the
corresponding element of c.Endian considerations:
None.
vmhaddshsvec_maddsSupported type signatures for vec_maddsrabcExample Implementationvector signed shortvector signed short vector signed short vector signed short
vmhaddshs r,a,b,c

vec_maxVector Maximum
r = vec_max (a, b)
Purpose:
Returns a vector containing the maximum value from each set of
corresponding elements of the source vectors.
Result value:
The value of each element of r is the
maximum of the values of the corresponding elements of a and b.
Endian considerations:
None.
vmaxsbvec_maxvmaxubvec_maxvmaxswvec_maxvmaxuwvec_maxvmaxsdvec_maxvmaxudvec_maxvmaxshvec_maxvmaxuhvec_maxxvmaxdpvec_maxxvmaxspvec_maxSupported type signatures for vec_maxrabExample Implementationvector signed charvector signed char vector signed char
vmaxsb r,a,b
vector unsigned charvector unsigned char vector unsigned char
vmaxub r,a,b
vector signed shortvector signed short vector signed short
vmaxsh r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vmaxuh r,a,b
vector signed intvector signed int vector signed int
vmaxsw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vmaxuw r,a,b
vector signed long longvector signed long long vector signed long long
vmaxsd r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
vmaxud r,a,b
vector floatvector float vector float
xvmaxsp r,a,b
vector doublevector double vector double
xvmaxdp r,a,b

vec_mergeeVector Merge Even
r = vec_mergee (a, b)
Purpose:
Merges the even-numbered values from two vectors.
Result value: The even-numbered
elements of a are stored into the
even-numbered elements of r. The
even-numbered elements of b are stored
into the odd-numbered elements of r.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vmrgowvec_mergeevmrgewvec_mergeexxpermdivec_mergeeSupported type signatures for vec_mergeerabExample LE ImplementationExample BE Implementationvector bool intvector bool int vector bool int
vmrgow r,b,a
vmrgew r,a,b
vector signed intvector signed int vector signed int
vmrgow r,b,a
vmrgew r,a,b
vector unsigned intvector unsigned int vector unsigned int
vmrgow r,b,a
vmrgew r,a,b
vector bool long longvector bool long long vector bool long long
xxpermdi r,b,a,3
xxpermdi r,a,b,0
vector signed long longvector signed long long vector signed long long
xxpermdi r,b,a,3
xxpermdi r,a,b,0
vector unsigned long longvector unsigned long long vector unsigned long long
xxpermdi r,b,a,3
xxpermdi r,a,b,0
vector floatvector float vector float
vmrgow r,b,a
vmrgew r,a,b
vector doublevector double vector double
xxpermdi r,b,a,3
xxpermdi r,a,b,0

vec_mergehVector Merge High
r = vec_mergeh (a, b)
Purpose:
Merges the first halves (in element order) of two vectors.
Result value: The
nth element of r,
if n is an even number, is given the value of the
(n/2)th element of a. The (n+1)th element
of r, if n is an
even number, is given the value of the (n/2)th
element of b.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vmrglbvec_mergehxxpermdivec_mergehvmrghbvec_mergehvmrglwvec_mergehvmrghwvec_mergehvmrglhvec_mergehvmrghhvec_mergehSupported type signatures for vec_mergehrabExample LE ImplementationExample BE Implementationvector bool charvector bool char vector bool char
vmrglb r,b,a
vmrghb r,a,b
vector signed charvector signed char vector signed char
vmrglb r,b,a
vmrghb r,a,b
vector unsigned charvector unsigned char vector unsigned char
vmrglb r,b,a
vmrghb r,a,b
vector bool shortvector bool short vector bool short
vmrglh r,b,a
vmrghh r,a,b
vector signed shortvector signed short vector signed short
vmrglh r,b,a
vmrghh r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vmrglh r,b,a
vmrghh r,a,b
vector pixelvector pixel vector pixel
vmrglh r,b,a
vmrghh r,a,b
vector bool intvector bool int vector bool int
vmrglw r,b,a
vmrghw r,a,b
vector signed intvector signed int vector signed int
vmrglw r,b,a
vmrghw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vmrglw r,b,a
vmrghw r,a,b
vector bool long longvector bool long long vector bool long long
xxpermdi r,b,a,3
xxpermdi r,a,b,0
vector signed long longvector signed long long vector signed long long
xxpermdi r,b,a,3
xxpermdi r,a,b,0
vector unsigned long longvector unsigned long long vector unsigned long long
xxpermdi r,b,a,3
xxpermdi r,a,b,0
vector floatvector float vector float
vmrglw r,b,a
vmrghw r,a,b
vector doublevector double vector double
xxpermdi r,b,a,3
xxpermdi r,a,b,0

vec_mergelVector Merge Low
r = vec_mergel (a, b)
Purpose:
Merges the last halves (in element order) of two vectors.
Result value: Let
m be the number of elements in r. The nth element of
r, if n is an even
number, is given the value of the m/2 +
(n/2)th element of a. The (n+1)th element
of r, if n is an
even number, is given the value of the m/2 +
(n/2)th element of b.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vmrghbvec_mergelvmrglbvec_mergelvmrghwvec_mergelvmrglwvec_mergelxxpermdivec_mergelvmrghhvec_mergelvmrglhvec_mergelSupported type signatures for vec_mergelrabExample LE ImplementationExample BE Implementationvector bool charvector bool char vector bool char
vmrghb r,b,a
vmrglb r,a,b
vector signed charvector signed char vector signed char
vmrghb r,b,a
vmrglb r,a,b
vector unsigned charvector unsigned char vector unsigned char
vmrghb r,b,a
vmrglb r,a,b
vector bool shortvector bool short vector bool short
vmrghh r,b,a
vmrglh r,a,b
vector signed shortvector signed short vector signed short
vmrghh r,b,a
vmrglh r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vmrghh r,b,a
vmrglh r,a,b
vector pixelvector pixel vector pixel
vmrghh r,b,a
vmrglh r,a,b
vector bool intvector bool int vector bool int
vmrghw r,b,a
vmrglw r,a,b
vector signed intvector signed int vector signed int
vmrghw r,b,a
vmrglw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vmrghw r,b,a
vmrglw r,a,b
vector bool long longvector bool long long vector bool long long
xxpermdi r,b,a,0
xxpermdi r,a,b,3
vector signed long longvector signed long long vector signed long long
xxpermdi r,b,a,0
xxpermdi r,a,b,3
vector unsigned long longvector unsigned long long vector unsigned long long
xxpermdi r,b,a,0
xxpermdi r,a,b,3
vector floatvector float vector float
vmrghw r,b,a
vmrglw r,a,b
vector doublevector double vector double
xxpermdi r,b,a,0
xxpermdi r,a,b,3

vec_mergeoVector Merge Odd
r = vec_mergeo (a, b)
Purpose:
Merges the odd-numbered values from two vectors.
Result value: The odd-numbered
elements of a are stored into the
even-numbered elements of r. The
odd-numbered elements of b are stored
into the odd-numbered elements of r.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vmrgewvec_mergeovmrgowvec_mergeoxxpermdivec_mergeoSupported type signatures for vec_mergeorabExample LE ImplementationExample BE Implementationvector bool intvector bool int vector bool int
vmrgew r,b,a
vmrgow r,a,b
vector signed intvector signed int vector signed int
vmrgew r,b,a
vmrgow r,a,b
vector unsigned intvector unsigned int vector unsigned int
vmrgew r,b,a
vmrgow r,a,b
vector bool long longvector bool long long vector bool long long
xxpermdi r,b,a,0
xxpermdi r,a,b,3
vector signed long longvector signed long long vector signed long long
xxpermdi r,b,a,0
xxpermdi r,a,b,3
vector unsigned long longvector unsigned long long vector unsigned long long
xxpermdi r,b,a,0
xxpermdi r,a,b,3
vector floatvector float vector float
vmrgew r,b,a
vmrgow r,a,b
vector doublevector double vector double
xxpermdi r,b,a,0
xxpermdi r,a,b,3

vec_mfvscrVector Move From Vector Status and Control Register
r = vec_mfvscr ()
Purpose:
Copies the contents of the Vector Status and Control Register
(VSCR) into the result vector.
Result value: The high-order 16
bits of the VSCR are copied into the seventh element of r, using big-endian (left-to-right) order. The
low-order 16 bits of the VSCR are copied into the eighth element of
r, using big-endian order. All other
elements of r are set to zero.
Endian considerations:
The contents of the VSCR are placed in the low-order 32 bits of the
result vector, regardless of endianness.
Notes:
The use of vector unsigned short as the result
type eases access to the two bits currently defined in the
VSCR. Following execution of vec_mfvscr,
r[6] will contain
VSCRNJ in the low-order bit, and
r[7] will contain
VSCRSAT in the low-order bit.
mfvscrvec_mfvscrSupported type signatures for vec_mfvscrrExample
Implementationvector unsigned short
mfvscr a

vec_minVector Minimum
r = vec_min (a, b)
Purpose:
Returns a vector containing the minimum value from each set of
corresponding elements of the source vectors.
Result value: The value of each
element of r is the minimum of the
values of the corresponding elements of a and b.Endian considerations:
None.
vminsbvec_minvminubvec_minvminswvec_minvminuwvec_minvminsdvec_minvminudvec_minvminshvec_minvminuhvec_minxvmindpvec_minxvminspvec_minSupported type signatures for vec_minrabExample Implementationvector signed charvector signed char vector signed char
vminsb r,a,b
vector unsigned charvector unsigned char vector unsigned char
vminub r,a,b
vector signed shortvector signed short vector signed short
vminsh r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vminuh r,a,b
vector signed intvector signed int vector signed int
vminsw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vminuw r,a,b
vector signed long longvector signed long long vector signed long long
vminsd r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
vminud r,a,b
vector floatvector float vector float
xvminsp r,a,b
vector doublevector double vector double
xvmindp r,a,b

vec_modVector Modulo
r = vec_mod (a, b)
Purpose:
Produces the remainders from dividing the elements of one vector
by the elements of another vector, and places them in the result
vector.
Result value:
The value of each element of r is
obtained by dividing the corresponding element of a by the corresponding element of b and determining the unique signed or
unsigned integer remainder from the division.
Endian considerations:
None.
Notes:
When any element of b is
zero, the corresponding element of r is undefined. For signed arithmetic,
when any element of a is the
negative number with maximum cardinality, and the
corresponding element of b is
negative one, the corresponding element of r is undefined.
Review status:
Changes other than __int128 were reviewed by Paul Clarke and
Jinsong Ji. Changes for __int128 have not yet been reviewed.
vmodswvec_modvmoduwvec_modvmodsdvec_modvmodudvec_modvmodsqvec_modvmoduqvec_modSupported type signatures for vec_modrabExample ImplementationRestrictionsvector signed intvector signed intvector signed int
vmodsw r,a,b
ISA 3.1 or latervector unsigned intvector unsigned intvector unsigned int
vmoduw r,a,b
ISA 3.1 or latervector signed long longvector signed long longvector signed long long
vmodsd r,a,b
ISA 3.1 or latervector unsigned long longvector unsigned long longvector unsigned long long
vmodud r,a,b
ISA 3.1 or latervector signed __int128vector signed __int128vector signed __int128
vmodsq r,a,b
ISA 3.1 or latervector unsigned __int128vector unsigned __int128vector unsigned __int128
vmoduq r,a,b
ISA 3.1 or later

vec_mraddsVector Multiply-High Round and Add Saturated
r = vec_mradds (a, b, c)
Purpose:
Returns a vector containing the results of performing a saturated
multiply-high-round-and-add operation for each corresponding set of
elements of the source vectors.
Result value: The value of each
element of r is produced as follows.
The values of the corresponding elements of a and b are
multiplied and rounded such that the 15 least-significant bits are 0.
The value of the 17 most-significant bits of this rounded product is
then added, using 16-bit-saturated addition, to the value of the
corresponding element of c.Endian considerations:
None.
vmhraddshsvec_mraddsSupported type signatures for vec_mraddsrabcExample Implementationvector signed shortvector signed short vector signed short vector signed short
vmhraddshs r,a,b,c

vec_msubVector Multiply-Subtract
r = vec_msub (a, b, c)
Purpose:
Returns a vector containing the results of performing a multiply-subtract
operation using the source vectors.
Result value: Each element of
r is produced by multiplying the
corresponding element of a by the
corresponding element of b and then
subtracting the corresponding element of c.Endian considerations:
None.
xvmsubmdpvec_msubxvmsubmspvec_msubSupported type signatures for vec_msubrabcExample Implementationvector floatvector float vector float vector float
xvmsubmsp r/a,b,c
vector doublevector double vector double vector double
xvmsubmdp r/a,b,c

vec_msumVector Multiply-Sum
r = vec_msum (a, b, c)
Purpose:
Returns a vector containing the results of performing a multiply-sum
operation using the source vectors.
Result value:
There are two cases:
When a is of type
vector signed char or vector unsigned char, each word
element of r is
computed as follows:
Each of the four byte elements contained in the
corresponding word element of a is multiplied by the
corresponding byte element of b.
The sum of these four halfword products is added
to the corresponding word element in c and placed in the
corresponding word element of r.
When a is of type
vector signed short or vector unsigned short, each word
element of r is
computed as follows:
Each of the two halfword elements contained in the
corresponding word element of a is multiplied by the
corresponding halfword element of b.
The sum of these two word products is added
to the corresponding word element in c and placed in the
corresponding word element of r.
All operations are performed using 32-bit modular arithmetic.
Endian considerations:
None.
Endian considerations:
Changes not yet reviewed.
vmsummbmvec_msumvmsumshmvec_msumvmsumubmvec_msumvmsumuhmvec_msumvmsumudmvec_msumSupported type signatures for vec_msumrabcExample Implementationvector signed intvector signed char vector unsigned char vector signed int
vmsummbm r,a,b,c
vector signed intvector signed short vector signed short vector signed int
vmsumshm r,a,b,c
vector unsigned intvector unsigned char vector unsigned char vector unsigned int
vmsumubm r,a,b,c
vector unsigned intvector unsigned short vector unsigned short vector unsigned int
vmsumuhm r,a,b,c
vector signed __int128vector signed long longvector signed long longvector signed __int128
vmsumudm r,a,b,c
vector unsigned __int128vector unsigned long longvector unsigned long longvector unsigned __int128
vmsumudm r,a,b,c

vec_msumcVector Multiply-Sum Carryout
r = vec_msumc (a, b, c)
Purpose:
Returns the carryout from adding the products of the
elements of the first two source vectors together with the
value in the third source vector.
Result value: Let
x be the product of a[0] and b[0], and let y be the product of a[1] and b[1]. Then r is equal to the carryout from x + y +
c. The carryout is found by
shifting the sum right by the size of c in bits.
Endian considerations:
None.
Review status:
Changes have not been reviewed.
vmsumcudvec_msumcSupported type signatures for vec_msumcrabcExample ImplementationRestrictionsvector unsigned __int128vector unsigned long longvector unsigned long longvector unsigned __int128
vmsumcud r,a,b,c

vec_msumsVector Multiply-Sum Saturated
r = vec_msums (a, b, c)
Purpose:
Returns a vector containing the results of performing a saturated
multiply-sum operation using the source vectors.
Result value: Assume that the
elements of each vector are numbered beginning with 0. The value of each
element n of r
is obtained as follows. For p =
2n to 2n+1, multiply element
p of a by element
p of b. Add the
sum of these products to element n of
c. All additions are performed using
32-bit saturated arithmetic.Endian considerations:
None.
vmsumshsvec_msumsvmsumuhsvec_msumsSupported type signatures for vec_msumsrabcExample Implementationvector signed intvector signed short vector signed short vector signed int
vmsumshs r,a,b,c
vector unsigned intvector unsigned short vector unsigned short vector unsigned int
vmsumuhs r,a,b,c

vec_mtvscrVector Move to Vector Status and Control Register
vec_mtvscr (a)
Purpose:
Copies a value into the Vector Status and Control Register
(VSCR). The low-order 32 bits of a are copied into the VSCR.
Result value: None.Endian considerations:
None.
mtvscrvec_mtvscrSupported type signatures for vec_mtvscraExample
Implementationvector bool char
mtvscr a
vector signed char
mtvscr a
vector unsigned char
mtvscr a
vector bool short
mtvscr a
vector signed short
mtvscr a
vector unsigned short
mtvscr a
vector pixel
mtvscr a
vector bool int
mtvscr a
vector signed int
mtvscr a
vector unsigned int
mtvscr a

vec_mulVector Multiply
r = vec_mul (a, b)
Purpose:
Compute the products of corresponding elements of two vectors.
Result value: Each element of
r receives the product of
the corresponding elements of a and
b.Endian considerations:
None.
Notes:
The example implementation for vector char assumes that the
address of the permute control vector for the vperm instruction
is in a register identified by pcv. Its value is
{1,17,3,19,5,21,7,23,9,25,11,27,13,29,15,31}.
Prior to ISA 3.1,
there are currently no vector
instructions to support vector long long multiplication,
so the compiler must perform two scalar multiplies on the
vector elements for this case.
Review status:
Changes reviewed by Paul Clarke and Jinsong Ji.
vmulesbvec_mulvmulosbvec_mullxvw4xvec_mulvpermvec_mulvmuluwmvec_mulxxspltibvec_mulvmladduhmvec_mulxvmuldpvec_mulxvmulspvec_mulvmulldvec_mulSupported type signatures for vec_mulrabExample ImplementationRestrictionsvector signed charvector signed char vector signed char
vmulesb t,a,b
vmulosb u,a,b
lxvw4x v,0,pcv
vperm r,t,u,v
vector unsigned charvector unsigned char vector unsigned char
vmulesb t,a,b
vmulosb u,a,b
lxvw4x v,0,pcv
vperm r,t,u,v
vector signed shortvector signed short vector signed short
xxspltib t,0
vmladduhm r,a,b,t
vector unsigned shortvector unsigned short vector unsigned short
xxspltib t,0
vmladduhm r,a,b,t
vector signed intvector signed int vector signed int
vmuluwm r,a,b
vector unsigned intvector unsigned int vector unsigned int
vmuluwm r,a,b
vector signed long longvector signed long long vector signed long long
vmulld r,a,b
ISA 3.1 or latervector unsigned long longvector unsigned long long vector unsigned long long
vmulld r,a,b
ISA 3.1 or latervector floatvector float vector float
xvmulsp r,a,b
vector doublevector double vector double
xvmuldp r,a,b

vec_muleVector Multiply Even
r = vec_mule (a, b)
Purpose:
Multiplies the even-numbered elements of the source vectors to
produce the target vector.
Result value: Each element
n of r is the
product of element 2n of a and element 2n of
b.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
Review
status:
Changes not yet reviewed.
vmuloshvec_mulevmuleshvec_mulevmulouhvec_mulevmuleuhvec_mulevmuloswvec_mulevmuleswvec_mulevmulouwvec_mulevmuleuwvec_mulevmulosbvec_mulevmulesbvec_mulevmuloubvec_mulevmuleubvec_mulevmulosdvec_mulevmulesdvec_mulevmuloudvec_mulevmuleudvec_muleSupported type signatures for vec_mulerabExample LE ImplementationExample BE ImplementationRestrictionsvector signed shortvector signed char vector signed char
vmulosb r,a,b
vmulesb r,a,b
vector unsigned shortvector unsigned char vector unsigned char
vmuloub r,a,b
vmuleub r,a,b
vector signed intvector signed short vector signed short
vmulosh r,a,b
vmulesh r,a,b
vector unsigned intvector unsigned short vector unsigned short
vmulouh r,a,b
vmuleuh r,a,b
vector signed long longvector signed int vector signed int
vmulosw r,a,b
vmulesw r,a,b
vector unsigned long longvector unsigned int vector unsigned int
vmulouw r,a,b
vmuleuw r,a,b
vector signed __int128vector signed long longvector signed long long
vmulosd r,a,b
vmulesd r,a,b
ISA 3.1 or latervector unsigned __int128vector unsigned long longvector unsigned long long
vmuloud r,a,b
vmuleud r,a,b
ISA 3.1 or later

vec_mulhVector Multiply High
r = vec_mulh (a, b)
Purpose:
Multiplies the elements of the source vectors and places the
high half of each result in the target vector.
Result value: Each element
of r is the high half of the
product of the corresponding elements of a and b.Endian considerations:
None.
Review status:
Reviewed by Paul Clarke and Jinsong Ji.
vmulhswvec_mulhvmulhuwvec_mulhvmulhsdvec_mulhvmulhudvec_mulhSupported type signatures for vec_mulhrabExample ImplementationRestrictionsvector signed intvector signed intvector signed int
vmulhsw r,a,b
ISA 3.1 or latervector unsigned intvector unsigned intvector unsigned int
vmulhuw r,a,b
ISA 3.1 or latervector signed long longvector signed long longvector signed long long
vmulhsd r,a,b
ISA 3.1 or latervector unsigned long longvector unsigned long long vector unsigned long long
vmulhud r,a,b
ISA 3.1 or later

vec_muloVector Multiply Odd
r = vec_mulo (a, b)
Purpose:
Multiplies the odd-numbered elements of the source vectors to
produce the target vector.
Result value: Each element
n of r is the
product of element 2n+1 of a and element 2n+1 of
b.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
Review
status:
Changes not yet reviewed.
vmuleshvec_mulovmuloshvec_mulovmuleuhvec_mulovmulouhvec_mulovmuleswvec_mulovmuloswvec_mulovmuleuwvec_mulovmulouwvec_mulovmulesbvec_mulovmulosbvec_mulovmuleubvec_mulovmuloubvec_mulovmulesdvec_mulovmulosdvec_mulovmuleudvec_mulovmuloudvec_muloSupported type signatures for vec_mulorabExample LE ImplementationExample BE ImplementationRestrictionsvector signed shortvector signed char vector signed char
vmulesb r,a,b
vmulosb r,a,b
vector unsigned shortvector unsigned char vector unsigned char
vmuleub r,a,b
vmuloub r,a,b
vector signed intvector signed short vector signed short
vmulesh r,a,b
vmulosh r,a,b
vector unsigned intvector unsigned short vector unsigned short
vmuleuh r,a,b
vmulouh r,a,b
vector signed long longvector signed int vector signed int
vmulesw r,a,b
vmulosw r,a,b
vector unsigned long longvector unsigned int vector unsigned int
vmuleuw r,a,b
vmulouw r,a,b
vector signed __int128vector signed long longvector signed long long
vmulesd r,a,b
vmulosd r,a,b
ISA 3.1 or latervector unsigned __int128vector unsigned long longvector unsigned long long
vmuleud r,a,b
vmuloud r,a,b
ISA 3.1 or later

vec_nabsVector Negated Absolute Value
r = vec_nabs (a)
Purpose:
Returns a vector containing the negated absolute values of the contents
of the source vector.
Result value: The value of each
element of r is the negated absolute
value of the corresponding element of a. For integer vectors, the arithmetic is
modular.Endian considerations:
None.
vspltiswvec_nabsvsububmvec_nabsvminsbvec_nabsvsubuwmvec_nabsvminswvec_nabsvsubudmvec_nabsvminsdvec_nabsvsubuhmvec_nabsvminshvec_nabsxvnabsdpvec_nabsxvnabsspvec_nabsSupported type signatures for vec_nabsraExample Implementationvector signed charvector signed char
vspltisw t,0
vsububm u,t,a
vminsb r,u,a
vector signed shortvector signed short
vspltisw t,0
vsubuhm u,t,a
vminsh r,u,a
vector signed intvector signed int
vspltisw t,0
vsubuwm u,t,a
vminsw r,u,a
vector signed long longvector signed long long
vspltisw t,0
vsubudm u,t,a
vminsd r,u,a
vector floatvector float
xvnabssp r,a
vector doublevector double
xvnabsdp r,a

vec_nandVector NAND
r = vec_nand (a, b)
Purpose:
Performs a bitwise NAND of two vectors.
Result value: r is the bitwise
NAND of a and b.Endian considerations:
None.
xxlnandvec_nandSupported type signatures for vec_nandrabExample Implementationvector bool charvector bool char vector bool char
xxlnand r,a,b
vector signed charvector signed char vector signed char
xxlnand r,a,b
vector unsigned charvector unsigned char vector unsigned char
xxlnand r,a,b
vector bool shortvector bool short vector bool short
xxlnand r,a,b
vector signed shortvector signed short vector signed short
xxlnand r,a,b
vector unsigned shortvector unsigned short vector unsigned short
xxlnand r,a,b
vector bool intvector bool int vector bool int
xxlnand r,a,b
vector signed intvector signed int vector signed int
xxlnand r,a,b
vector unsigned intvector unsigned int vector unsigned int
xxlnand r,a,b
vector bool long longvector bool long long vector bool long long
xxlnand r,a,b
vector signed long longvector signed long long vector signed long long
xxlnand r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
xxlnand r,a,b
vector floatvector float vector float
xxlnand r,a,b
vector doublevector double vector double
xxlnand r,a,b

vec_ncipher_beVector AES Inverse Cipher Big-Endian
r = vec_ncipher_be (a, b)
Purpose:
Performs one round of the AES inverse cipher operation on an
intermediate state array a by using a
given round key b.
Result value: r contains the
resulting intermediate state, after one round of the AES inverse cipher
operation on intermediate state array a,
using the round key specified by b.
Endian considerations:
All element and bit numberings of the AES inverse cipher operation use
big-endian (i.e., left-to-right) order, reflecting the underlying
hardware instruction. Unlike most of the vector intrinsics in this
chapter, vec_ncipher_be does not follow the bi-endian
programming model.
vnciphervec_ncipher_beSupported type signatures for vec_ncipher_berabExample Implementationvector unsigned charvector unsigned char vector unsigned char
vncipher r,a,b

vec_ncipherlast_beVector AES Inverse Cipher Last Big-Endian
r = vec_ncipherlast_be (a, b)
Purpose:
Performs the final round of the AES inverse cipher operation on an
intermediate state array a using the
specified round key b.
Result value: r contains the
resulting final state, after the final round of the AES inverse cipher
operation on intermediate state array a,
using the round key specified by b.
Endian considerations:
All element and bit numberings of the AES inverse cipher-last operation
use big-endian (i.e., left-to-right) order, reflecting the underlying
hardware instruction. Unlike most of the vector intrinsics in this
chapter, vec_ncipherlast_be does not follow the bi-endian
programming model.
vncipherlastvec_ncipherlast_beSupported type signatures for vec_ncipherlast_berabExample Implementationvector unsigned charvector unsigned char vector unsigned char
vncipherlast r,a,b

vec_nearbyintVector Nearby Integer
r = vec_nearbyint (a)
Purpose:
Returns a vector containing the floating-point integral values nearest to
the values of the corresponding elements of the source vector.
Result value: Each
element of r contains the
nearest representable floating-point integral value to the value
of the corresponding element of a. When an input element value is exactly
between two integer values, the input value with the larger
absolute value is selected. The current floating-point rounding
mode is ignored.Endian considerations:
None.
xvrdpivec_nearbyintxvrspivec_nearbyintSupported type signatures for vec_nearbyintraExample Implementationvector floatvector float
xvrspi r,a
vector doublevector double
xvrdpi r,a

vec_negVector Negate
r = vec_neg (a)
Purpose:
Returns a vector containing the negated values of the contents of the
source vector.
Result value: The value of each
element of r is the negated value of
the corresponding element of a. For
integer vectors, the arithmetic is modular.Endian considerations:
None.
vspltiswvec_negvsububmvec_negvsubuwmvec_negvsubudmvec_negvsubuhmvec_negxvnegdpvec_negxvnegspvec_negSupported type signatures for vec_negraExample Implementationvector signed charvector signed char
vspltisw t,0
vsububm r,t,a
vector signed shortvector signed short
vspltisw t,0
vsubuhm r,t,a
vector signed intvector signed int
vspltisw t,0
vsubuwm r,t,a
vector signed long longvector signed long long
vspltisw t,0
vsubudm r,t,a
vector floatvector float
xvnegsp r,a
vector doublevector double
xvnegdp r,a

vec_nmaddVector Negated Multiply-Add
r = vec_nmadd (a, b, c)
Purpose:
Returns a vector containing the results of performing a negated
multiply-add operation on the source vectors.
Result value: The value of each
element of r is the product of the
corresponding elements of a and
b, added to the corresponding elements
of c, then multiplied by
â€“1.0.Endian considerations:
None.
xvnmaddadpvec_nmaddxvnmaddaspvec_nmaddSupported type signatures for vec_nmaddrabcExample Implementationvector floatvector float vector float vector float
xvnmaddasp r/c,a,b
vector doublevector double vector double vector double
xvnmaddadp r/c,a,b

vec_nmsubVector Negated Multiply-Subtract
r = vec_nmsub (a, b, c)
Purpose:
Returns a vector containing the results of performing a negated
multiply-subtract operation on the source vectors.
Result value: The value of each
element of r is the value of the
corresponding element of c subtracted
from the product of the corresponding elements of a and b, and
then multiplied by â€“1.0.Endian considerations:
None.
xvnmsubmdpvec_nmsubxvnmsubmspvec_nmsubSupported type signatures for vec_nmsubrabcExample Implementationvector floatvector float vector float vector float
xvnmsubmsp r/a,b,c
vector doublevector double vector double vector double
xvnmsubmdp r/a,b,c

vec_norVector NOR
r = vec_nor (a, b)
Purpose:
Performs a bitwise NOR of two vectors.
Result value: r is the bitwise NOR
of a and b.Endian considerations:
None.
xxlnorvec_norSupported type signatures for vec_norrabExample Implementationvector bool charvector bool char vector bool char
xxlnor r,a,b
vector signed charvector signed char vector signed char
xxlnor r,a,b
vector unsigned charvector unsigned char vector unsigned char
xxlnor r,a,b
vector bool shortvector bool short vector bool short
xxlnor r,a,b
vector signed shortvector signed short vector signed short
xxlnor r,a,b
vector unsigned shortvector unsigned short vector unsigned short
xxlnor r,a,b
vector bool intvector bool int vector bool int
xxlnor r,a,b
vector signed intvector signed int vector signed int
xxlnor r,a,b
vector unsigned intvector unsigned int vector unsigned int
xxlnor r,a,b
vector bool long longvector bool long long vector bool long long
xxlnor r,a,b
vector signed long longvector signed long long vector signed long long
xxlnor r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
xxlnor r,a,b
vector floatvector float vector float
xxlnor r,a,b
vector doublevector double vector double
xxlnor r,a,b

vec_orVector OR
r = vec_or (a, b)
Purpose:
Performs a bitwise OR of two vectors.
Result value: r is the bitwise OR
of a and b.Endian considerations:
None.
xxlorvec_orSupported type signatures for vec_orrabExample Implementationvector bool charvector bool char vector bool char
xxlor r,a,b
vector signed charvector signed char vector signed char
xxlor r,a,b
vector unsigned charvector unsigned char vector unsigned char
xxlor r,a,b
vector bool shortvector bool short vector bool short
xxlor r,a,b
vector signed shortvector signed short vector signed short
xxlor r,a,b
vector unsigned shortvector unsigned short vector unsigned short
xxlor r,a,b
vector bool intvector bool int vector bool int
xxlor r,a,b
vector signed intvector signed int vector signed int
xxlor r,a,b
vector unsigned intvector unsigned int vector unsigned int
xxlor r,a,b
vector bool long longvector bool long long vector bool long long
xxlor r,a,b
vector signed long longvector signed long long vector signed long long
xxlor r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
xxlor r,a,b
vector floatvector float vector float
xxlor r,a,b
vector doublevector double vector double
xxlor r,a,b

vec_orcVector OR with Complement
r = vec_orc (a, b)
Purpose:
Performs a bitwise OR of the first vector with the bitwise-complemented
second vector.
Result value: r is the bitwise OR
of a and the bitwise complement of
b.Endian considerations:
None.
xxlorcvec_orcSupported type signatures for vec_orcrabExample Implementationvector bool charvector bool char vector bool char
xxlorc r,a,b
vector signed charvector signed char vector signed char
xxlorc r,a,b
vector unsigned charvector unsigned char vector unsigned char
xxlorc r,a,b
vector bool shortvector bool short vector bool short
xxlorc r,a,b
vector signed shortvector signed short vector signed short
xxlorc r,a,b
vector unsigned shortvector unsigned short vector unsigned short
xxlorc r,a,b
vector bool intvector bool int vector bool int
xxlorc r,a,b
vector signed intvector signed int vector signed int
xxlorc r,a,b
vector unsigned intvector unsigned int vector unsigned int
xxlorc r,a,b
vector bool long longvector bool long long vector bool long long
xxlorc r,a,b
vector signed long longvector signed long long vector signed long long
xxlorc r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
xxlorc r,a,b
vector floatvector float vector float
xxlorc r,a,b
vector doublevector double vector double
xxlorc r,a,b

vec_packVector Pack
r = vec_pack (a, b)
Purpose:
Packs information from each element of two vectors into the result
vector.
Result value: Let v represent the concatenation of vectors
a and b. For integer types, the value of each element
of r is taken from the low-order half
of the corresponding element of v. For
floating-point types, the value of each element of r is the corresponding element of v, rounded to the result type.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vpkuhumvec_packvpkudumvec_packvpkuwumvec_packxxpermdivec_packxvcvdpspvec_packvmrgowvec_packvmrgewvec_packSupported type signatures for vec_packrabExample LE ImplementationExample BE Implementationvector bool charvector bool short vector bool short
vpkuhum r,b,a
vpkuhum r,a,b
vector signed charvector signed short vector signed short
vpkuhum r,b,a
vpkuhum r,a,b
vector unsigned charvector unsigned short vector unsigned short
vpkuhum r,b,a
vpkuhum r,a,b
vector bool shortvector bool int vector bool int
vpkuwum r,b,a
vpkuwum r,a,b
vector signed shortvector signed int vector signed int
vpkuwum r,b,a
vpkuwum r,a,b
vector unsigned shortvector unsigned int vector unsigned int
vpkuwum r,b,a
vpkuwum r,a,b
vector bool intvector bool long long vector bool long long
vpkudum r,b,a
vpkudum r,a,b
vector signed intvector signed long long vector signed long long
vpkudum r,b,a
vpkudum r,a,b
vector unsigned intvector unsigned long long vector unsigned long long
vpkudum r,b,a
vpkudum r,a,b
vector floatvector double vector double
xxpermdi t,b,a,0
xxpermdi u,b,a,3
xvcvdpsp t,t
xvcvdpsp u,u
vmrgow r,t,u
xxpermdi t,a,b,0
xxpermdi u,a,b,3
xvcvdpsp t,t
xvcvdpsp u,u
vmrgew r,t,u

vec_pack_to_short_fp32Vector Pack 32-bit Float to Short
r = vec_pack_to_short_fp32 (a, b)
Purpose:
Packs eight single-precision 32-bit floating-point numbers from two
source vectors into a vector of eight 16-bit floating-point numbers.
Result value: Let v represent the 16-element concatenation of
a and b. Each value of r contains the result of converting the
corresponding single-precision element of v to half-precision.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vctuxsvec_pack_to_short_fp32vpkswssvec_pack_to_short_fp32Supported type signatures for vec_pack_to_short_fp32rabExample LE ImplementationExample BE ImplementationRestrictionsvector unsigned shortvector float vector float
xvcvsphp t,a
xvcvsphp u,b
vpkuwum r,t,u
xvcvsphp t,a
xvcvsphp u,b
vpkuwum r,u,t
ISA 3.0 or later

vec_packpxVector Pack Pixel
r = vec_packpx (a, b)
Purpose:
Packs information from each element of two vectors into the result
vector.
Result value: Let v be the concatenation of a and b. The
value of each element of r is taken
from the corresponding element of v as
follows:The least-significant bit of the high-order byte is
stored into the first bit of the result element.The least-significant 5 bits of each of the remaining
bytes are stored into the remaining portion of the result
element.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vpkpxvec_packpxSupported type signatures for vec_packpxrabExample LE ImplementationExample BE Implementationvector pixelvector unsigned int vector unsigned int
vpkpx r,b,a
vpkpx r,a,b

vec_packsVector Pack Saturated
r = vec_packs (a, b)
Purpose:
Packs information from each element of two vectors into the result
vector, using saturated values.
Result value: Let v be the concatenation of a and b. The
value of each element of r is the
saturated value of the corresponding element of v.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vpkshssvec_packsvpkuhusvec_packsvpksdssvec_packsvpkudusvec_packsvpkswssvec_packsvpkuwusvec_packsSupported type signatures for vec_packsrabExample LE ImplementationExample BE Implementationvector signed charvector signed short vector signed short
vpkshss r,b,a
vpkshss r,a,b
vector unsigned charvector unsigned short vector unsigned short
vpkuhus r,b,a
vpkuhus r,a,b
vector signed shortvector signed int vector signed int
vpkswss r,b,a
vpkswss r,a,b
vector unsigned shortvector unsigned int vector unsigned int
vpkuwus r,b,a
vpkuwus r,a,b
vector signed intvector signed long long vector signed long long
vpksdss r,b,a
vpksdss r,a,b
vector unsigned intvector unsigned long long vector unsigned long long
vpkudus r,b,a
vpkudus r,a,b

vec_packsuVector Pack Saturated Unsigned
r = vec_packsu (a, b)
Purpose:
Packs information from each element of two vectors into the result
vector, using unsigned saturated values.
Result value: Let v be the concatenation of a and b. The
value of each element of r is the
saturated value of the corresponding element of v.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
vpkshusvec_packsuvpkuhusvec_packsuvpksdusvec_packsuvpkudusvec_packsuvpkswusvec_packsuvpkuwusvec_packsuSupported type signatures for vec_packsurabExample LE ImplementationExample BE Implementationvector unsigned charvector signed short vector signed short
vpkshus r,b,a
vpkshus r,a,b
vector unsigned charvector unsigned short vector unsigned short
vpkuhus r,b,a
vpkuhus r,a,b
vector unsigned shortvector signed int vector signed int
vpkswus r,b,a
vpkswus r,a,b
vector unsigned shortvector unsigned int vector unsigned int
vpkuwus r,b,a
vpkuwus r,a,b
vector unsigned intvector signed long long vector signed long long
vpksdus r,b,a
vpksdus r,a,b
vector unsigned intvector unsigned long long vector unsigned long long
vpkudus r,b,a
vpkudus r,a,b

vec_parity_lsbbVector Parity over Least-Significant Bits of Bytes
r = vec_parity_lsbb (a)
Purpose:
Compute parity on the least-significant bit of each byte.
Result value: Each element of
r contains the parity computed over the
low-order bit of each of the bytes in the corresponding element of
a.An example for input a
of type vector unsigned int follows:
word index0123byte index n 0123456789101112131415a0101020305080D1522375990E97962E1bytes ofa0101020305080D1522375990E97962E1least-significant bit of byte n ofa1101101101101101r00000001000000010000000000000001Endian considerations:
None.
vprtybwvec_parity_lsbbvprtybqvec_parity_lsbbvprtybdvec_parity_lsbbSupported type signatures for vec_parity_lsbbraExample ImplementationRestrictionsvector unsigned intvector signed int
vprtybw r,a
ISA 3.0 or latervector unsigned intvector unsigned int
vprtybw r,a
ISA 3.0 or latervector unsigned long longvector signed long long
vprtybd r,a
ISA 3.0 or latervector unsigned long longvector unsigned long long
vprtybd r,a
ISA 3.0 or latervector unsigned __int128vector signed __int128
vprtybq r,a
ISA 3.0 or latervector unsigned __int128vector unsigned __int128
vprtybq r,a
ISA 3.0 or later

vec_pdepVector Parallel Bit Deposit
r = vec_pdep (a, b)
Purpose:
Copies some bits from each element of one argument into
positions of the result specified by a mask in a second argument.
Result value:
The rightmost bit of each element of a is copied into the bit position of the
corresponding element of r in
which the rightmost 1-bit appears in the corresponding element
of b. The next-rightmost bit
of each element of a is copied
into the bit position of the corresponding element of r in which the next-rightmost 1-bit
appears in the corresponding element of b; and so forth until the element of
b contains no more 1-bits. All
bits of the element of r that
correspond to 0-bits in the corresponding element of
b are set to zero.
An example for doubleword inputs follows:
Element 0Element 1a0xfedcba98765432100xfedcba9876543210b0x88888888888888880xccccccccccccccccr0x0088 0080 0008 00000x4c 48 44 40 0c 08 04 00Endian considerations:
None.
Review status:
Not yet reviewed.
vpdepdvec_pdepSupported type signatures for vec_pdeprabExample ImplementationRestrictionsvector unsigned long longvector unsigned long longvector unsigned long long
vpdepd r,a,b
ISA 3.1 or later

vec_permVector Permute
r = vec_perm (a, b, c)
Purpose:
Returns a vector that contains elements selected from two
vectors, in the order specified by a third vector.
Result value: Let v be the concatenation of a and b. Each
byte of r selected by using the
least-significant 5 bits of the corresponding byte of c as an index into v.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
Notes:
The example little-endian code generation uses the vpermr instruction from ISA 3.0. For
earlier targets, the compiler must generate an extra instruction
to adjust the permute control vector c.
The vec_perm built-in should only use
permutations that reorder vector elements of the specified
type, not to reorder bytes within those elements. The
results are not guaranteed to be consistent across big-
and little-endian if you violate this rule. See .
vpermrvec_permvpermvec_permSupported type signatures for vec_permrabcExample LE ImplementationExample BE Implementationvector bool charvector bool char vector bool char vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector signed charvector signed char vector signed char vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector unsigned charvector unsigned char vector unsigned char vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector bool shortvector bool short vector bool short vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector signed shortvector signed short vector signed short vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector unsigned shortvector unsigned short vector unsigned short vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector pixelvector pixel vector pixel vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector bool intvector bool int vector bool int vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector signed intvector signed int vector signed int vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector unsigned intvector unsigned int vector unsigned int vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector bool long longvector bool long long vector bool long long vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector signed long longvector signed long long vector signed long long vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector unsigned long longvector unsigned long long vector unsigned long long vector unsigned char
vpermr r,b,a,c