[Bug target/51954] __int128_t (and long long on x86) negation can be optimized
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sun Dec 26 22:34:17 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51954
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
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.
More information about the Gcc-bugs
mailing list