[Bug tree-optimization/105777] New: Failure to optimize __builtin_mul_overflow with constant operand to add+cmp check
gabravier at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon May 30 20:37:11 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105777
Bug ID: 105777
Summary: Failure to optimize __builtin_mul_overflow with
constant operand to add+cmp check
Product: gcc
Version: 13.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: ---
int f17(unsigned x)
{
int z;
return __builtin_mul_overflow((int)x, 35, &z);
}
This can be optimized to `return (x + 0xFC57C57C) < 0xF8AF8AF9;` (and I'd
assume the same pattern with other constants than 35 should be optimizable in
the same way). LLVM does this transformation, but GCC does not.
More information about the Gcc-bugs
mailing list