11 ms·
Do you have an input program and an exact command line to experiment with? Using my function from above with -Ofast -ffast-math -march=haswell does not produce
by tom_mellior 6y ago
Do you have an input program and an exact command line to experiment with? Using my function from above with -Ofast -ffast-math -march=haswell does not produce this on the GCC 8.1 on Compiler Explorer.
- gnufx 6y agoJust 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.