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

            Bug ID: 127149
           Summary: Wrong code with vectorisation of popcount of bitint
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ktkachov at gcc dot gnu.org
                CC: jakub at redhat dot com
  Target Milestone: ---
            Target: aarch64

typedef unsigned _BitInt(7) u7;

__attribute__ ((noipa)) void
popcounts (u7 *y, const u7 *x)
{
  for (unsigned int i = 0; i < 16; ++i)
    y[i] = __builtin_popcountg (x[i]);
}

int
main (void)
{
  u7 x[16], y[16];
  __builtin_memset (x, 0x80, sizeof (x));
  popcounts (y, x);
  if (y[0] != 0)
    __builtin_abort ();
  return 0;
}

This aborts on aarch64 at -O3 and passes at -O2

Reply via email to