For vector processing, IBM XL C/C++ for Linux V13.1 supports a new POWER8 builtin function vec_bperm. The vec_bperm can gather up to 16bit values from a quadword in the specified order and it operates on vectors as 128bit unsigned integers. The vec_bperm function is valid only when the qarch option is set to target POWER8™ processors.
Syntax
The function has the following syntax, where d represents the function returned value; a and b represent the arguments.
d=vec_bperm(a, b)
Result and argument types
The following table describes the types of the returned value and the function arguments.
d

a

b

vector unsigned char

vector unsigned char

vector unsigned char

Result value
The following table describes the function result. For each i (0 <= i < 16), let index denote the byte value of the i^{th }element of the argument b.
Value of index

Function result

index >= 128

bit 48+i of the result is set to 0.

index < 128

bit 48+i of the result is set to the value of the index^{th }bit of the input a.

Tags:
function
builtin
power8
c/c++