https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51954
--- Comment #4 from Hongtao.liu <crazylht at gmail dot com> --- (In reply to Andrew Pinski from comment #2) > We get this now: > > movq %rdi, %rax > movq %rsi, %rdx > negq %rax > adcq $0, %rdx > negq %rdx > > ICC produces: > xorl %edx, %edx #3.10 > xorl %eax, %eax #3.10 > subq %rdi, %rax #3.10 > sbbq %rsi, %rdx #3.10 > ret #3.10 > > Which seems even better. > > LLVM does produce: > movq %rdi, %rax > xorl %edx, %edx > negq %rax > sbbq %rsi, %rdx > > Which basically combines the addcq and negq together and changes one mov > into an exor. Yes, neg rdx = (0 - rdx) = (0 - (rdx + CF)(last def)) = (sbb 0, rdx)