[Bug target/105338] [12 Regression] Regression: jump or cmove generated for pattern (x ? CST : 0)

denis.campredon at gmail dot com gcc-bugzilla@gcc.gnu.org
Tue Apr 26 05:05:39 GMT 2022


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

--- Comment #13 from denis.campredon at gmail dot com ---
Thanks a lots.

I have a question though: foo and bar are similar, foo produces a branchless
code whereas bar uses a jump.

int foo(int i) {
    return !i ? 0 : -2;
}

int bar(int i) {
    return i ? -2 : 0;
}

If I'm readding correctly in the two functions the probabilities are the same.
Is this "normal" or worth a new ticket ?


More information about the Gcc-bugs mailing list