vec_perm

Purpose

Returns a vector that contains some elements of two vectors, in the order specified by a third vector.

Syntax

d=vec_perm(a, b, c)

Result and argument types

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

d a b c
vector4double vector4double vector4double vector4double

Result value

The value of each element of the result is the element of the concatenation of a and b that is specified by bits 0:2 of the mantissa of the corresponding element of c.

Each element of c must have an exponent equal to 0x400, or the corresponding element of the result is undefined.

Note: The following functions generate control values that can be used for c:

Formula

Concat = ( a[0], a[1], a[2], a[3],
           b[0], b[1], b[2], b[3] )
d[0] = Concat[Mantissa02(c[0])]
d[1] = Concat[Mantissa02(c[1])]
d[2] = Concat[Mantissa02(c[2])]
d[3] = Concat[Mantissa02(c[3])]
Note:
  • Mantissa02 is a function that returns the integer that is equivalent to the bits 0:2 of the mantissa of its argument.

Example

If a = (10.0, 20.0, 30.0, 40.0), b = (50.0, 60.0, 70.0, 80.0), and the mantissas of the elements of c = (2,3,4,5), the result value is (30.0, 40.0, 50.0, 60.0).