vec_popcnt

Purpose

Computes the population count (number of set bits) in each element of the input.

Note: This built-in function is valid when the -mcpu option is set to target POWER8 processors, or higher.

Syntax

d=vec_popcnt(a)

Result and argument types

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

Table 1. Result and argument types
d a
vector unsigned char vector signed char
vector unsigned char
vector unsigned short vector signed short
vector unsigned short
vector unsigned int vector signed int
vector unsigned int
vector unsigned long long vector signed long long
vector unsigned long long

Result value

Each element of the result is set to the number of set bits in the corresponding element of the input.