This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/82858] __builtin_add_overflow() generates suboptimal code with unsigned types on x86


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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]