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

            Bug ID: 112385
           Summary: `(2 >> a) ^ (5 >> a)` is not optimized to `7 >> a` is
                    2 and 5 differ in signedness
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pinskia at gcc dot gnu.org
  Target Milestone: ---

Take:
```
int f(int a)
{
  return (2 >> a) ^ (5u >> a);
}

```
This should be optimized to:
```
return (7 >> a);
```

But currently does not.

Reply via email to