https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46284
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Known to work| |10.1.0, 11.3.0, 12.1.0, | |13.1.0 Target Milestone|--- |10.0 Status|UNCONFIRMED |RESOLVED See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=28367, | |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=83518 Resolution|--- |FIXED --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Fully fixed in GCC 10 (by r10-1692-g38988cbf9ebaa9): main: subq $8, %rsp movl $.LC1, %edi movl $4, %eax movsd .LC0(%rip), %xmm0 movapd %xmm0, %xmm3 movapd %xmm0, %xmm2 movapd %xmm0, %xmm1 call printf Just loading the constants to call printf. In GCC 7-9 (improved most likely by PR 28367), GCC produces: movl $.LC0, %edi movl $4, %eax movdqa .LC2(%rip), %xmm1 movdqa .LC1(%rip), %xmm0 addps %xmm1, %xmm0 movaps %xmm0, %xmm3 movaps %xmm0, %xmm2 movaps %xmm0, %xmm1 shufps $255, %xmm0, %xmm3 unpckhps %xmm0, %xmm2 shufps $85, %xmm0, %xmm1 cvtss2sd %xmm0, %xmm0 cvtss2sd %xmm3, %xmm3 cvtss2sd %xmm2, %xmm2 cvtss2sd %xmm1, %xmm1 call printf Which is not bad and much better than before in GCC 6 (comment #0's code is listed there).