https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94718
Bug ID: 94718
Summary: Failure to optimize opposite signs check
Product: gcc
Version: 10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: gabravier at gmail dot com
Target Milestone: ---
bool f(int x, int y)
{
return (x < 0) != (y < 0);
}
`(x < 0) != (y < 0)` can be optimized to `(x ^ y) < 0`.
This transformation is done by clang, but not by GCC, as seen here :
https://godbolt.org/z/AnYPBF.