https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109011

--- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Testcase for the normal SI -> SI stuff might be something like
with e.g.
-O3 -mavx512{bw,cd,vl,dq,bitalg,vpopcntdq} -mbmi -mlzcnt
options or so (the intent of the last 2 is to make clz/ctz defined at zero in
GIMPLE).
Plus similar testcase with long long * instead of int * and ll suffixed
builtins.
And also with unsigned char * and unsigned short * too eventually.

void
foo (int *p, int *q)
{
  for (int i = 0; i < 2048; ++i)
    p[i] = __builtin_popcount (q[i]);
}

void
bar (int *p, int *q)
{
  for (int i = 0; i < 2048; ++i)
    p[i] = __builtin_clz (q[i]);
}

void
baz (int *p, int *q)
{
  for (int i = 0; i < 2048; ++i)
    p[i] = __builtin_ffs (q[i]);
}

void
qux (int *p, int *q)
{
  for (int i = 0; i < 2048; ++i)
    p[i] = __builtin_ctz (q[i]);
}

void
corge (int *p, int *q)
{
  for (int i = 0; i < 2048; ++i)
    p[i] = q[i] ? __builtin_clz (q[i]) : 32;
}

void
grault (int *p, int *q)
{
  for (int i = 0; i < 2048; ++i)
    p[i] = q[i] ? __builtin_ctz (q[i]) : 32;
}

Reply via email to