Returns a vector useful for aligning non-aligned data.
d=vec_lvsl(a, b)
The following table describes the types of the returned value and the function arguments.
d | a | b |
---|---|---|
vector4double | long | double* |
_Complex double* | ||
float* | ||
_Complex float* |
The result value is a quad vector. The elements of the quad vector are generated in the following ways:
The mantissa is seen as a 3-bit value for the increment operation. That is, incrementing 0b111 produces 0b000.
You can use the result as an argument of the vec_perm function.
The following formula is applicable if b is a pointer to a double-precision floating-point value or complex value:
EA = a + b
AA = EA AND 0b11000
Offset = AA58:60
d[0] = (double) {sign = 0, mantissa = Offset , exponent = 0x400}
d[1] = (double) {sign = 0, mantissa = (Offset+1) AND 0b111, exponent = 0x400}
d[2] = (double) {sign = 0, mantissa = (Offset+2) AND 0b111, exponent = 0x400}
d[3] = (double) {sign = 0, mantissa = (Offset+3) AND 0b111, exponent = 0x400}
The following formula is applicable if b is a pointer to a single-precision floating-point value or complex value:
EA = a + b
AA = (EA × 2) AND 0b11000
Offset = AA58:60
d[0] = (double) {sign = 0, mantissa = Offset , exponent = 0x400}
d[1] = (double) {sign = 0, mantissa = (Offset+1) AND 0b111, exponent = 0x400}
d[2] = (double) {sign = 0, mantissa = (Offset+2) AND 0b111, exponent = 0x400}
d[3] = (double) {sign = 0, mantissa = (Offset+3) AND 0b111, exponent = 0x400}
// my_array is an array of the double type
vector4double v, v1, v2, vp;
v1 = vec_ld(0,my_array) // Load the left part of the vector
v2 = vec_ld(32,my_array) // Load the right part of the vector
vp = vec_lvsl(0,my_array) // Generate control value
v = vec_perm(v1,v2,vp) // Generate the aligned vector
// my_array is an array of the float type
vector4double v, v1, v2, vp;
v1 = vec_ld(0,my_array) // Load the left part of the vector
v2 = vec_ld(16,my_array) // Load the right part of the vector
vp = vec_lvsl(0,my_array) // Generate control value
v = vec_perm(v1,v2,vp) // Generate the aligned vector