https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116896
--- Comment #19 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 59273 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=59273&action=edit gcc15-pr116896-inc2.patch I've tried to improve the signed int <=> case (the only one which doesn't use sbb and so needs two xors first), but unfortunately that doesn't seem to work at all, the IL is how I'd like to see it at the end, but then combine happily turns those *setcc_qi_slp back into *setcc_si_1_movzbl and removes the clear instructions. So, I think all we can do is some extra peephole2 to deal with it (though in the jp case it will have to use to movl $0, %reg). Thus, the important question is, do we want to perform the subtraction generally in SImode (i.e. the original patch without incremental ones plus some peephole2s) or QImode? While auto x = y <=> z; return x; will return QImode, one can always also turn it into int/long through int ret; if (x < 0) ret = -1; else if (x > 0) ret = 1; else ret = 0; or similar and then there would be sbbb or subb followed by movsbl.