https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126296
Bug ID: 126296
Summary: `(i <=> j > 0) | (i <=> j < 0)` 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: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Depends on: 126138
Target Milestone: ---
Take:
```
#include <compare>
bool f(double i, double j)
{
auto t = i<=>j;
return (t < 0) | (t > 0);
}
```
This should/can be optimize to use LTGT_EXPR even with trapping.
I have a patch set already.
This gets optimized in phiopt4 with the patch set.
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126138
[Bug 126138] `fp0 == fp1 || fp0 CMP fp1` can be combined always even with
trapping