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.
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_abs
Supported 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_absd
Supported 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_abss
Supported 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_add
Supported 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_addc
Supported 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_adde
Supported 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_addec
Supported 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_adds
Supported 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.
vcmpequb.vec_all_eqmfocrfvec_all_eqrlwinmvec_all_eqvcmpequw.vec_all_eqvcmpequd.vec_all_eqvcmpequh.vec_all_eqxvcmpeqdp.vec_all_eqxvcmpeqsp.vec_all_eq
Supported type signatures for vec_all_eqrabExample Implementationintvector 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 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.
vcmpgtsb.vec_all_gemfocrfvec_all_gerlwinmvec_all_gevcmpgtub.vec_all_gevcmpgtsw.vec_all_gevcmpgtuw.vec_all_gevcmpgtsd.vec_all_gevcmpgtud.vec_all_gevcmpgtsh.vec_all_gevcmpgtuh.vec_all_gexvcmpgedp.vec_all_gexvcmpgesp.vec_all_ge
Supported type signatures for vec_all_gerabExample Implementationintvector 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 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.
vcmpgtsb.vec_all_gtmfocrfvec_all_gtrlwinmvec_all_gtvcmpgtub.vec_all_gtvcmpgtsw.vec_all_gtvcmpgtuw.vec_all_gtvcmpgtsd.vec_all_gtvcmpgtud.vec_all_gtvcmpgtsh.vec_all_gtvcmpgtuh.vec_all_gtxvcmpgtdp.vec_all_gtxvcmpgtsp.vec_all_gt
Supported type signatures for vec_all_gtrabExample Implementationintvector 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 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_in
Supported 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.
vcmpgtsb.vec_all_lemfocrfvec_all_lerlwinmvec_all_levcmpgtub.vec_all_levcmpgtsw.vec_all_levcmpgtuw.vec_all_levcmpgtsd.vec_all_levcmpgtud.vec_all_levcmpgtsh.vec_all_levcmpgtuh.vec_all_lexvcmpgedp.vec_all_lexvcmpgesp.vec_all_le
Supported type signatures for vec_all_lerabExample Implementationintvector 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 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.
vcmpgtsb.vec_all_ltmfocrfvec_all_ltrlwinmvec_all_ltvcmpgtub.vec_all_ltvcmpgtsw.vec_all_ltvcmpgtuw.vec_all_ltvcmpgtsd.vec_all_ltvcmpgtud.vec_all_ltvcmpgtsh.vec_all_ltvcmpgtuh.vec_all_ltxvcmpgtdp.vec_all_ltxvcmpgtsp.vec_all_lt
Supported type signatures for vec_all_ltrabExample Implementationintvector 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 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_nan
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.
vcmpneb.vec_all_nemfocrfvec_all_nerlwinmvec_all_nevcmpnew.vec_all_nevcmpequd.vec_all_nevcmpneh.vec_all_nexvcmpeqdp.vec_all_nexvcmpeqsp.vec_all_ne
Supported type signatures for vec_all_nerabExample Implementationintvector 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 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_nge
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_ngt
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_nle
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_nlt
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_numeric
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_and
Supported 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_andc
Supported 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.
vcmpneb.vec_any_eqmfocrfvec_any_eqrlwinmvec_any_eqcntlzwvec_any_eqsrwivec_any_eqvcmpnew.vec_any_eqvcmpequd.vec_any_eqvcmpneh.vec_any_eqxvcmpeqdp.vec_any_eqxvcmpeqsp.vec_any_eq
Supported type signatures for vec_any_eqrabExample Implementationintvector 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 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.
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_gevcmpgtsh.vec_any_gevcmpgtuh.vec_any_gexvcmpgedp.vec_any_gexvcmpgesp.vec_any_ge
Supported type signatures for vec_any_gerabExample Implementationintvector 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 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 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 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.
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_gtvcmpgtsh.vec_any_gtvcmpgtuh.vec_any_gtxvcmpgtdp.vec_any_gtxvcmpgtsp.vec_any_gt
Supported type signatures for vec_any_gtrabExample Implementationintvector 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 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.
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_levcmpgtsh.vec_any_levcmpgtuh.vec_any_lexvcmpgedp.vec_any_lexvcmpgesp.vec_any_le
Supported type signatures for vec_any_lerabExample Implementationintvector 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 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.
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_ltvcmpgtsh.vec_any_ltvcmpgtuh.vec_any_ltxvcmpgtdp.vec_any_ltxvcmpgtsp.vec_any_lt
Supported type signatures for vec_any_ltrabExample Implementationintvector 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 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_nan
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.
vcmpequb.vec_any_nemfocrfvec_any_nerlwinmvec_any_necntlzwvec_any_nesrwivec_any_nevcmpequw.vec_any_nevcmpequd.vec_any_nevcmpequh.vec_any_nexvcmpeqdp.vec_any_nexvcmpeqsp.vec_any_ne
Supported type signatures for vec_any_nerabExample Implementationintvector 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 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_nge
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_ngt
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_nle
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_nlt
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_numeric
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_out
Supported 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_avg
Supported 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
i of r
is set to the value of the
jth bit of
a.
All other bits of r are zeroed.
When the type of a is vector
unsigned long long:
For each doubleword element i
(0 ≤ i < 2)
of a:
For each j
(0 ≤ j < 8),
let bit index k denote the byte
value of the
jth
element of b.
If bit index k is greater than or
equal to 64, bit j of element
i of r is set to 0.
If bit index k is less than 64,
bit j of element
i of r is set to the value of the
kth
bit of element i of input
a.
All other bits are zeroed.
Endian considerations:
All bit and byte numberings within each element in the above
description denote big-endian (i.e., left-to-right) order,
reflecting the underlying hardware instruction. Unlike most
of the vector intrinsics in this chapter, vec_bperm
does not follow the bi-endian programming model.
vbpermqvec_bpermvbpermdvec_bperm
Supported 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_ceil
Supported type signatures for vec_ceilraExample Implementationvector floatvector float
xvrspip r,a
vector doublevector double
xvrdpip r,a
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_be
Supported 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_be
Supported type signatures for vec_cipherlast_berabExample Implementationvector unsigned charvector unsigned char vector unsigned char
vcipherlast r,a,b
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_cmpb
Supported 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.
vcmpequbvec_cmpeqvcmpequhvec_cmpeqvcmpequwvec_cmpeqvcmpequdvec_cmpeqxvcmpeqspvec_cmpeqxvcmpeqdpvec_cmpeq
Supported type signatures for vec_cmpeqrabExample Implementationvector 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 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.
vcmpgtsbvec_cmpgexxlnorvec_cmpgevcmpgtubvec_cmpgevcmpgtshvec_cmpgevcmpgtuhvec_cmpgevcmpgtswvec_cmpgevcmpgtuwvec_cmpgevcmpgtsdvec_cmpgevcmpgtudvec_cmpgexvcmpgespvec_cmpgexvcmpgedpvec_cmpge
Supported type signatures for vec_cmpgerabExample Implementationvector 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 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.
vcmpgtsbvec_cmpgtvcmpgtubvec_cmpgtvcmpgtshvec_cmpgtvcmpgtuhvec_cmpgtvcmpgtswvec_cmpgtvcmpgtuwvec_cmpgtvcmpgtsdvec_cmpgtvcmpgtudvec_cmpgtxvcmpgtspvec_cmpgtxvcmpgtdpvec_cmpgt
Supported type signatures for vec_cmpgtrabExample Implementationvector 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 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.
vcmpgtsbvec_cmplexxlnorvec_cmplevcmpgtubvec_cmplevcmpgtshvec_cmplevcmpgtuhvec_cmplevcmpgtswvec_cmplevcmpgtuwvec_cmplevcmpgtsdvec_cmplevcmpgtudvec_cmplexvcmpgespvec_cmplexvcmpgedpvec_cmple
Supported type signatures for vec_cmplerabExample Implementationvector 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 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.
vcmpgtsbvec_cmpltvcmpgtubvec_cmpltvcmpgtshvec_cmpltvcmpgtuhvec_cmpltvcmpgtswvec_cmpltvcmpgtuwvec_cmpltvcmpgtsdvec_cmpltvcmpgtudvec_cmpltxvcmpgtspvec_cmpltxvcmpgtdpvec_cmplt
Supported type signatures for vec_cmpltrabExample Implementationvector 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 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.
vcmpnebvec_cmpnevcmpnehvec_cmpnevcmpnewvec_cmpnevcmpequdvec_cmpnexxlnorvec_cmpnexvcmpeqspvec_cmpnexvcmpeqdpvec_cmpne
Supported type signatures for vec_cmpnerabExample Implementationvector 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 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_cmpnez
Supported 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.
Endian considerations:
None.
vclzbvec_cntlzvclzhvec_cntlzvclzwvec_cntlzvclzdvec_cntlz
Supported 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.
Endian considerations:
None.
vclzlsbbvec_cntlz_lsbb
Supported type signatures for vec_cntlz_lsbbraExample ImplementationRestrictionssigned intvector signed char
vclzlsbb r,a
ISA 3.0 or latersigned intvector unsigned char
vclzlsbb r,a
ISA 3.0 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.
Endian considerations:
None.
vctzbvec_cnttzvctzhvec_cnttzvctzwvec_cnttzvctzdvec_cnttz
Supported 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.
Endian considerations:
None.
vctzlsbbvec_cnttz_lsbb
Supported type signatures for vec_cnttz_lsbbraExample ImplementationRestrictionssigned intvector signed char
vctzlsbb r,a
ISA 3.0 or latersigned intvector unsigned char
vctzlsbb r,a
ISA 3.0 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_cpsgn
Supported 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_ctf
Supported 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.
vctsxsvec_cts
Supported type signatures for vec_ctsrabExample Implementationvector signed intvector float5-bit unsigned literal
vctsxs r,a,b
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.
vctuxsvec_ctu
Supported type signatures for vec_cturabExample Implementationvector unsigned intvector float5-bit unsigned literal
vctuxs r,a,b
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.
xxspltdvec_divmfvsrdvec_divdivdvec_divmtvsrdvec_divxxmrghdvec_divxvdivspvec_divxvdivdpvec_div
Supported type signatures for vec_divrabExample Implementationvector 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
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
vector floatvector floatvector float
xvdivsp r,a,b
vector doublevector doublevector double
xvdivdp r,a,b
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_double
Supported 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.
Endian considerations:
Differences in element numbering require different implementations
for big- and little-endian code generation.
xxsldwivec_doubleexvcvsxwdpvec_doubleexvcvuxwdpvec_doubleexvcvspdpvec_doublee
Supported 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.
Endian considerations:
Differences in element numbering require different implementations
for big- and little-endian code generation.
xxsldwivec_doublehxvcvsxwdpvec_doublehxvcvuxwdpvec_doublehxvcvspdpvec_doubleh
Supported 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.
Endian considerations:
Differences in element numbering require different implementations
for big- and little-endian code generation.
xxsldwivec_doublelxvcvsxwdpvec_doublelxvcvuxwdpvec_doublelxvcvspdpvec_doublel
Supported 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.
Endian considerations:
Differences in element numbering require different implementations
for big- and little-endian code generation.
xvcvsxwdpvec_doubleoxxsldwivec_doubleoxvcvuxwdpvec_doubleoxvcvspdpvec_doubleo
Supported 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_eqv
Supported 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_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_expte
Supported 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_extract
Supported 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_exp
Supported 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.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
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_shorth
Supported 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.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
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_shortl
Supported 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_sig
Supported 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_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_extract4b
Supported 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.Endian considerations:
None.
vcmpnezbvec_first_match_indexvcmpnezhvec_first_match_indexvcmpnezwvec_first_match_indexxxlnorvec_first_match_indexvctzlsbbvec_first_match_indexvclzlsbbvec_first_match_indexrldiclvec_first_match_index
Supported type signatures for vec_first_match_indexrabExample LE
ImplementationExample BE
ImplementationRestrictionsunsigned intvector signed char vector signed char
vcmpnezb t,a,b
xxlnor u,t,t
vctzlsbb r,u
vcmpnezb t,a,b
xxlnor u,t,t
vclzlsbb r,u
ISA 3.0 or laterunsigned intvector unsigned char vector unsigned char
vcmpnezb t,a,b
xxlnor u,t,t
vctzlsbb r,u
vcmpnezb t,a,b
xxlnor u,t,t
vclzlsbb r,u
ISA 3.0 or laterunsigned intvector signed short vector signed short
vcmpnezh t,a,b
xxlnor u,t,t
vctzlsbb v,u
rldicl r,v,63,33
vcmpnezh 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
vcmpnezh t,a,b
xxlnor u,t,t
vctzlsbb v,u
rldicl r,v,63,33
vcmpnezh 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
vcmpnezw t,a,b
xxlnor u,t,t
vctzlsbb v,u
rldicl r,v,62,34
vcmpnezw 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
vcmpnezw t,a,b
xxlnor u,t,t
vctzlsbb v,u
rldicl r,v,62,34
vcmpnezw 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.Endian considerations:
None.
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_index
Supported 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.Endian considerations:
None.
vcmpnebvec_first_mismatch_indexvcmpnehvec_first_mismatch_indexvcmpnewvec_first_mismatch_indexvctzlsbbvec_first_mismatch_indexvclzlsbbvec_first_mismatch_indexrldiclvec_first_mismatch_index
Supported 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.Endian considerations:
None.
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_index
Supported 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_float
Supported 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_float2
Supported 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_floate
Supported 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_floato
Supported 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_floor
Supported 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:
The vec_gb intrinsic function assumes
big-endian (left-to-right) numbering for both bits and bytes, matching
the ISA 2.07 vgbbd instruction.
vgbbdvec_gb
Supported type signatures for vec_gbraExample Implementationvector unsigned charvector unsigned char
vgbbd r,a
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_insert
Supported 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_exp
Supported 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_insert4b
Supported 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_ld
Supported type signatures for vec_ldrabExample ISA 3.0
Implementationvector bool charsigned long longvector bool char *
lvx r,b,a
vector signed charsigned long longsigned char *
lvx r,b,a
vector signed charsigned long longvector signed char *
lvx r,b,a
vector unsigned charsigned long long unsigned char *
lvx r,b,a
vector unsigned charsigned long longvector unsigned char *
lvx r,b,a
vector bool shortsigned long longvector bool short *
lvx r,b,a
vector signed shortsigned long long signed short *
lvx r,b,a
vector signed shortsigned long longvector signed short *
lvx r,b,a
vector unsigned shortsigned long long unsigned short *
lvx r,b,a
vector unsigned shortsigned long longvector unsigned short *
lvx r,b,a
vector pixelsigned long longvector pixel *
lvx r,b,a
vector bool intsigned long longvector bool int *
lvx r,b,a
vector signed intsigned long long signed int *
lvx r,b,a
vector signed intsigned long longvector signed int *
lvx r,b,a
vector unsigned intsigned long long unsigned int *
lvx r,b,a
vector unsigned intsigned long longvector unsigned int *
lvx r,b,a
vector bool long longsigned long longvector bool long long *
lvx r,b,a
vector signed long longsigned long long signed long long *
lvx r,b,a
vector signed long longsigned long longvector signed long long *
lvx r,b,a
vector unsigned long longsigned long long unsigned long long *
lvx r,b,a
vector unsigned long longsigned long longvector unsigned long long *
lvx r,b,a
vector signed __int128signed long longsigned __int128 *
lvx r,b,a
vector signed __int128signed long longvector signed __int128 *
lvx r,b,a
vector unsigned __int128signed long long unsigned __int128 *
lvx r,b,a
vector unsigned __int128signed long longvector unsigned __int128 *
lvx r,b,a
vector floatsigned long long float *
lvx r,b,a
vector floatsigned long longvector float *
lvx r,b,a
vector doublesigned long long double *
lvx r,b,a
vector doublesigned long longvector 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_lde
Supported type signatures for vec_lderabExample ISA 3.0
Implementationvector signed charsigned long longsigned char *
lvebx r,b,a
vector unsigned charsigned long longunsigned char *
lvebx r,b,a
vector signed shortsigned long longsigned short *
lvehx r,b,a
vector unsigned shortsigned long longunsigned short *
lvehx r,b,a
vector signed intsigned long longsigned int *
lvewx r,b,a
vector unsigned intsigned long longunsigned int *
lvewx r,b,a
vector floatsigned long longfloat *
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_ldl
Supported type signatures for vec_ldlrabExample ISA 3.0
Implementationvector bool charsigned long longvector bool char *
lvxl r,b,a
vector signed charsigned long longsigned char *
lvxl r,b,a
vector signed charsigned long longvector signed char *
lvxl r,b,a
vector unsigned charsigned long long unsigned char *
lvxl r,b,a
vector unsigned charsigned long longvector unsigned char *
lvxl r,b,a
vector bool shortsigned long longvector bool short *
lvxl r,b,a
vector signed shortsigned long long signed short *
lvxl r,b,a
vector signed shortsigned long longvector signed short *
lvxl r,b,a
vector unsigned shortsigned long long unsigned short *
lvxl r,b,a
vector unsigned shortsigned long longvector unsigned short *
lvxl r,b,a
vector pixelsigned long longvector pixel *
lvxl r,b,a
vector bool intsigned long longvector bool int *
lvxl r,b,a
vector signed intsigned long long signed int *
lvxl r,b,a
vector signed intsigned long longvector signed int *
lvxl r,b,a
vector unsigned intsigned long long unsigned int *
lvxl r,b,a
vector unsigned intsigned long longvector unsigned int *
lvxl r,b,a
vector bool long longsigned long longvector bool long long *
lvxl r,b,a
vector signed long longsigned long long signed long long *
lvxl r,b,a
vector signed long longsigned long longvector signed long long *
lvxl r,b,a
vector unsigned long longsigned long long unsigned long long *
lvxl r,b,a
vector unsigned long longsigned long longvector unsigned long long *
lvxl r,b,a
vector floatsigned long long float *
lvxl r,b,a
vector floatsigned long longvector float *
lvxl r,b,a
vector doublesigned long long double *
lvxl r,b,a
vector doublesigned long longvector 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_loge
Supported 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_madd
Supported 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_madds
Supported 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_max
Supported 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_mergee
Supported 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_mergeh
Supported 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_mergel
Supported 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_mergeo
Supported 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_mfvscr
Supported 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_min
Supported 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_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_mradds
Supported 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_msub
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.
vmsummbmvec_msumvmsumshmvec_msumvmsumubmvec_msumvmsumuhmvec_msum
Supported 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
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_msums
Supported 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_mtvscr
Supported 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}.
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.
vmulesbvec_mulvmulosbvec_mullxvw4xvec_mulvpermvec_mulvmuluwmvec_mulxxspltibvec_mulvmladduhmvec_mulxvmuldpvec_mulxvmulspvec_mul
Supported type signatures for vec_mulrabExample Implementationvector 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
[scalarized]
vector unsigned long longvector unsigned long long vector unsigned long long
[scalarized]
vector 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.
vmuloshvec_mulevmuleshvec_mulevmulouhvec_mulevmuleuhvec_mulevmuloswvec_mulevmuleswvec_mulevmulouwvec_mulevmuleuwvec_mulevmulosbvec_mulevmulesbvec_mulevmuloubvec_mulevmuleubvec_mule
Supported type signatures for vec_mulerabExample LE ImplementationExample BE Implementationvector 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
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.
vmuleshvec_mulovmuloshvec_mulovmuleuhvec_mulovmulouhvec_mulovmuleswvec_mulovmuloswvec_mulovmuleuwvec_mulovmulouwvec_mulovmulesbvec_mulovmulosbvec_mulovmuleubvec_mulovmuloubvec_mulo
Supported type signatures for vec_mulorabExample LE ImplementationExample BE Implementationvector 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
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_nabs
Supported 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_nand
Supported 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_be
Supported 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_be
Supported 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_nearbyint
Supported 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_neg
Supported 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_nmadd
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_nmsub
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_nor
Supported 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_or
Supported 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_orc
Supported 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_pack
Supported 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_fp32
Supported type signatures for vec_pack_to_short_fp32rabExample LE ImplementationExample BE ImplementationRestrictionsvector unsigned shortvector float vector float
vctuxs t,a,0
vctuxs u,b,0
vpkswss r,u,t
vctuxs t,a,0
vctuxs u,b,0
vpkswss r,t,u
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_packpx
Supported 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_packs
Supported 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_packsu
Supported 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.Endian considerations:
None.
vprtybwvec_parity_lsbbvprtybqvec_parity_lsbbvprtybdvec_parity_lsbb
Supported 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_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_perm
Supported 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
vperm r,a,b,c
vector floatvector float vector float vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vector doublevector double vector double vector unsigned char
vpermr r,b,a,c
vperm r,a,b,c
vec_permxorVector Permute and Exclusive-OR
r = vec_permxor (a, b, c)
Purpose:
Applies a permute and exclusive-OR operation on two vectors of byte
elements, with the selected elements identified by a third vector.
Result value: For each
i (0 ≤ i < 16), let
x be bits 0–3 and
y be bits 4–7 of byte element
i of c. Byte
element i of r
is set to the exclusive-OR of byte elements x
of a and y
of b.An example follows:
aF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFFbFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0Fc0123456789ABCDEFF0E1D2C3B4A59687xy0123456789ABCDEFF0E1D2C3B4A59687axbyF0EFF2CFF4AFF68FF86FFA4FFC2FFE0FFFFFFEEFFDDFFCCFFBBFFAAFF99FF88Fr1F3D5B7997B5D3F10011223344556677Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xxlnorvec_permxorvpermxorvec_permxor
Supported type signatures for vec_permxorrabcExample LE ImplementationExample BE Implementationvector bool charvector bool char vector bool char vector bool char
xxlnor t,c,c
vpermxor r,a,b,t
vpermxor r,a,b,c
vector unsigned charvector signed char vector signed char vector signed char
xxlnor t,c,c
vpermxor r,a,b,t
vpermxor r,a,b,c
vector unsigned charvector unsigned char vector unsigned char vector unsigned char
xxlnor t,c,c
vpermxor r,a,b,t
vpermxor r,a,b,c
vec_pmsum_beVector Polynomial Multiply-Sum Big-Endian
r = vec_pmsum_be (a, b)
Purpose:
Performs the exclusive-OR operation (implementing polynomial addition)
on each even-odd pair of the polynomial-multiplication result of the
corresponding elements of a and
b.
Result value: Each element
i of r is
computed by an exclusive-OR operation of the polynomial
multiplication of input elements 2 × i of
a and b and input elements 2 ×
i + 1 of a and
b.
An example follows for inputs of type vector unsigned int:
aA300000000A200000000A100000000A0b00B300000000B200000000B1B00000B0binary polynomial multiplicandsA300000000B3000000A200000000B2000000A100000000B1000000A0B00000B0intermediate resultsXOR operands004E3500000000000000004E2400000000000000004E11000000004E00004E00r004E354E240000000000004E004E5F00Endian considerations:
All element numberings 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_pmsum_be does not follow the bi-endian
programming model.
vpmsumhvec_pmsum_bevpmsumdvec_pmsum_bevpmsumwvec_pmsum_bevpmsumbvec_pmsum_be
Supported type signatures for vec_pmsum_berabExample Implementationvector unsigned shortvector unsigned char vector unsigned char
vpmsumb r,a,b
vector unsigned intvector unsigned short vector unsigned short
vpmsumh r,a,b
vector unsigned long longvector unsigned int vector unsigned int
vpmsumw r,a,b
vector unsigned __int128vector unsigned long long vector unsigned long long
vpmsumd r,a,b
vec_popcntVector Population Count
r = vec_popcnt (a)
Purpose:
Returns a vector containing the number of bits set in each element of
the source vector.
Result value: The value of each
element of r is the number of bits set
in the corresponding element of a.Endian considerations:
None.
vpopcntbvec_popcntvpopcntwvec_popcntvpopcntdvec_popcntvpopcnthvec_popcnt
Supported type signatures for vec_popcntraExample Implementationvector unsigned charvector signed char
vpopcntb r,a
vector unsigned charvector unsigned char
vpopcntb r,a
vector unsigned shortvector signed short
vpopcnth r,a
vector unsigned shortvector unsigned short
vpopcnth r,a
vector unsigned intvector signed int
vpopcntw r,a
vector unsigned intvector unsigned int
vpopcntw r,a
vector unsigned long longvector signed long long
vpopcntd r,a
vector unsigned long longvector unsigned long long
vpopcntd r,a
vec_reVector Reciprocal Estimate
r = vec_re (a)
Purpose:
Returns a vector containing estimates of the reciprocals of the
corresponding elements of the source vector.
Result value: Each element of
r contains the estimated value of the
reciprocal of the corresponding element of a.Endian considerations:
None.
Notes:
For finite reciprocals, this intrinsic guarantees at least 14
bits of accuracy.
xvredpvec_rexvrespvec_re
Supported type signatures for vec_reraExample Implementationvector floatvector float
xvresp r,a
vector doublevector double
xvredp r,a
vec_recipdivVector Reciprocal Divide
r = vec_recipdiv (a, b)
Purpose:
Returns a vector containing refined approximations of the
division of the corresponding elements of a by the corresponding elements of
b.
Result value: Each element of
r contains a refined approximation of
the division of the corresponding element of a by the corresponding element of b.Endian considerations:
None.
Notes:
The example implementation for vector double assumes
that a register z initially
contains the double-precision floating-point value 1.0
in each doubleword.
For finite reciprocals, this intrinsic guarantees at
least 23 bits of accuracy for single-precision floating
point, and at least 52 bits of accuracy for
double-precision floating point.
This built-in function does not correspond to a single
IEEE operation and does not provide the overflow,
underflow, and NaN propagation characteristics specified
for IEEE division.
xvredpvec_recipdivxvnmsubadpvec_recipdivxvmaddmdpvec_recipdivxvmuldpvec_recipdivxvrespvec_recipdivxvmulspvec_recipdivxvnmsubaspvec_recipdivxvmaddmspvec_recipdiv
vec_revbVector Reverse Bytes
r = vec_revb (a)
Purpose:
Reverse the bytes of each vector element of a vector.
Result value: Each element of
r contains the byte-reversed value of
the corresponding element of a.Endian considerations:
None.
Notes:
The examples shown are for ISA 3.0. More complex sequences are
required for earlier ISA levels.
Interfaces that make no change to the data are deprecated.
xxbrwvec_revbxxbrqvec_revbxxbrdvec_revbxxbrhvec_revb
Supported type signatures for vec_revbraExample ISA 3.0 ImplementationRestrictionsvector bool charvector bool char
[none]
Deprecatedvector signed charvector signed char
[none]
Deprecatedvector unsigned charvector unsigned char
[none]
Deprecatedvector bool shortvector bool short
xxbrh r,a
Deprecatedvector signed shortvector signed short
xxbrh r,a
vector unsigned shortvector unsigned short
xxbrh r,a
vector bool intvector bool int
xxbrw r,a
Deprecatedvector signed intvector signed int
xxbrw r,a
vector unsigned intvector unsigned int
xxbrw r,a
vector bool long longvector bool long long
xxbrd r,a
Deprecatedvector signed long longvector signed long long
xxbrd r,a
vector unsigned long longvector unsigned long long
xxbrd r,a
vector signed __int128vector signed __int128
xxbrq r,a
vector unsigned __int128vector unsigned __int128
xxbrq r,a
vector floatvector float
xxbrw r,a
vector doublevector double
xxbrd r,a
vec_reveVector Reverse Elements
r = vec_reve (a)
Purpose:
Reverse the elements of a vector.
Result value: Returns a vector
with the elements of the source vector in reversed order.Endian considerations:
The vpermr instruction is most naturally used to implement this built-in
function for a little-endian target, and the vperm instruction for a
big-endian target. This is not technically necessary, however, provided
the correct permute control vector is used. Note that use of vpermr
requires ISA 3.0.
Notes: The example
implementations assume that the permute control vector for the
vperm or vpermr instruction is in a register identified by pcv.
The value of pcv differs based on the element size, and is the
same (in natural element order) for big- and little-endian,
assuming the use of vperm for big-endian and vpermr for
little-endian.
Vector typesPermute control vector
vector char
{ 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,
0 }
vector short
{ 14, 15, 12, 13, 10, 11, 8, 9, 6, 7, 4, 5, 2, 3, 0,
1 }
vector int, vector float
{ 12, 13, 14, 15, 8, 9, 10, 11, 4, 5, 6, 7, 0, 1, 2,
3 }
vector long long, vector double
{ 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6,
7 }
vpermvec_revevpermrvec_reve
Supported type signatures for vec_reveraExample Implementationvector bool charvector bool char
vperm[r] r,a,a,pcv
vector signed charvector signed char
vperm[r] r,a,a,pcv
vector unsigned charvector unsigned char
vperm[r] r,a,a,pcv
vector bool shortvector bool short
vperm[r] r,a,a,pcv
vector signed shortvector signed short
vperm[r] r,a,a,pcv
vector unsigned shortvector unsigned short
vperm[r] r,a,a,pcv
vector bool intvector bool int
vperm[r] r,a,a,pcv
vector signed intvector signed int
vperm[r] r,a,a,pcv
vector unsigned intvector unsigned int
vperm[r] r,a,a,pcv
vector bool long longvector bool long long
vperm[r] r,a,a,pcv
vector signed long longvector signed long long
vperm[r] r,a,a,pcv
vector unsigned long longvector unsigned long long
vperm[r] r,a,a,pcv
vector floatvector float
vperm[r] r,a,a,pcv
vector doublevector double
vperm[r] r,a,a,pcv
vec_rintVector Round to Nearest Integer
r = vec_rint (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 result value is selected based
on the rounding mode specified by the Floating-Point Rounding Control
field (RN) of the FPSCR register.Endian considerations:
None.
xvrdpicvec_rintxvrspicvec_rint
Supported type signatures for vec_rintraExample Implementationvector floatvector float
xvrspic r,a
vector doublevector double
xvrdpic r,a
vec_rlVector Rotate Left
r = vec_rl (a, b)
Purpose:
Rotates each element of a vector left by a given number of bits.
Result value: Each element of
r is obtained by rotating the
corresponding element of a left by the
number of bits specified by the corresponding element of
b.Endian considerations:
None.
vrlbvec_rlvrlwvec_rlvrldvec_rlvrlhvec_rl
Supported type signatures for vec_rlrabExample Implementationvector signed charvector signed char vector unsigned char
vrlb r,a,b
vector unsigned charvector unsigned char vector unsigned char
vrlb r,a,b
vector signed shortvector signed short vector unsigned short
vrlh r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vrlh r,a,b
vector signed intvector signed int vector unsigned int
vrlw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vrlw r,a,b
vector signed long longvector signed long long vector unsigned long long
vrld r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
vrld r,a,b
vec_rlmiVector Rotate Left then Mask Insert
r = vec_rlmi (a, b, c)
Purpose:
Rotates each element of a vector left and inserts each element under
a mask.
Result value: Each element of
r is obtained by rotating the
corresponding element of vector b left
and inserting it under mask into the corresponding element of
a. Bits 11:15 of the corresponding
element of c contain the mask
beginning, bits 19:23 contain the mask end, and bits 27:31 contain the
shift count.Endian considerations:
The referenced bit numbers within the elements of c are in left-to-right order.
vrlwmivec_rlmivrldmivec_rlmi
Supported type signatures for vec_rlmirabcExample ImplementationRestrictionsvector unsigned intvector unsigned int vector unsigned int vector unsigned int
vrlwmi r/a,b,c
ISA 3.0 or latervector unsigned long longvector unsigned long long vector unsigned long long vector unsigned long long
vrldmi r/a,b,c
ISA 3.0 or later
vec_rlnmVector Rotate Left then AND with Mask
r = vec_rlnm (a, b, c)
Purpose:
Rotates each element of a vector left, then logically ANDs it with a
mask.
Result value: Each element of
a is rotated left, then logically ANDed
with a mask specified by b and
c.b contains the shift count for
each element in the low-order byte, with other bytes zero.
c contains the mask begin and mask end
for each element, with the mask end in the low-order byte, the mask
begin in the next higher byte, and other bytes zero.Endian considerations:
None.
vspltiswvec_rlnmvslwvec_rlnmxxlorvec_rlnmvrlwnmvec_rlnmxxspltibvec_rlnmvextsb2dvec_rlnmvsldvec_rlnmvrldnmvec_rlnm
Supported type signatures for vec_rlnmrabcExample ImplementationRestrictionsvector unsigned intvector unsigned int vector unsigned int vector unsigned int
vspltisw t,8
vslw u,b,t
xxlor v,u,c
vrlwnm r,a,v
ISA 3.0 or latervector unsigned long longvector unsigned long long vector unsigned long long vector unsigned long long
xxspltib t,8
vextsb2d u,t
vsld v,b,u
xxlor w,v,c
vrldnm r,a,w
ISA 3.0 or later
vec_roundVector Round
r = vec_round (a)
Purpose:
Returns a vector containing the rounded values of the corresponding
elements of the source vector.
Result value: Each element of
r contains the value of the
corresponding element of a, rounded
to the nearest representable floating-point integer, using IEEE
round-to-nearest rounding. The current floating-point rounding
mode is ignored.Notes: This function might not
follow the strict operation definition of the resolution of a tie during
a round if the -qstrict=nooperationprecision compiler option is
specified to the XLC compiler.Endian considerations:
None.
xvrdpivec_roundvrfinvec_round
Supported type signatures for vec_roundraExample Implementationvector floatvector float
vrfin r,a
vector doublevector double
xvrdpi r,a
vec_rsqrtVector Reciprocal Square Root
r = vec_rsqrt (a)
Purpose:
Returns a vector containing a refined approximation of the reciprocal
square roots of the corresponding elements of the source vector. This
function provides an implementation-dependent greater precision than
vec_rsqrte.Result value: Each element of
r contains a refined approximation of
the reciprocal square root of the corresponding element of
a.Endian considerations:
None.
Notes:
The example implementations assume that a register
h initially contains
the floating-point value 0.5 in each element (single- or
double-precision as appropriate).
For finite square roots, this intrinsic guarantees at
least 23 bits of accuracy for single-precision floating
point, and at least 52 bits of accuracy for
double-precision floating point.
xvrsqrtedpvec_rsqrtxvmuldpvec_rsqrtxxlorvec_rsqrtxvnmsubadpvec_rsqrtxvmaddadpvec_rsqrtxvnmsubmdpvec_rsqrtxvadddpvec_rsqrtxvrsqrtespvec_rsqrtxvmulspvec_rsqrtxvnmsubmspvec_rsqrtxvmaddmspvec_rsqrt
vec_rsqrteVector Reciprocal Square Root Estimate
r = vec_rsqrte (a)
Purpose:
Returns a vector containing estimates of the reciprocal square roots of
the corresponding elements of the source vector.
Result value: Each element of
r contains the estimated value of the
reciprocal square root of the corresponding element of a.Endian considerations:
None.
Notes:
For finite square roots, this intrinsic guarantees at least 14
bits of accuracy.
xvrsqrtedpvec_rsqrtexvrsqrtespvec_rsqrte
Supported type signatures for vec_rsqrteraExample Implementationvector floatvector float
xvrsqrtesp r,a
vector doublevector double
xvrsqrtedp r,a
vec_sbox_beVector AES SubBytes Big-Endian
r = vec_sbox_be (a)
Purpose:
Performs the SubBytes operation, as defined in Federal Information
Processing Standards FIPS-197, on a state_array contained in
a.
Result value: r contains the
result of the SubBytes operation, as defined in Federal Information
Processing Standard FIPS-197, on the state array represented by
a.Endian considerations:
All element numberings of the SubBytes 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_sbox_be does not follow the bi-endian
programming model.
vsboxvec_sbox_be
Supported type signatures for vec_sbox_beraExample Implementationvector unsigned charvector unsigned char
vsbox r,a
vec_selVector Select
r = vec_sel (a, b, c)
Purpose:
Returns a vector selecting bits from two source vectors
depending on the corresponding bit values of a third source
vector.
Result value: Each bit of
r has the value of the corresponding
bit of a if the corresponding bit of
c is 0. Otherwise, the bit of
r has the value of the corresponding
bit of b.Endian considerations:
None.
xxselvec_sel
Supported type signatures for vec_selrabcExample Implementationvector bool charvector bool char vector bool char vector bool char
xxsel r,a,b,c
vector bool charvector bool char vector bool char vector unsigned char
xxsel r,a,b,c
vector signed charvector signed char vector signed char vector bool char
xxsel r,a,b,c
vector signed charvector signed char vector signed char vector unsigned char
xxsel r,a,b,c
vector unsigned charvector unsigned char vector unsigned char vector bool char
xxsel r,a,b,c
vector unsigned charvector unsigned char vector unsigned char vector unsigned char
xxsel r,a,b,c
vector bool shortvector bool short vector bool short vector bool short
xxsel r,a,b,c
vector bool shortvector bool short vector bool short vector unsigned short
xxsel r,a,b,c
vector signed shortvector signed short vector signed short vector bool short
xxsel r,a,b,c
vector signed shortvector signed short vector signed short vector unsigned short
xxsel r,a,b,c
vector unsigned shortvector unsigned short vector unsigned short vector bool short
xxsel r,a,b,c
vector unsigned shortvector unsigned short vector unsigned short vector unsigned short
xxsel r,a,b,c
vector bool intvector bool int vector bool int vector bool int
xxsel r,a,b,c
vector bool intvector bool int vector bool int vector unsigned int
xxsel r,a,b,c
vector signed intvector signed int vector signed int vector bool int
xxsel r,a,b,c
vector signed intvector signed int vector signed int vector unsigned int
xxsel r,a,b,c
vector unsigned intvector unsigned int vector unsigned int vector bool int
xxsel r,a,b,c
vector unsigned intvector unsigned int vector unsigned int vector unsigned int
xxsel r,a,b,c
vector bool long longvector bool long long vector bool long long vector bool long long
xxsel r,a,b,c
vector bool long longvector bool long long vector bool long long vector unsigned long long
xxsel r,a,b,c
vector signed long longvector signed long long vector signed long long vector bool long long
xxsel r,a,b,c
vector signed long longvector signed long long vector signed long long vector unsigned long long
xxsel r,a,b,c
vector unsigned long longvector unsigned long long vector unsigned long long vector bool long long
xxsel r,a,b,c
vector unsigned long longvector unsigned long long vector unsigned long long vector unsigned long long
xxsel r,a,b,c
vector floatvector float vector float vector bool int
xxsel r,a,b,c
vector floatvector float vector float vector unsigned int
xxsel r,a,b,c
vector doublevector double vector double vector bool long long
xxsel r,a,b,c
vector doublevector double vector double vector unsigned long long
xxsel r,a,b,c
vec_shasigma_beVector SHA Sigma Big-Endian
r = vec_shasigma_be (a, b, c)
Purpose:
Performs a Secure Hash computation in accordance with Federal
Information Processing Standards FIPS-180-3.
Result value: Each element of
r contains the SHA256 or SHA512 hash
as follows.
The result of the SHA-256 function (r[i] for
i = 0 to 3) is:
σ0(a[i]), if b is 0 and bit i of
the 4-bit c is 0.
σ1(a[i]), if b is 0 and bit i of
the 4-bit c is 1.
Σ0(a[i]), if b is nonzero and bit i
of the 4-bit c is 0.
Σ1(a[i]), if b is nonzero and bit i
of the 4-bit c is 1.
The result of the SHA-512 function (r[i] for
i = 0 to 1) is:
σ0(a[i]), if b is 0 and bit 2 ×
i of the 4-bit c is 0.
σ1(a[i]), if b is 0 and bit 2 ×
i of the 4-bit c is 1.
Σ0(a[i]), if b is nonzero and bit 2 ×
i of the 4-bit c is 0.
Σ1(a[i]), if b is nonzero and bit 2 ×
i of the 4-bit c is 1.
Endian considerations:
All element numberings 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_pmsum_be does not follow the bi-endian
programming model.
vshasigmawvec_shasigma_be
Supported type signatures for vec_shasigma_berabcExample Implementationvector unsigned intvector unsigned intconst int4-bit unsigned literal
vshasigmaw r,a,b,c
vector unsigned long longvector unsigned long longconst int4-bit unsigned literal
vshasigmaw r,a,b,d
vec_signedVector Convert Floating-Point to Signed Integer
r = vec_signed (a)
Purpose:
Converts a vector of floating-point numbers to a vector of signed
integers.
Result value: Each
element of r is obtained by
truncating the corresponding element of a to a signed integer. The current
floating-point rounding mode is ignored.Endian considerations:
None.
xvcvspsxwsvec_signedxvcvdpsxdsvec_signed
Supported type signatures for vec_signedraExample Implementationvector signed intvector float
xvcvspsxws r,a
vector signed long longvector double
xvcvdpsxds r,a
vec_signed2Vector Convert Double-Precision to Signed Word
r = vec_signed2 (a, b)
Purpose:
Converts two vectors of double-precision floating-point numbers to a
vector of signed 32-bit integers.
Result value: Let v be the concatenation of a and b. Each
element of r is obtained by truncating
the corresponding element of v to a
signed 32-bit integer.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_signed2xvcvdpsxwsvec_signed2vmrgowvec_signed2vmrgewvec_signed2
Supported type signatures for vec_signed2rabExample LE
ImplementationExample BE
Implementationvector signed intvector double vector double
xxpermdi t,b,a,3
xxpermdi u,b,a,0
xvcvdpsxws v,t
xvcvdpsxws w,u
vmrgow r,w,v
xxpermdi t,a,b,0
xxpermdi u,a,b,3
xvcvdpsxws v,t
xvcvdpsxws w,u
vmrgew r,v,w
vec_signedeVector Convert Double-Precision to Signed Word Even
r = vec_signede (a)
Purpose:
Converts elements of a source vector to signed integers and stores
them in the even-numbered elements of the result vector.
Result value: Element 0 of
r contains element 0 of a, truncated to a signed integer. Element 2 of
r contains element 1 of a, truncated to a signed integer. Elements 1 and
3 of r are undefined.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xvcvdpsxwsvec_signedevsldoivec_signede
Supported type signatures for vec_signederaExample LE
ImplementationExample BE
Implementationvector signed intvector double
xvcvdpsxws t,a
vsldoi r,t,t,12
xvcvdpsxws t,a
vec_signedoVector Convert Double-Precision to Signed Word Odd
r = vec_signedo (a)
Purpose:
Converts elements of a source vector to signed integers and stores them
in the odd-numbered elements of the result vector.
Result value: Element 1 of
r contains element 0 of a, truncated to a signed integer. Element 3 of
r contains element 1 of a, truncated to a signed integer. Elements 0 and
2 of r are undefined.Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xvcvdpsxwsvec_signedovsldoivec_signedo
Supported type signatures for vec_signedoraExample LE
ImplementationExample BE
Implementationvector signed intvector double
xvcvdpsxws r,a
xvcvdpsxws t,a
vsldoi r,t,t,12
vec_slVector Shift Left
r = vec_sl (a, b)
Purpose:
Performs a left shift for each element of a vector.
Result value: Each element of
r is the result of left-shifting the
corresponding element of a by the
number of bits specified by the corresponding element of b, modulo the number of bits in the element.
Zeros are shifted in from the right.Endian considerations:
None.
vslbvec_slvslwvec_slvsldvec_slvslhvec_sl
Supported type signatures for vec_slrabExample Implementationvector signed charvector signed char vector unsigned char
vslb r,a,b
vector unsigned charvector unsigned char vector unsigned char
vslb r,a,b
vector signed shortvector signed short vector unsigned short
vslh r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vslh r,a,b
vector signed intvector signed int vector unsigned int
vslw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vslw r,a,b
vector signed long longvector signed long long vector unsigned long long
vsld r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
vsld r,a,b
vec_sldVector Shift Left Double
r = vec_sld (a, b, c)
Purpose:
Left shifts a double vector (that is, two concatenated vectors) by a
given number of bytes. For vec_sld being performed on the vector bool
and floating-point types, the result is undefined when the specified
shift count is not a multiple of the element size.
Result value: Vector r receives the most-significant 16 bytes obtained
by concatenating a and b and shifting left by the number of bytes
specified by c, which must be in the
range 0–15.Endian considerations:
This intrinsic is not endian-neutral, so uses of
vec_sld in big-endian code must be rewritten for little-endian targets.
Historically, vec_sld could be used to shift by amounts not a multiple
of the element size for most types, in which case the purpose of the
shift is difficult to determine and difficult to automatically rewrite
efficiently for little endian. So the concatenation of a and b is
done in big-endian fashion (left to right), and the shift is always
to the left. This will generally produce surprising results for
little-endian targets. See also .
vsldoivec_sld
Supported type signatures for vec_sldrabcExample Implementationvector bool charvector bool charvector bool char4-bit unsigned literal
vsldoi r,a,b,c
vector signed charvector signed charvector signed char4-bit unsigned literal
vsldoi r,a,b,c
vector unsigned charvector unsigned charvector unsigned char4-bit unsigned literal
vsldoi r,a,b,c
vector bool shortvector bool shortvector bool short4-bit unsigned literal
vsldoi r,a,b,c
vector signed shortvector signed shortvector signed short4-bit unsigned literal
vsldoi r,a,b,c
vector unsigned shortvector unsigned shortvector unsigned short4-bit unsigned literal
vsldoi r,a,b,c
vector pixelvector pixelvector pixel4-bit unsigned literal
vsldoi r,a,b,c
vector bool intvector bool intvector bool int4-bit unsigned literal
vsldoi r,a,b,c
vector signed intvector signed intvector signed int4-bit unsigned literal
vsldoi r,a,b,c
vector unsigned intvector unsigned intvector unsigned int4-bit unsigned literal
vsldoi r,a,b,c
vector bool long longvector bool long longvector bool long long4-bit unsigned literal
vsldoi r,a,b,c
vector signed long longvector signed long longvector signed long long4-bit unsigned literal
vsldoi r,a,b,c
vector unsigned long longvector unsigned long longvector unsigned long long4-bit unsigned literal
vsldoi r,a,b,c
vector floatvector floatvector float4-bit unsigned literal
vsldoi r,a,b,c
vector doublevector doublevector double4-bit unsigned literal
vsldoi r,a,b,c
vec_sldwVector Shift Left Double by Words
r = vec_sldw (a, b, c)
Purpose:
Returns a vector obtained by shifting left the concatenated source
vectors by the number of specified words.
Result value: Vector r receives the most-significant 16 bytes obtained
by concatenating a and b and shifting left by the number of words
specified by c, which must be in the
range 0–3.Endian considerations:
This intrinsic is not endian-neutral, so uses of
vec_sldw in big-endian code must be rewritten for little-endian targets.
The concatenation of a and b is
done in big-endian fashion (left to right), and the shift is always
to the left. This will generally produce surprising results for
little-endian targets.
xxsldwivec_sldw
Supported type signatures for vec_sldwrabcExample Implementationvector signed charvector signed charvector signed char2-bit unsigned literal
xxsldwi r,a,b,c
vector unsigned charvector unsigned charvector unsigned char2-bit unsigned literal
xxsldwi r,a,b,c
vector signed shortvector signed shortvector signed short2-bit unsigned literal
xxsldwi r,a,b,c
vector unsigned shortvector unsigned shortvector unsigned short2-bit unsigned literal
xxsldwi r,a,b,c
vector signed intvector signed intvector signed int2-bit unsigned literal
xxsldwi r,a,b,c
vector unsigned intvector unsigned intvector unsigned int2-bit unsigned literal
xxsldwi r,a,b,c
vector signed long longvector signed long longvector signed long long2-bit unsigned literal
xxsldwi r,a,b,c
vector unsigned long longvector unsigned long longvector unsigned long long2-bit unsigned literal
xxsldwi r,a,b,c
vec_sllVector Shift Left Long
r = vec_sll (a, b)
Purpose:
Left shifts an entire vector by a given number of bits.
Result value: Vector
r contains the contents of a, shifted left by the number of bits specified
by the three least-significant bits of b. Zeros are supplied on the right. The shift
count must have been replicated into all bytes of b; if not, the value of r is undefined.Endian considerations:
This intrinsic is not endian-neutral, so uses of
vec_sll in big-endian code must be rewritten for little-endian targets.
vslvec_sll
Supported type signatures for vec_sllrabExample Implementationvector signed charvector signed char vector unsigned char
vsl r,a,b
vector unsigned charvector unsigned char vector unsigned char
vsl r,a,b
vector signed shortvector signed short vector unsigned char
vsl r,a,b
vector unsigned shortvector unsigned short vector unsigned char
vsl r,a,b
vector pixelvector pixel vector unsigned char
vsl r,a,b
vector signed intvector signed int vector unsigned char
vsl r,a,b
vector unsigned intvector unsigned int vector unsigned char
vsl r,a,b
vector signed long longvector signed long long vector unsigned char
vsl r,a,b
vector unsigned long longvector unsigned long long vector unsigned char
vsl r,a,b
vec_sloVector Shift Left by Octets
r = vec_slo (a, b)
Purpose:
Left shifts a vector by a given number of bytes (octets).
Result value: Vector r receives the contents of a, shifted left by the number of bytes specified
by bits 1:4 of the least-significant byte of b.Endian considerations:
This intrinsic is not endian-neutral, so uses of
vec_slo in big-endian code must be rewritten for little-endian targets.
The shift count is in element 15 of b
for big-endian, but in element 0 of b
for little-endian.
vslovec_slo
Supported type signatures for vec_slorabExample Implementationvector signed charvector signed char vector signed char
vslo r,a,b
vector signed charvector signed char vector unsigned char
vslo r,a,b
vector unsigned charvector unsigned char vector signed char
vslo r,a,b
vector unsigned charvector unsigned char vector unsigned char
vslo r,a,b
vector signed shortvector signed short vector signed char
vslo r,a,b
vector signed shortvector signed short vector unsigned char
vslo r,a,b
vector unsigned shortvector unsigned short vector signed char
vslo r,a,b
vector unsigned shortvector unsigned short vector unsigned char
vslo r,a,b
vector pixelvector pixel vector signed char
vslo r,a,b
vector pixelvector pixel vector unsigned char
vslo r,a,b
vector signed intvector signed int vector signed char
vslo r,a,b
vector signed intvector signed int vector unsigned char
vslo r,a,b
vector unsigned intvector unsigned int vector signed char
vslo r,a,b
vector unsigned intvector unsigned int vector unsigned char
vslo r,a,b
vector signed long longvector signed long long vector signed char
vslo r,a,b
vector signed long longvector signed long long vector unsigned char
vslo r,a,b
vector unsigned long longvector unsigned long long vector signed char
vslo r,a,b
vector unsigned long longvector unsigned long long vector unsigned char
vslo r,a,b
vector floatvector float vector signed char
vslo r,a,b
vector floatvector float vector unsigned char
vslo r,a,b
vec_slvVector Shift Left Variable
r = vec_slv (a, b)
Purpose:
Left-shifts a vector by a varying number of bits by element.
Result value: Let v be a 17-byte vector formed from a in bytes [0:15] and a zero byte in element 16.
Then each byte element i of r is determined as follows. The start bit
sb is obtained from bits 5:7 of byte element
i of b. Then
the contents of bits sb:sb+7
of the halfword in byte elements
i:i+1 of v are placed into byte element
i of r.An example follows:
a0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0Fb000102030405060708090A0B0C0D0E0Fr0F1E3C78F0E1C3870F1E3C78F0E1C380Endian considerations:
All bit and byte element numbers are specified in big-endian order.
This intrinsic is not endian-neutral.
vslvvec_slv
Supported type signatures for vec_slvrabExample ImplementationRestrictionsvector unsigned charvector unsigned char vector unsigned char
vslv r,a,b
ISA 3.0 or later
vec_splatVector Splat
r = vec_splat (a, b)
Purpose:
Returns a vector that has all of its elements set to a given value.
Result value: The value of each
element of r is the value of the
element of a specified by b, which must be an element number less than the
number of elements supported for a's
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.
vspltbvec_splatxxspltwvec_splatxxpermdivec_splatvsplthvec_splat
Supported type signatures for vec_splatrabExample LE
ImplementationExample BE
Implementationvector bool charvector bool char const int
vspltb r,a,15-b
vspltb r,a,b
vector signed charvector signed char const int
vspltb r,a,15-b
vspltb r,a,b
vector unsigned charvector unsigned char const int
vspltb r,a,15-b
vspltb r,a,b
vector bool shortvector bool short const int
vsplth r,a,7-b
vsplth r,a,b
vector signed shortvector signed short const int
vsplth r,a,7-b
vsplth r,a,b
vector unsigned shortvector unsigned short const int
vsplth r,a,7-b
vsplth r,a,b
vector pixelvector pixel const int
vsplth r,a,7-b
vsplth r,a,b
vector bool intvector bool int const int
xxspltw r,a,3-b
xxspltw r,a,b
vector signed intvector signed int const int
xxspltw r,a,3-b
xxspltw r,a,b
vector unsigned intvector unsigned int const int
xxspltw r,a,3-b
xxspltw r,a,b
vector bool long longvector bool long long const int
xxpermdi r,a,a,(1-b)*3
xxpermdi r,a,a,b
vector signed long longvector signed long long const int
xxpermdi r,a,a,(1-b)*3
xxpermdi r,a,a,b
vector unsigned long longvector unsigned long long const int
xxpermdi r,a,a,(1-b)*3
xxpermdi r,a,a,b
vector floatvector float const int
xxspltw r,a,3-b
xxspltw r,a,b
vector doublevector double const int
xxpermdi r,a,a,(1-b)*3
xxpermdi r,a,a,b
vec_splat_s8Vector Splat to Signed Byte
r = vec_splat_s8 (a)
Purpose:
Returns a vector with all elements equal to the given value.
Result value:
Each element of r is given the
sign-extended 5-bit value of a.
The range of this value is [-16:15].Endian considerations:
None.
vspltisbvec_splat_s8
Supported type signatures for vec_splat_s8raExample Implementationvector signed char5-bit signed literal
vspltisb r,a
vec_splat_s16Vector Splat to Signed Halfword
r = vec_splat_s16 (a)
Purpose:
Returns a vector with all elements equal to the given value.
Result value:
Each element of r is given the
sign-extended 5-bit value of a.
The range of this value is [-16:15].Endian considerations:
None.
vspltishvec_splat_s16
Supported type signatures for vec_splat_s16raExample Implementationvector signed short5-bit signed literal
vspltish r,a
vec_splat_s32Vector Splat to Signed Word
r = vec_splat_s32 (a)
Purpose:
Returns a vector with all elements equal to the given value.
Result value:
Each element of r is given the
sign-extended 5-bit value of a.
The range of this value is [-16:15].Endian considerations:
None.
vspltiswvec_splat_s32
Supported type signatures for vec_splat_s32raExample Implementationvector signed int5-bit signed literal
vspltisw r,a
vec_splat_u8Vector Splat to Unsigned Byte
r = vec_splat_u8 (a)
Purpose:
Returns a vector with all elements equal to the given value.
Result value:
The 5-bit signed value of a is
sign-extended to a byte and the resulting value is cast to an
unsigned char. This value is placed in each element of
r. The range of the original value is
[-16:15].Endian considerations:
None.
vspltisbvec_splat_u8
Supported type signatures for vec_splat_u8raExample Implementationvector unsigned char5-bit signed literal
vspltisb r,a
vec_splat_u16Vector Splat to Unsigned Halfword
r = vec_splat_u16 (a)
Purpose:
Returns a vector with all elements equal to the given value.
Result value:
The 5-bit signed value of a is
sign-extended to a halfword and the resulting value is cast to an
unsigned short. This value is placed in each element of
r. The range of the original value is
[-16:15].Endian considerations:
None.
vspltishvec_splat_u16
Supported type signatures for vec_splat_u16raExample Implementationvector unsigned short5-bit signed literal
vspltish r,a
vec_splat_u32Vector Splat to Unsigned Word
r = vec_splat_u32 (a)
Purpose:
Returns a vector with all elements equal to the given value.
Result value:
The 5-bit signed value of a is
sign-extended to a word and the resulting value is cast to an
unsigned int. This value is placed in each element of
r. The range of the original value is
[-16:15].Endian considerations:
None.
vspltiswvec_splat_u32
Supported type signatures for vec_splat_u32raExample Implementationvector unsigned int5-bit signed literal
vspltisw r,a
vec_splatsVector Splat Scalar
r = vec_splats (a)
Purpose:
Returns a vector with the value of each element set to the value of
the scalar input parameter.
Result value: Each element of
r is set to the value of a.Endian considerations:
None.
rlwinmvec_splatsmtvsrdvec_splatsvspltbvec_splatsmtvsrwzvec_splatsxxspltwvec_splatsxxpermdivec_splatsvsplthvec_splatsxxscvdpspnvec_splats
Supported type signatures for vec_splatsraExample Implementationvector signed charsigned char
rlwinm t,a,0,0xff
mtvsrd u,t
vspltb r,u,7
vector unsigned charunsigned char
rlwinm t,a,0,0xff
mtvsrd u,t
vspltb r,u,7
vector signed shortsigned short
rlwinm t,a,0,0xffff
mtvsrd u,t
vsplth r,u,3
vector unsigned shortunsigned short
rlwinm t,a,0,0xffff
mtvsrd u,t
vsplth r,u,3
vector signed intsigned int
mtvsrd t,a
vspltb r,t,7
vector unsigned intunsigned int
mtvsrd t,a
vspltb r,t,7
vector signed long longsigned long long
mtvsrd t,a
xxpermdi r,t,t,0
vector unsigned long longunsigned long long
mtvsrd t,a
xxpermdi r,t,t,0
vector signed __int128signed __int128
mtvsrwz t,a
xxspltw r,t,1
vector unsigned __int128unsigned __int128
mtvsrwz t,a
xxspltw r,t,1
vector floatfloat
xxscvdpspn t,a
xxspltw r,t,0
vector doubledouble
xxpermdi r,a,a,0
vec_sqrtVector Square Root
r = vec_sqrt (a)
Purpose:
Returns a vector containing the square root of each element in the
source vector.
Result value: Each element of
r is the square root of the
corresponding element of a.Endian considerations:
None.
xvsqrtdpvec_sqrtxvsqrtspvec_sqrt
Supported type signatures for vec_sqrtraExample Implementationvector floatvector float
xvsqrtsp r,a
vector doublevector double
xvsqrtdp r,a
vec_srVector Shift Right
r = vec_sr (a, b)
Purpose:
Performs a logical right shift for each element of a vector.
Result value: Each element of
r is the result of logically
right-shifting the corresponding element of a by the number of bits specified by the
corresponding element of b, modulo the
number of bits in the element. Zeros are shifted in from the
left.Endian considerations:
None.
vsrbvec_srvsrwvec_srvsrdvec_srvsrhvec_sr
Supported type signatures for vec_srrabExample Implementationvector signed charvector signed char vector unsigned char
vsrb r,a,b
vector unsigned charvector unsigned char vector unsigned char
vsrb r,a,b
vector signed shortvector signed short vector unsigned short
vsrh r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vsrh r,a,b
vector signed intvector signed int vector unsigned int
vsrw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vsrw r,a,b
vector signed long longvector signed long long vector unsigned long long
vsrd r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
vsrd r,a,b
vec_sraVector Shift Right Algebraic
r = vec_sra (a, b)
Purpose:
Performs an algebraic right shift for each element of a vector.
Result value: Each element of
r is the result of algebraically
right-shifting the corresponding element of a by the number of bits specified by the
corresponding element of b, modulo the
number of bits in the element. Copies of the sign bit are shifted in
from the left.Endian considerations:
None.
vsrabvec_sravsrawvec_sravsradvec_sravsrahvec_sra
Supported type signatures for vec_srarabExample Implementationvector signed charvector signed char vector unsigned char
vsrab r,a,b
vector unsigned charvector unsigned char vector unsigned char
vsrab r,a,b
vector signed shortvector signed short vector unsigned short
vsrah r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vsrah r,a,b
vector signed intvector signed int vector unsigned int
vsraw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vsraw r,a,b
vector signed long longvector signed long long vector unsigned long long
vsrad r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
vsrad r,a,b
vec_srlVector Shift Right Long
r = vec_srl (a, b)
Purpose:
Right shifts a vector by a given number of bits.
Result value: Vector r contains the contents of a, shifted right by the number of bits specified
by the 3 least-significant bits of b.
Zeros are supplied on the left. The shift count must have been
replicated into all bytes of b; if not,
the value of r is undefined.Endian considerations:
This intrinsic is not endian-neutral, so uses of
vec_srl in big-endian code must be rewritten for little-endian targets.
vsrvec_srl
Supported type signatures for vec_srlrabExample Implementationvector signed charvector signed char vector unsigned char
vsr r,a,b
vector unsigned charvector unsigned char vector unsigned char
vsr r,a,b
vector signed shortvector signed short vector unsigned char
vsr r,a,b
vector unsigned shortvector unsigned short vector unsigned char
vsr r,a,b
vector pixelvector pixel vector unsigned char
vsr r,a,b
vector signed intvector signed int vector unsigned char
vsr r,a,b
vector unsigned intvector unsigned int vector unsigned char
vsr r,a,b
vector signed long longvector signed long long vector unsigned char
vsr r,a,b
vector unsigned long longvector unsigned long long vector unsigned char
vsr r,a,b
vec_sroVector Shift Right by Octets
r = vec_sro (a, b)
Purpose:
Right shifts a vector by a given number of bytes (octets).
Result value: Vector
r receives the contents of
a, shifted right by the number of bytes
specified by bits 1–4 of the least-significant byte of
b.
Zeros are supplied from the left.Endian considerations:
This intrinsic is not endian-neutral, so uses of
vec_sro in big-endian code must be rewritten for little-endian targets.
The shift count is in element 15 of b
for big-endian, but in element 0 of b
for little-endian. See also .
vsrovec_sro
Supported type signatures for vec_srorabExample Implementationvector signed charvector signed char vector signed char
vsro r,a,b
vector signed charvector signed char vector unsigned char
vsro r,a,b
vector unsigned charvector unsigned char vector signed char
vsro r,a,b
vector unsigned charvector unsigned char vector unsigned char
vsro r,a,b
vector signed shortvector signed short vector signed char
vsro r,a,b
vector signed shortvector signed short vector unsigned char
vsro r,a,b
vector unsigned shortvector unsigned short vector signed char
vsro r,a,b
vector unsigned shortvector unsigned short vector unsigned char
vsro r,a,b
vector pixelvector pixel vector signed char
vsro r,a,b
vector pixelvector pixel vector unsigned char
vsro r,a,b
vector signed intvector signed int vector signed char
vsro r,a,b
vector signed intvector signed int vector unsigned char
vsro r,a,b
vector unsigned intvector unsigned int vector signed char
vsro r,a,b
vector unsigned intvector unsigned int vector unsigned char
vsro r,a,b
vector signed long longvector signed long long vector signed char
vsro r,a,b
vector signed long longvector signed long long vector unsigned char
vsro r,a,b
vector unsigned long longvector unsigned long long vector signed char
vsro r,a,b
vector unsigned long longvector unsigned long long vector unsigned char
vsro r,a,b
vector floatvector float vector signed char
vsro r,a,b
vector floatvector float vector unsigned char
vsro r,a,b
vec_srvVector Shift Right Variable
r = vec_srv (a, b)
Purpose:
Right-shifts a vector by a varying number of bits by element.
Result value: Let v be a 17-byte vector formed from a zero byte
in element 0 and the elements of a
in bytes [1:16]. Then each byte element i of
r is determined as follows. The
start bit sb is obtained from bits 5:7 of
byte element i of b. Then the contents of bits
(8 – sb):(15 – sb) of the
halfword in byte elements i:i+1
of v are placed into byte element
i of r.An example follows:
a0F0F0F0F0F0F0F0F0F0F0F0F0F0F0F0Fb0F0E0D0C0B0A09080706050403020100r003C78F0E1C3870F1E3C78F0E1C3870FEndian considerations:
All bit and byte element numbers are specified in big-endian order.
This intrinsic is not endian-neutral.
vsrvvec_srv
Supported type signatures for vec_srvrabExample ImplementationRestrictionsvector unsigned charvector unsigned char vector unsigned char
vsrv r,a,b
ISA 3.0 or later
vec_stVector Store Indexed
vec_st (a, b, c)
Purpose:
Stores a 16-byte vector into memory at the address specified by a
displacement and a pointer, ignoring the four low-order bits
of the calculated address.
Operation: A memory address
is obtained by adding b and c, and masking off the four low-order bits of the
result. The 16-byte vector in a is
stored to the resultant memory address.Endian considerations:
None.
stvxvec_st
Supported type signatures for vec_stabcExample ISA 3.0
Implementationvector bool charsigned long longvector bool char *
stvx r,b,a
vector bool charsigned long longsigned char *
stvx r,b,a
vector bool charsigned long longunsigned char *
stvx r,b,a
vector signed charsigned long longsigned char *
stvx r,b,a
vector signed charsigned long longvector signed char *
stvx r,b,a
vector unsigned charsigned long long unsigned char *
stvx r,b,a
vector unsigned charsigned long longvector unsigned char *
stvx r,b,a
vector bool shortsigned long longvector bool short *
stvx r,b,a
vector bool shortsigned long longsigned short *
stvx r,b,a
vector bool shortsigned long longunsigned short *
stvx r,b,a
vector signed shortsigned long long signed short *
stvx r,b,a
vector signed shortsigned long longvector signed short *
stvx r,b,a
vector unsigned shortsigned long long unsigned short *
stvx r,b,a
vector unsigned shortsigned long longvector unsigned short *
stvx r,b,a
vector pixelsigned long longvector pixel *
stvx r,b,a
vector bool intsigned long longvector bool int *
stvx r,b,a
vector bool intsigned long longsigned int *
stvx r,b,a
vector bool intsigned long longunsigned int *
stvx r,b,a
vector signed intsigned long long signed int *
stvx r,b,a
vector signed intsigned long longvector signed int *
stvx r,b,a
vector unsigned intsigned long long unsigned int *
stvx r,b,a
vector unsigned intsigned long longvector unsigned int *
stvx r,b,a
vector bool long longsigned long longvector bool long long *
stvx r,b,a
vector signed long longsigned long long signed long long *
stvx r,b,a
vector signed long longsigned long longvector signed long long *
stvx r,b,a
vector unsigned long longsigned long long unsigned long long *
stvx r,b,a
vector unsigned long longsigned long longvector unsigned long long *
stvx r,b,a
vector floatsigned long long float *
stvx r,b,a
vector floatsigned long longvector float *
stvx r,b,a
vector doublesigned long long double *
stvx r,b,a
vector doublesigned long longvector double *
stvx r,b,a
vec_steVector Store Element Indexed
vec_ste (a, b, c)
Purpose:
Stores a single element from a 16-byte vector into memory at the address
specified by a displacement and a pointer, aligned to the element size.
Operation: The integer value
b is added to the pointer value
c. 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.
An element offset eo is calculated by taking the
resultant address modulo 16. The vector element of a at offset eo is stored
to the resultant address.Endian considerations:
None.
Notes:
Be careful to note that the address (b+c) is aligned to an
element boundary. Do not attempt to store unaligned data with
this intrinsic.
stvebxvec_stestvewxvec_stestvehxvec_ste
Supported type signatures for vec_steabcExample ISA 3.0
Implementationvector bool charsigned long longsigned char *
stvebx r,b,a
vector bool charsigned long longunsigned char *
stvebx r,b,a
vector signed charsigned long longsigned char *
stvebx r,b,a
vector unsigned charsigned long longunsigned char *
stvebx r,b,a
vector bool shortsigned long longsigned short *
stvehx r,b,a
vector bool shortsigned long longunsigned short *
stvehx r,b,a
vector signed shortsigned long longsigned short *
stvehx r,b,a
vector unsigned shortsigned long longunsigned short *
stvehx r,b,a
vector pixelsigned long longunsigned short *
stvehx r,b,a
vector bool intsigned long longsigned int *
stvewx r,b,a
vector bool intsigned long longunsigned int *
stvewx r,b,a
vector signed intsigned long longsigned int *
stvewx r,b,a
vector unsigned intsigned long longunsigned int *
stvewx r,b,a
vector floatsigned long longfloat *
stvewx r,b,a
vec_stlVector Store Indexed Least Recently Used
vec_stl (a, b, c)
Purpose:
Stores a 16-byte vector into memory at the address specified by a
displacement and a pointer, ignoring the four low-order bits
of the calculated address, and marking the cache line containing
the address as least frequently used.
Operation: A memory address
is obtained by adding b and c, and masking off the four low-order bits of the
result. The 16-byte vector in a is
stored to the resultant memory address, and the containing cache
line is marked as least frequently used.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.
stvxlvec_stl
Supported type signatures for vec_stlabcExample ISA 3.0
Implementationvector bool charsigned long longvector bool char *
stvxl r,b,a
vector bool charsigned long longsigned char *
stvxl r,b,a
vector bool charsigned long longunsigned char *
stvxl r,b,a
vector signed charsigned long longsigned char *
stvxl r,b,a
vector signed charsigned long longvector signed char *
stvxl r,b,a
vector unsigned charsigned long long unsigned char *
stvxl r,b,a
vector unsigned charsigned long longvector unsigned char *
stvxl r,b,a
vector bool shortsigned long longvector bool short *
stvxl r,b,a
vector bool shortsigned long longsigned short *
stvxl r,b,a
vector bool shortsigned long longunsigned short *
stvxl r,b,a
vector signed shortsigned long long signed short *
stvxl r,b,a
vector signed shortsigned long longvector signed short *
stvxl r,b,a
vector unsigned shortsigned long long unsigned short *
stvxl r,b,a
vector unsigned shortsigned long longvector unsigned short *
stvxl r,b,a
vector pixelsigned long longvector pixel *
stvxl r,b,a
vector bool intsigned long longvector bool int *
stvxl r,b,a
vector bool intsigned long longsigned int *
stvxl r,b,a
vector bool intsigned long longunsigned int *
stvxl r,b,a
vector signed intsigned long long signed int *
stvxl r,b,a
vector signed intsigned long longvector signed int *
stvxl r,b,a
vector unsigned intsigned long long unsigned int *
stvxl r,b,a
vector unsigned intsigned long longvector unsigned int *
stvxl r,b,a
vector bool long longsigned long longvector bool long long *
stvxl r,b,a
vector signed long longsigned long long signed long long *
stvxl r,b,a
vector signed long longsigned long longvector signed long long *
stvxl r,b,a
vector unsigned long longsigned long long unsigned long long *
stvxl r,b,a
vector unsigned long longsigned long longvector unsigned long long *
stvxl r,b,a
vector floatsigned long long float *
stvxl r,b,a
vector floatsigned long longvector float *
stvxl r,b,a
vector doublesigned long long double *
stvxl r,b,a
vector doublesigned long longvector double *
stvxl r,b,a
vec_subVector Subtract
r = vec_sub (a, b)
Purpose:
Returns a vector containing the result of subtracting each element of
one source vector from the corresponding element of another source
vector.
Result value: The value of each
element of r is the result of
subtracting the value of the corresponding element of b from the value of the corresponding element of
a. The arithmetic is modular for
integer vectors.Endian considerations:
None.
vsububmvec_subvsubuwmvec_subvsubuqmvec_subvsubudmvec_subvsubuhmvec_subxvsubdpvec_subxvsubspvec_sub
Supported type signatures for vec_subrabExample Implementationvector signed charvector signed char vector signed char
vsububm r,a,b
vector unsigned charvector unsigned char vector unsigned char
vsububm r,a,b
vector signed shortvector signed short vector signed short
vsubuhm r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vsubuhm r,a,b
vector signed intvector signed int vector signed int
vsubuwm r,a,b
vector unsigned intvector unsigned int vector unsigned int
vsubuwm r,a,b
vector signed long longvector signed long long vector signed long long
vsubudm r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
vsubudm r,a,b
vector signed __int128vector signed __int128 vector signed __int128
vsubuqm r,a,b
vector unsigned __int128vector unsigned __int128 vector unsigned __int128
vsubuqm r,a,b
vector floatvector float vector float
xvsubsp r,a,b
vector doublevector double vector double
xvsubdp r,a,b
vec_subcVector Subtract Carryout
r = vec_subc (a, b)
Purpose:
Returns a vector wherein each element contains the carry
produced by subtracting the corresponding elements of the two
source vectors.
Result value: The value of each
element of r is the complement of the
carry produced by subtracting the value of the corresponding element of
b from the value of the corresponding
element of a. The value is 0 if a
borrow occurred, or 1 if no borrow occurred.Endian considerations:
None.
vsubcuwvec_subcvsubcuqvec_subc
Supported type signatures for vec_subcrabExample Implementationvector signed intvector signed int vector signed int
vsubcuw r,a,b
vector unsigned intvector unsigned int vector unsigned int
vsubcuw r,a,b
vector signed __int128vector signed __int128 vector signed __int128
vsubcuq r,a,b
vector unsigned __int128vector unsigned __int128 vector unsigned __int128
vsubcuq r,a,b
vec_subeVector Subtract Extended
r = vec_sube (a, b, c)
Purpose:
Returns a vector containing the result of first elementwise subtracting
one vector from another vector, and then elementwise adding a third
carry vector. Elements of the carry vector have a value of 0 or 1.
Result value: Let c' be a vector for which each element is 0 if
the rightmost bit of the corresponding element of c is 0, and 1 otherwise. Then the value of each
element of r is produced by subtracting
the corresponding element of b from the
corresponding element of a, and then
adding the corresponding element of c'.
Endian considerations:
None.
Notes:
Code generated for this intrinsic should ensure only the
low-order bit of c participates
in the sum.
vspltiswvec_subevsubuwmvec_subexxlandvec_subevsubeuqmvec_sube
Supported type signatures for vec_suberabcExample Implementationvector signed intvector signed int vector signed int vector signed int
vspltisw t,1
vsubuwm u,a,b
xxland v,c,t
vsubuwm r,u,v
vector unsigned intvector unsigned int vector unsigned int vector unsigned int
vspltisw t,1
vsubuwm u,a,b
xxland v,c,t
vsubuwm r,u,v
vector signed __int128vector signed __int128 vector signed __int128 vector signed __int128
vsubeuqm r,a,b,c
vector unsigned __int128vector unsigned __int128 vector unsigned __int128 vector unsigned __int128
vsubeuqm r,a,b,c
vec_subecVector Subtract Extended Carryout
r = vec_subec (a, b, c)
Purpose:
Returns a vector containing the carries produced by subtracting one
vector from another, then adding a third vector to the difference. The
third vector is a carry vector, with each element having a value of 0
or 1.
Result value: The value of each
element of r is the carry produced by
subtracting the corresponding element of b from the corresponding element of a, and then adding the 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_subecxxlandvec_subecvsubuwmvec_subecvsubcuwvec_subecxxlorvec_subecvsubecuqvec_subec
Supported type signatures for vec_subecrabcExample Implementationvector signed intvector signed int vector signed int vector signed int
vspltisw t,1
xxland u,c,t
vsubuwm v,a,b
vsubcuw w,a,b
vsubcuw x,v,u
xxlor r,w,x
vector unsigned intvector unsigned int vector unsigned int vector unsigned int
vspltisw t,1
xxland u,c,t
vsubuwm v,a,b
vsubcuw w,a,b
vsubcuw x,v,u
xxlor r,w,x
vector signed __int128vector signed __int128 vector signed __int128 vector signed __int128
vsubecuq r,a,b,c
vector unsigned __int128vector unsigned __int128 vector unsigned __int128 vector unsigned __int128
vsubecuq r,a,b,c
vec_subsVector Subtract Saturated
r = vec_subs (a, b)
Purpose:
Returns a vector containing the saturated differences of each set of
corresponding elements of the source vectors.
Result value: The value of each
element of r is the saturated result of
subtracting the value of the corresponding element of b from the value of the corresponding element of
a.Endian considerations:
None.
vsubsbsvec_subsvsububsvec_subsvsubswsvec_subsvsubuwsvec_subsvsubshsvec_subsvsubuhsvec_subs
Supported type signatures for vec_subsrabExample Implementationvector signed charvector signed char vector signed char
vsubsbs r,a,b
vector unsigned charvector unsigned char vector unsigned char
vsububs r,a,b
vector signed shortvector signed short vector signed short
vsubshs r,a,b
vector unsigned shortvector unsigned short vector unsigned short
vsubuhs r,a,b
vector signed intvector signed int vector signed int
vsubsws r,a,b
vector unsigned intvector unsigned int vector unsigned int
vsubuws r,a,b
vec_sum2sVector Sum Across Half
r = vec_sum2s (a, b)
Purpose:
Returns a vector containing the results of performing a sum-across
operation within each doubleword of the first source vector together with
accumulated results in the second source vector.
Result value: Elements 0 and 2
of r are 0. Element 1 of r contains the saturated sum of elements 0 and 1
of a and element 1 of b. Element 3 of r contains the saturated sum of elements 2 and 3
of a and element 3 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.
vsldoivec_sum2svsum2swsvec_sum2s
Supported type signatures for vec_sum2srabExample LE
ImplementationExample BE
Implementationvector signed intvector signed int vector signed int
vsldoi t,b,b,12
vsum2sws u,a,t
vsldoi r,u,u,4
vsum2sws r,a,b
vec_sum4sVector Sum Across Quarter
r = vec_sum4s (a, b)
Purpose:
Returns a vector containing the results of performing a sum-across
operation within each word of the first source vector together with
accumulated results in the second source vector.
Result value:
There are two cases:
a is a vector of signed
or unsigned char. For each element
n of the result vector, the value
is obtained by adding elements 4n
through 4n + 3 of a and element
n of b using saturated addition.
a is a vector of signed
short. For each element n of the
result vector, the value is obtained by adding elements
2n and 2n + 1
of a and element
n of b using saturated addition.
Endian considerations:
None.
vsum4sbsvec_sum4svsum4shsvec_sum4svsum4ubsvec_sum4s
Supported type signatures for vec_sum4srabExample
Implementationvector signed intvector signed charvector signed int
vsum4sbs r,a,b
vector unsigned intvector unsigned charvector unsigned int
vsum4ubs r,a,b
vector signed intvector signed shortvector signed int
vsum4shs r,a,b
vec_sumsVector Sum Across
r = vec_sums (a, b)
Purpose:
Returns a vector containing the results of performing a sum-across
operation on the first source vector together with accumulated results
in the second source vector.
Result value: Elements 0, 1, and 2
of r are 0. Element 3 is the saturated
sum of all the elements of a and
element 3 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.
vspltwvec_sumsvsumswsvec_sumsvsldoivec_sums
Supported type signatures for vec_sumsrabExample LE
ImplementationExample BE
Implementationvector signed intvector signed intvector signed int
vspltw t,b,0
vsumsws u,a,t
vsldoi r,u,u,12
vsumsws r,a,b
vec_test_data_classVector Test Data Class
r = vec_test_data_class (a, b)
Purpose:
Determines the data class for each floating-point element.
Result value: Each element of
r is set to all ones if the
corresponding element of a matches one
of the possible data types selected by b. If not, the element is set to all zeros.
b can select one of the following data
classes, or more than one of them by ORing the constants together.
Not a number (NaN) 64
Positive infinity 32
Negative infinity 16
Positive zero 8
Negative zero 4
Positive subnormal 2
Negative subnormal 1
For clarity of code, the following named constants are suggested.
Preferably, compilers will provide these constants in a header
file, but this is not required for compliance.
#define __VEC_CLASS_FP_NAN (1<<6)
#define __VEC_CLASS_FP_INFINITY_P (1<<5)
#define __VEC_CLASS_FP_INFINITY_N (1<<4)
#define __VEC_CLASS_FP_ZERO_P (1<<3)
#define __VEC_CLASS_FP_ZERO_N (1<<2)
#define __VEC_CLASS_FP_SUBNORMAL_P (1<<1)
#define __VEC_CLASS_FP_SUBNORMAL_N (1<<0)
#define __VEC_CLASS_FP_INFINITY (__VEC_CLASS_FP_INFINITY_P
| __VEC_CLASS_FP_INFINITY_N)
#define __VEC_CLASS_FP_ZERO (__VEC_CLASS_FP_ZERO_P | __VEC_CLASS_FP_ZERO_N)
#define __VEC_CLASS_FP_SUBNORMAL (__VEC_CLASS_FP_SUBNORMAL_P
| __VEC_CLASS_FP_SUBNORMAL_N)
#define __VEC_CLASS_FP_NOT_NORMAL (__VEC_CLASS_FP_NAN | __VEC_CLASS_FP_SUBNORMAL
| __VEC_CLASS_FP_ZERO | __VEC_CLASS_FP_INFINITY)
Endian considerations:
None.
xvtstdcspvec_test_data_classxvtstdcdpvec_test_data_class
Supported type signatures for vec_test_data_classrabExample ImplementationRestrictionsvector bool intvector float7-bit unsigned literal
xvtstdcsp r,a,b
ISA 3.0 or latervector bool long longvector double7-bit unsigned literal
xvtstdcdp r,a,b
ISA 3.0 or later
vec_truncVector Truncate
r = vec_trunc (a)
Purpose:
Returns a vector containing the truncated values of the corresponding
elements of the source vector.
Result value: Each element of
r contains the value of the
corresponding element of a, truncated
to an integral value.Endian considerations:
None.
xvrdpizvec_truncxvrspizvec_trunc
Supported type signatures for vec_truncraExample Implementationvector floatvector float
xvrspiz r,a
vector doublevector double
xvrdpiz r,a
vec_unpackhVector Unpack High
r = vec_unpackh (a)
Purpose:
Unpacks the most-significant (“high”) half of a vector into a vector
with larger elements.
Result value: If a is an integer vector, the value of each element
of r is the value of the corresponding
element of the most-significant half of a.If a is a floating-point vector,
the value of each element of r is the
value of the corresponding element of the most-significant half of
a, widened to the result
precision.If a is a pixel vector, the value
of each element of r is taken from the
corresponding element of the most-significant half of a as follows:All bits in the first byte of the element of r are set to the value of the first bit of
the element of a.The least-significant 5 bits of the second byte of the
element of r are set to the value
of the next 5 bits in the element of a.The least-significant 5 bits of the third byte of the
element of r are set to the value
of the next 5 bits in the element of a.The least-significant 5 bits of the fourth byte of the
element of r are set to the value
of the next 5 bits in the element of a.Endian considerations:
The "high" half of a vector with n elements is the
first n/2 elements of the vector. For little
endian, these elements are in the rightmost half of the vector. For
big endian, these elements are in the leftmost half of the vector.
vupklshvec_unpackhvupkhshvec_unpackhvupklpxvec_unpackhvupkhpxvec_unpackhvupklswvec_unpackhvupkhswvec_unpackhvupklsbvec_unpackhvupkhsbvec_unpackhxxsldwivec_unpackhxvcvspdpvec_unpackh
Supported type signatures for vec_unpackhraExample LE
ImplementationExample BE
Implementationvector bool shortvector bool char
vupklsb r,a
vupkhsb r,a
vector signed shortvector signed char
vupklsb r,a
vupkhsb r,a
vector bool intvector bool short
vupklsh r,a
vupkhsh r,a
vector signed intvector signed short
vupklsh r,a
vupkhsh r,a
vector unsigned intvector pixel
vupklpx r,a
vupkhpx r,a
vector bool long longvector bool int
vupklsw r,a
vupkhsw r,a
vector signed long longvector signed int
vupklsw r,a
vupkhsw r,a
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_unpacklVector Unpack Low
r = vec_unpackl (a)
Purpose:
Unpacks the least-significant (“low”) half of a vector into a vector
with larger elements.
Result value: If a is an integer vector, the value of each element
of r is the value of the corresponding
element of the least-significant half of a.If a is a floating-point vector,
the value of each element of r is the
value of the corresponding element of the least-significant half of
a, widened to the result
precision.If a is a pixel vector, the value
of each element of r is taken from the
corresponding element of the least-significant half of a as follows:All bits in the first byte of the element of r are set to the value of the first bit of
the element of a.The least-significant 5 bits of the second byte of the
element of r are set to the value
of the next 5 bits in the element of a.The least-significant 5 bits of the third byte of the
element of r are set to the value
of the next 5 bits in the element of a.The least-significant 5 bits of the fourth byte of the
element of r are set to the value
of the next 5 bits in the element of a.Endian considerations:
The "high" half of a vector with n elements is the
first n/2 elements of the vector. For little
endian, these elements are in the rightmost half of the vector. For
big endian, these elements are in the leftmost half of the vector.
vupkhshvec_unpacklvupklshvec_unpacklvupkhpxvec_unpacklvupklpxvec_unpacklvupkhswvec_unpacklvupklswvec_unpacklvupkhsbvec_unpacklvupklsbvec_unpacklxxsldwivec_unpacklxvcvspdpvec_unpackl
Supported type signatures for vec_unpacklrARG1Example LE
ImplementationExample BE
Implementationvector bool shortvector bool char
vupkhsb r,a
vupklsb r,a
vector signed shortvector signed char
vupkhsb r,a
vupklsb r,a
vector bool intvector bool short
vupkhsh r,a
vupklsh r,a
vector signed intvector signed short
vupkhsh r,a
vupklsh r,a
vector unsigned intvector pixel
vupkhpx r,a
vupklpx r,a
vector bool long longvector bool int
vupkhsw r,a
vupklsw r,a
vector signed long longvector signed int
vupkhsw r,a
vupklsw r,a
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_unsignedVector Convert Floating-Point to Unsigned Integer
r = vec_unsigned (a)
Purpose:
Converts a vector of floating-point numbers to a vector of unsigned
integers.
Result value: Each element of
r is obtained by truncating the
corresponding element of a to an
unsigned integer. The current floating-point rounding mode is
ignored.Endian considerations:
None.
xvcvspsxwsvec_unsignedxvcvdpsxdsvec_unsigned
Supported type signatures for vec_unsignedraExample Implementationvector unsigned intvector float
xvcvspsxws r,a
vector unsigned long longvector double
xvcvdpsxds r,a
vec_unsigned2Vector Convert Double-Precision to Unsigned Word
r = vec_unsigned2 (a, b)
Purpose:
Converts two vectors of double-precision floating-point numbers to a
vector of unsigned 32-bit integers.
Result value: Let v be the concatenation of a and b. Each
element of r is obtained by truncating
the corresponding element of v to an
unsigned 32-bit integer. The current floating-point rounding
mode is ignored.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_unsigned2xvcvdpuxwsvec_unsigned2vmrgowvec_unsigned2vmrgewvec_unsigned2
Supported type signatures for vec_unsigned2rabExample LE
ImplementationExample BE
Implementationvector unsigned intvector doublevector double
xxpermdi t,b,a,3
xxpermdi u,b,a,0
xvcvdpuxws v,t
xvcvdpuxws w,u
vmrgow r,w,v
xxpermdi t,a,b,3
xxpermdi u,a,b,0
xvcvdpuxws v,t
xvcvdpuxws w,u
vmrgew r,v,w
vec_unsignedeVector Convert Double-Precision to Unsigned Word
Even
r = vec_unsignede (a)
Purpose:
Converts elements of the source vector to unsigned integers and stores
them in the even-numbered elements of the result vector.
Result value: Element 0 of
r contains element 0 of a, truncated to an unsigned integer. Element 2 of
r contains element 1 of a, truncated to a signed integer. Elements 1 and
3 of r are undefined. Truncation
of a negative number to an unsigned integer results in a value of
zero.An example follows:
a1.0-1.0r00000001????????(undefined)00000000(truncation of a negative number to unsigned is 0)????????(undefined)Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xvcvdpuxwsvec_unsignedevsldoivec_unsignede
Supported type signatures for vec_unsignederaExample LE
ImplementationExample BE
Implementationvector unsigned intvector double
xvcvdpuxws t,a
vsldoi r,t,t,12
xvcvdpuxws r,a
vec_unsignedoVector Convert Double-Precision to Unsigned Word Odd
r = vec_unsignedo (a)
Purpose:
Converts elements of the source vector to unsigned integers and stores
them in the odd-numbered elements of the result vector.
Result value: Element 1 of
r contains element 0 of a, truncated to an unsigned integer. Element 3 of
r contains element 1 of a, truncated to an unsigned integer. Elements 0
and 2 of r are undefined. Truncation
of a negative number to an unsigned integer results in a value of
zero.An example follows:
a1.0-1.0r????????(undefined)00000001????????(undefined)00000000(truncation of a negative number to unsigned is 0)Endian considerations:
The element numbering within a register is left-to-right for big-endian
targets, and right-to-left for little-endian targets.
xvcvdpuxwsvec_unsignedovsldoivec_unsignedo
Supported type signatures for vec_unsignedoraExample LE
ImplementationExample BE
Implementationvector unsigned intvector double
xvcvdpuxws r,a
xvcvdpuxws t,a
vsldoi r,t,t,12
vec_xlVSX Unaligned Load
r = vec_xl (a, b)
Purpose:
Loads a 16-byte vector from the memory address specified by the
displacement and the pointer.
Result value: The value of
r is obtained by adding a and b, then
loading the 16-byte vector from the resultant memory address.Endian considerations:
For ISA 2.07, there is no bi-endian unaligned load instruction.
For little-endian targets, it is necessary to use the lxvd2x instruction
and swap the doublewords with an xxswapd instruction. For big-endian
targets, the lxvd2x instruction or lxvw4x instruction suffices. The
examples below assume ISA 3.0, where the bi-endian lxv instruction is
available.
Notes:
For languages that support built-in methods for pointer
dereferencing, such as the C/C++ * and [ ] operators, use
of the native operators is encouraged when the memory to
be accessed is aligned on a 32-bit boundary or aligned to
the type of b, whichever
is weaker.
GCC provides a commonly used synonym for vec_xl called
vec_vsx_ld. Although these have the same behavior, only
vec_xl is guaranteed to be portable across compliant
compilers. Therefore vec_xl is preferred.
lxvvec_xl
Supported type signatures for vec_xlrabExample ISA 3.0
Implementationvector signed charsigned long longsigned char *
lxv r,a(b)
vector unsigned charsigned long long unsigned char *
lxv r,a(b)
vector signed shortsigned long long signed short *
lxv r,a(b)
vector unsigned shortsigned long long unsigned short *
lxv r,a(b)
vector signed intsigned long long signed int *
lxv r,a(b)
vector unsigned intsigned long long unsigned int *
lxv r,a(b)
vector signed signed long longsigned long long signed long long *
lxv r,a(b)
vector unsigned long longsigned long long unsigned long long *
lxv r,a(b)
vector signed __int128signed long long signed __int128 *
lxv r,a(b)
vector unsigned __int128signed long long unsigned __int128 *
lxv r,a(b)
vector floatsigned long long float *
lxv r,a(b)
vector doublesigned long long double *
lxv r,a(b)
vec_xl_beVSX Unaligned Load as Big Endian
r = vec_xl_be (a, b)
Purpose:
Loads a vector from an address into a register in big-endian element
order, regardless of the endianness of the target machine.
Result value: The value of
r is obtained by adding a and b, then
loading the vector elements from the resulting address in big-endian
order.Endian considerations:
In big-endian mode, this acts just like the vec_xl intrinsic.
In little-endian mode, the highest-numbered element of r is loaded from the lowest data address, and
the lowest-numbered element of r from
the highest data address.
lxvb16xvec_xl_belxvvec_xl_belxvw4xvec_xl_belxvd2xvec_xl_belxvh8xvec_xl_be
Supported type signatures for vec_xl_berabExample ISA 3.0 LE
ImplementationExample ISA 3.0 BE
Implementationvector signed charsigned long longsigned char *
lxvb16x r,a,b
lxv r,a,b
vector unsigned charsigned long long unsigned char *
lxvb16x r,a,b
lxv r,a,b
vector signed shortsigned long long signed short *
lxvh8x r,a,b
lxv r,a,b
vector unsigned shortsigned long long unsigned short *
lxvh8x r,a,b
lxv r,a,b
vector signed intsigned long long signed int *
lxvw4x r,a,b
lxv r,a,b
vector unsigned intsigned long long unsigned int *
lxvw4x r,a,b
lxv r,a,b
vector signed long longsigned long long signed long long *
lxvd2x r,a,b
lxv r,a,b
vector unsigned long longsigned long long unsigned long long *
lxvd2x r,a,b
lxv r,a,b
vector signed __int128signed long long signed __int128 *
lxv r,a,b
lxv r,a,b
vector unsigned __int128signed long long unsigned __int128 *
lxv r,a,b
lxv r,a,b
vector floatsigned long long float *
lxvw4x r,a,b
lxv r,a,b
vector doublesigned long long double *
lxvd2x r,a,b
lxv r,a,b
vec_xl_lenVector Load with Length
r = vec_xl_len (a, b)
Purpose:
Loads a vector of a specified byte length.
Result value: Loads the number of
bytes specified by b from the address
specified in a. Initializes elements in
order from the byte stream (as defined by the endianness of the target).
Any bytes of elements that cannot be initialized from the
number of loaded bytes have a zero value.Between 0 and 16 bytes, inclusive, will be loaded. The length is
specified by the least-significant byte of b, as min (bmod 256, 16). The behavior
is undefined if the length argument is outside of
the range 0–255, or if it is not a multiple of the vector element
size.Endian considerations:
None.
Notes: vec_xl_len should
not be used to load from cache-inhibited memory.sldivec_xl_lenlxvlvec_xl_len
Supported type signatures for vec_xl_lenrabExample
ImplementationRestrictionsvector signed charsigned char * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector unsigned charunsigned char * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector signed shortsigned short * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector unsigned shortunsigned short * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector signed intsigned int * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector unsigned intunsigned int * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector signed long longsigned long long * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector unsigned long longunsigned long long * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector signed __int128signed __int128 * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector unsigned __int128unsigned __int128 * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector floatfloat * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or latervector doubledouble * size_t
sldi t,b,56
lxvl r,a,t
ISA 3.0 or later
vec_xl_len_rVector Load with Length Right-Justified
r = vec_xl_len_r (a, b)
Purpose:
Loads a vector of a specified byte length, right-justified.
Result value: Loads the number of
bytes specified by b from the address
specified in a, right justified in
r. Initializes elements in order from
the byte stream (as defined by the endianness of the target).
Any bytes of elements that cannot be initialized from the
number of loaded bytes have a zero value.Between 0 and 16 bytes, inclusive, will be loaded. The length
is specified by the least-significant byte of b, as min (bmod 256, 16). The
behavior is undefined if the length argument is outside of the range
0–255.Endian considerations:
None.
Notes: vec_xl_len_r should
not be used to load from cache-inhibited memory.sldivec_xl_len_rlvslvec_xl_len_rlxvllvec_xl_len_rvpermvec_xl_len_r
Supported type signatures for vec_xl_len_rrabExample
ImplementationRestrictionsvector unsigned charunsigned char * size_t
sldi t,b,56
lvsl u,0,b
lxvll v,a,t
vperm r,v,v,u
ISA 3.0 or later
vec_xorVector Exclusive OR
r = vec_xor (a, b)
Purpose:
Performs a bitwise XOR of two vectors.
Result value: v is the bitwise
exclusive OR of a and b.Endian considerations:
None.
xxlxorvec_xor
Supported type signatures for vec_xorrabExample Implementationvector bool charvector bool char vector bool char
xxlxor r,a,b
vector signed charvector signed char vector signed char
xxlxor r,a,b
vector unsigned charvector unsigned char vector unsigned char
xxlxor r,a,b
vector bool shortvector bool short vector bool short
xxlxor r,a,b
vector signed shortvector signed short vector signed short
xxlxor r,a,b
vector unsigned shortvector unsigned short vector unsigned short
xxlxor r,a,b
vector bool intvector bool int vector bool int
xxlxor r,a,b
vector signed intvector signed int vector signed int
xxlxor r,a,b
vector unsigned intvector unsigned int vector unsigned int
xxlxor r,a,b
vector bool long longvector bool long long vector bool long long
xxlxor r,a,b
vector signed long longvector signed long long vector signed long long
xxlxor r,a,b
vector unsigned long longvector unsigned long long vector unsigned long long
xxlxor r,a,b
vector floatvector float vector float
xxlxor r,a,b
vector doublevector double vector double
xxlxor r,a,b
vec_xstVSX Unaligned Store
vec_xst (a, b, c)
Purpose:
Stores a 16-byte value into memory at the address specified by the
displacement and pointer.
Operation: The values of
b and c are added, and the value of a is stored to the resultant address.Endian considerations:
For ISA 2.07, there is no bi-endian unaligned store instruction. For
little-endian targets, it is necessary to first swap the doublewords
of the value to be stored using an xxswapd instruction, and then store
the result using the stxvd2x instruction. For big-endian targets, the
stxvd2x or stxvw4x instruction suffices. The examples below assume ISA
3.0, where the bi-endian stxv instruction is available.
Notes:
For languages that support built-in methods for pointer
dereferencing, such as the C/C++ * and [ ] operators, use
of the native operators is encouraged when the memory to
be accessed is aligned on a 32-bit boundary or aligned to
the type of b, whichever
is weaker.
GCC provides a commonly used synonym for vec_xst called
vec_vsx_st. Although these have the same behavior, only
vec_xst is guaranteed to be portable across compliant
compilers. Therefore vec_xst is preferred.
stxvvec_xst
Supported type signatures for vec_xstabcExample ISA 3.0
Implementationvector signed char signed long long signed char *
stxv a,b(c)
vector unsigned char signed long long unsigned char *
stxv a,b(c)
vector signed short signed long long signed short *
stxv a,b(c)
vector unsigned short signed long long unsigned short *
stxv a,b(c)
vector signed int signed long long signed int *
stxv a,b(c)
vector unsigned int signed long long unsigned int *
stxv a,b(c)
vector signed long long signed long long signed long long *
stxv a,b(c)
vector unsigned long long signed long long unsigned long long *
stxv a,b(c)
vector signed __int128 signed long long signed __int128 *
stxv a,b(c)
vector unsigned __int128 signed long long unsigned __int128 *
stxv a,b(c)
vector float signed long long float *
stxv a,b(c)
vector double signed long long double *
stxv a,b(c)
vec_xst_beVSX Unaligned Store as Big Endian
vec_xst_be (a, b, c)
Purpose:
Stores a vector to an address using big-endian
element order, regardless of the endianness of the target machine.
Result value: The values of
b and c are added, and the value of a is stored to the resultant address using
big-endian element order.Endian considerations:
In big-endian mode, this acts just like the vec_xst intrinsic. In
little-endian mode, the lowest data address receives the
highest-numbered element of a, and
the highest data address receives the lowest-numbered element of
a.
stxvb16xvec_xst_bestxvvec_xst_bestxvw4xvec_xst_bestxvd2xvec_xst_bestxvh8xvec_xst_be
Supported type signatures for vec_xst_beabcExample ISA 3.0 LE
ImplementationExample ISA 3.0 BE
Implementationvector signed char signed long long signed char *
stxvb16x a,b,c
stxv a,b,c
vector unsigned char signed long long unsigned char *
stxvb16x a,b,c
stxv a,b,c
vector signed short signed long long signed short *
stxvh8x a,b,c
stxv a,b,c
vector unsigned short signed long long unsigned short *
stxvh8x a,b,c
stxv a,b,c
vector signed int signed long long signed int *
stxvw4x a,b,c
stxv a,b,c
vector unsigned int signed long long unsigned int *
stxvw4x a,b,c
stxv a,b,c
vector signed long long signed long long signed long long *
stxvd2x a,b,c
stxv a,b,c
vector unsigned long long signed long long unsigned long long *
stxvd2x a,b,c
stxv a,b,c
vector signed __int128 signed long long signed __int128 *
stxv a,b,c
stxv a,b,c
vector unsigned __int128 signed long long unsigned __int128 *
stxv a,b,c
stxv a,b,c
vector float signed long long float *
stxvw4x a,b,c
stxv a,b,c
vector double signed long long double *
stxvd2x a,b,c
stxv a,b,c
vec_xst_lenVector Store with Length
vec_xst_len (a, b, c)
Purpose:
Stores a vector of a specified byte length.
Operation: Stores the number of
bytes specified by c of the vector
a to the address specified in
b. The bytes are obtained starting from
the lowest-numbered byte of the lowest-numbered element (as defined by
the endianness of the target). All bytes of an element
are accessed before proceeding to the next higher element.Between 0 and 16 bytes, inclusive, will be stored. The length
is specified by the least-significant byte of c, as min (cmod 256, 16). The behavior
is undefined if the length argument is outside of the range 0–255,
or if it is not a multiple of the vector element size.Endian considerations:
None.
Notes: vec_xst_len should
not be used to store to cache-inhibited memory.sldivec_xst_lenstxvlvec_xst_len
Supported type signatures for vec_xst_lenabcExample ImplementationRestrictionsvector signed char signed char * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector unsigned char unsigned char * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector signed short signed short * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector unsigned short unsigned short * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector signed int signed int * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector unsigned int unsigned int * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector signed long long signed long long * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector unsigned long long unsigned long long * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector signed __int128 signed __int128 * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector unsigned __int128 unsigned __int128 * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector float float * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or latervector double double * size_t
sldi t,c,56
stxvl a,b,t
ISA 3.0 or later
vec_xst_len_rVector Store with Length Right-Justified
vec_xst_len_r (a, b, c)
Purpose:
Stores a right-justified vector of a specified byte length.
Operation: Stores the number of
bytes specified by c of the
right-justified vector a to the address
specified by b.Between 0 and 16 bytes, inclusive, will be stored. The length is
specified by the least-significant byte of c, as min (bmod 256, 16). The
behavior is undefined if the length argument is outside of the range
0–255.Endian considerations:
None.
Notes: vec_xst_len_r should
not be used to store to cache-inhibited memory.lvsrvec_xst_len_rsldivec_xst_len_rvpermvec_xst_len_rstxvllvec_xst_len_r
Supported type signatures for vec_xst_len_rabcExample ImplementationRestrictionsvector unsigned char unsigned char * size_t
lvsr t,0,c
sldi u,c,56
vperm v,a,a,t
stxvll v,b,u
ISA 3.0 or later