[Bug tree-optimization/95410] New: Failure to optimize compare next to and properly
gabravier at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri May 29 10:53:44 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95410
Bug ID: 95410
Summary: Failure to optimize compare next to and properly
Product: gcc
Version: 11.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)
{
if ((unsigned)x >= y)
return false;
return (x & 1) == 0;
}
This can be optimized to `return ((unsigned)x < y) & !(x & 1);` (and further to
`return ~x & ((unsigned)x < y);`). This transformation is done by LLVM, but not
by GCC.
More information about the Gcc-bugs
mailing list