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

            Bug ID: 116508
           Summary: [15 Regression] `popcount(short) == 1` or char no
                    longer expands to using `(arg ^ (arg - 1)) > arg - 1`
                    trick after r15-2946-gfcc3af99498804
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: pinskia at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---
            Target: aarch64

Take:
```
int fs(unsigned short a)
{
  return __builtin_popcountg(a) == 1;
}
int fc(unsigned char a)
{
  return __builtin_popcountg(a) == 1;
}
```

The `(arg ^ (arg - 1)) > arg - 1` trick is no longer even tried for these 2
functions.

Note a related testcase:
```
int fc(unsigned char a)
{
  return __builtin_popcountg(a) == 1;
}
```

But the above is NOT a regression though.

Reply via email to