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.

Reply via email to