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

            Bug ID: 125641
           Summary: `a>>signbit | a` is just `max<a, -1>`
           Product: gcc
           Version: 16.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 x)
{
    int k = -1;
    return x < k ? k : x;
}

int f2(int x)
{
    int y = x >> 31;
    return y | x;
}

```

This 2 functions are the same and should be optimized to the same code.

Note x86_64 backend (nor aarch64 but that is PR 125640) does NOT use the trick
of shift followed by or for this max right now.

Reply via email to