https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98236
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Note f4 right now produces the best code even though it is not add/setN. leal (%rdi,%rsi), %eax shrl $31, %eax is better overall because it does not touch the flags register and all especially if there is other code around it. For f2, the biggest thing here is a cost model around doing the expansion as not/shift or cmp/set. f5, f6 and f7 are now caught in GCC 11+.