https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126295
Bug ID: 126295
Summary: !(i >= j) && (i < j) for fp should optimize to `i < j`
even with trapping
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P3
Component: tree-optimization
Assignee: pinskia at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
bool f(double i, double j)
{
return !(i >= j) && (i < j);
}
```
This should just optimize to `return i < j;` with trapping math enabled.
But currently it does not because there is no inverting of `>=` for trapping.
Note `(i < j) && !(i >= j)` is optimized but only due to frange/vrp/dom.
Optimizing this requires some changes in combine_comparisons.