vec_gpci

Purpose

Returns a vector containing the results of dispersing the 12-bit literal a to be used as control value for a permute instruction.

Note: In this information, constants beginning with 0 are interpreted as octal constants.

Syntax

d=vec_gpci(a)

Result and argument types

The following table describes the types of the returned value and the function arguments.

d a
vector4double int, a value in 00 - 07777
Restriction: You cannot use an integer variable for a.

Result value

The value of each element of the result has a sign bit set to 0, an exponent set to 02000, and a mantissa where bits 0:2 are taken from the 12-bit literal a as shown in the formula.

Formula

d[0] = (double) {sign = 0, mantissa0:2 = a0:2, exponent = 02000}
d[1] = (double) {sign = 0, mantissa0:2 = a3:5, exponent = 02000}
d[2] = (double) {sign = 0, mantissa0:2 = a6:8, exponent = 02000}
d[3] = (double) {sign = 0, mantissa0:2 = a9:11, exponent = 02000}

Example

Shifting the elements of a given vector to the left by one step and rotate around requires the pattern 1–2–3–0. It can be obtained by the following code:

pattern = vec_gpci(01230);
v = vec_perm(v,v,pattern);

With the pattern 1–2–3–0, the vector
(0.0, 1.0, 2.0, 3.0)
becomes
(1.0, 2.0, 3.0, 0.0).