IBM XL C/C++ for AIX, V13.1 supports a vector population count procedure vec_popcnt. This built-in function computes the population count (number of set bits) in each element of their input. This function is valid only when the -qarch option is set to target POWER8™ processors.

The syntax of this function is:

`d=vec_popcnt(a)`

where d represents the types of the returned value and a in parentheses represents the type of the function argument. For details about d and a, see the following table.

d |
a |

vector unsigned char |
vector signed char |

vector unsigned char |
vector unsigned char |

vector unsigned short |
vector signed short |

vector unsigned short |
vector unsigned short |

vector unsigned int |
vector signed int |

vector unsigned int |
vector unsigned int |

vector unsigned long long |
vector signed long long |

vector unsigned 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.

Tags:
c/c++
built-in
vector