[Bug tree-optimization/105983] Failure to optimize (b != 0) && (a >= b) as well as the same pattern with binary and

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 14 21:41:48 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105983

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
aarch64 GCC is able to compile it to:
f(unsigned int, unsigned int):
        cmp     w1, 0
        ccmp    w1, w0, 2, ne
        cset    w0, ls
        ret

While aarch64 LLVM does:
        sub     w8, w1, #1
        cmp     w8, w0
        cset    w0, lo
        ret

depending on the pipeline, they might be the same or the ccmp might be better
slightly.


More information about the Gcc-bugs mailing list