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.

This built-in function is valid only when you include the altivec.h file.

Syntax

d=vec_bperm(a, b)

Result and argument types

The following table describes the types of the result and the function arguments.

Table 1. Types of the returned value and function arguemnts
d a b
vector unsigned char vector unsigned char1 vector unsigned char1
vector unsigned long long vector unsigned long long2 vector unsigned char2
Note:
  1. This combination of data types of the arguments of the built-in function is valid only when -qarch(-mcpu) is set to utilize POWER8® or POWER9™ technologies.
  2. This combination of data types of the arguments of the built-in function is valid only when -qarch(-mcpu) is set to utilize POWER9 technology.

Result value

  • When the data type of a is vector unsigned char, which is valid only when -qarch is set to target POWER8 or POWER9:
    Suppose i(0<=i<16) and j. Let i denote the element index of b, and let j denote the byte value of element i of b:
    • 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 a is vector unsigned long long, which is valid only when -qarch is set to target POWER9:
    Suppose i(0<=i<2), j(0<=j<8) and k. Let i denote the doubleword element index of a; let j denote the element index of b; and let k denote the byte value of element j of b:
    • 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.


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us