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

            Bug ID: 119420
           Summary: `a >> 1 == 0` should be trasformed into `((unsigned)a)
                    <= 1`
           Product: gcc
           Version: 14.1.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 ll(signed a)
{
  int d = a >>1;
  return d == 0;
}

int ll1(signed a)
{
  int d = a & ~1;
  return d == 0;
}
int ll2(signed a)
{
  unsigned aa = a;
  return aa <= 1;
}
```

All of these are the same and should be optimized to the same.

Reply via email to