[Bug target/82858] __builtin_add_overflow() generates suboptimal code with unsigned types on x86
glisse at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Nov 6 12:33:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82858
--- Comment #4 from Marc Glisse <glisse at gcc dot gnu.org> ---
unsigned c;
unsigned d = __builtin_add_overflow(a, b, &c)?-1:0;
return c|d;
gives the expected asm. Ideally phiopt would recognize a saturing add pattern,
but we have nothing to model it in gimple. We could turn it into the branchless
BIT_IOR form though.
(the problem isn't with __builtin_add_overflow but with what comes afterwards)
More information about the Gcc-bugs
mailing list