3 ms·
Just per #54400 above. $ 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
by gnufx 6y ago
Just per #54400 above.
$ 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.)
- tom_mellior 6y agoThanks. There probably wasn't a regression, it's just that this is not the code I was asking about. Your code works for the special case of horizontally adding two elements, but not for the more general case (4 elements) that this whole thread was about.