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

            Bug ID: 114670
           Summary: `(a ^ 1) <= 3` can be optimized to `a <= 3`
           Product: gcc
           Version: 14.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: ---

While looking into PR 114666, I noticed this:
```
int f(unsigned a)
{
  return (a^1) <= 3;
}

int fa(unsigned a)
{
  return (a) <= 3;
}
```

These 2 are the same functions should produce the same code.

Basically if we have `(a ^ CST1) <= MASK` where MASK is a (lower) mask which
contain the bits of CST1.

Reply via email to