vec_bperm
Purpose
Gathers up to 16 1-bit values from a quadword or from each doubleword element in the specified order, and places them in the specified order either in the rightmost 16 bits of the leftmost doubleword of the result vector register or in the rightmost 8 bits of each doubleword of the result vector register according to the element types, with the rest of the result set to 0.
Syntax
d=vec_bperm(a, b)
Result and argument types
The following table describes the types of the result and the function arguments.
| d | a | b |
|---|---|---|
| vector unsigned char | vector unsigned char1 | vector unsigned char1 |
| vector unsigned long long | vector unsigned long long2 | vector unsigned char2 |
Note:
- This combination of data types of the arguments of the built-in function is valid only when -mcpu is set to target POWER8 or higher processors.
- This combination of data types of the arguments of the built-in function is valid only when -mcpu is set to target POWER9 or higher processors.
Result value
- When the data type of
ais vector unsigned char, which is valid only when -mcpu is set to target POWER8 or higher processors:Suppose i(0<=i<16) and j. Let i denote the element index ofb, and let j denote the byte value of element i ofb:- If j>=128, bit 48+i of doubleword 0 is set to 0.
- If j<128, bit 48+i of the result is set to the value of
bit j of
a. - All other bits are set to 0.
- When the data type of
ais vector unsigned long long, which is valid only when -mcpu is set to target POWER9 or higher processors:Suppose i(0<=i<2), j(0<=j<8) and k. Let i denote the doubleword element index ofa; let j denote the element index ofb; and let k denote the byte value of element j ofb:- If k>=64, bit 56+j of element i is set to 0.
- If k<64, bit 56+j of element i is
set to the value of bit k of element i of
a. - All other bits are set to 0.