Unless I completely misunderstood, isn't that an horizontal add, ie. HADDPD[1]?
edit:
apparently GCC doesn't specifically optimize reductions [2] and does a generic vectorization instead.
edit:
apparently GCC doesn't specifically optimize reductions [2] and does a generic vectorization instead.
vhaddpd %xmm0, %xmm0, %xmm0
$ gcc --version | head -1
gcc (Debian 8.3.0-6) 8.3.0
$ cat x.c
#include <x86intrin.h>
double f(__m128d v){return v[1]+v[0];}
$ gcc -Ofast -march=haswell -S x.c
$ grep -C1 hadd x.s
.cfi_startproc
vhaddpd %xmm0, %xmm0, %xmm0
ret
GCC 4.8.5 with adjusted options does the same, and 7.5, so perhaps there was some regression in early 8.(-ffast-math is redundant with -Ofast.)