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

            Bug ID: 114212
           Summary: `MIN<uns, CST> / CST` -> `uns >= CST`
           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:
```
unsigned f(unsigned a)
{
        a = a >= 64 ? 64 : a;
        return a/64; // a >= 64
}
```

This can be simplified to just `a >= 64` as if `a >= 64`, then `MIN<a,64>`
would be 64 and `64/64` is 1. Note this is actually true for all non-negative a
rather than just unsigned types.

For FP types, this can't be done as we won't just get 0,1 for the division but
the range [0.,1.].

Reply via email to