https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114761
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|tree-optimization |middle-end --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I am not so sure which one is better really. So what I think clang is doing is this, turn if the statements into a switch and then expanding the switch into a bunch of if statements and have the highest probability one first. This is a decent way to "rotate" the if statements. But I don't think it will help this case though because GCC still likes to combine them into one without a branch (which might be better overall). I noticed that clang does not do any combining and producing ccmp for aarch64 (even if you remove all of the [[unlikely]]/[[likely]]). So it produces worse code there. a branch for the combined unlikely case might be worse. Also gcc tends to ignore the probilitity when it comes to combining because combining almost improves code ...