https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127542
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> ---
It seems as if
v_bcnt_u32_b32 v4, v4
should be
v_bcnt_u32_b32 v4, v4, 0
as the instruction seems to count the true bits - and adds a number to it, e.g.
0 in this example.
In any case, the instruction manual (here CDNA 3) states:
> V_BCNT_U32_B32 651
>
> Count the number of "1" bits in the vector input and store
> the result into a vector register.
>
> tmp = S1.u32;
> for i in 0 : 31 do
> tmp += S0[i].u32;
> // count i'th bit
> endfor;
> D0.u32 = tmp