[Bug tree-optimization/107052] New: Range of __builtin_popcount can be improved with nonzerobits
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 27 15:18:28 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107052
Bug ID: 107052
Summary: Range of __builtin_popcount can be improved with
nonzerobits
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
void link_failure();
void f(int a)
{
a &= 0x300;
int b = __builtin_popcount(a);
if (b > 3)
link_failure();
}
```
The if statement should be optimized away as the only values for popcount here
is 0-3.
More information about the Gcc-bugs
mailing list