[Bug tree-optimization/111679] New: `(~a) | (a ^ b)` is not simplified to `~(a & b)`
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Oct 3 16:11:40 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111679
Bug ID: 111679
Summary: `(~a) | (a ^ b)` is not simplified to `~(a & b)`
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
int f(int a, int b)
{
return a | ((~a) ^ b);
}
int f1(int a, int b)
{
return (~a) | (a ^ b); // ~(a & b) or (~a) | (~b)
}
```
The only difference between these 2 functions is a is bitwise inversed. f is
able to be detected and simplified but not f1.
I Noticed this while working on PR 111282.
More information about the Gcc-bugs
mailing list