LDC 0.11.0 Beta 3
bearophile
bearophileHUGS at lycos.com
Sat Jun 22 08:28:09 PDT 2013
> But gcc compiles similar code (that uses __m128d instead of
> double2) using the instruction "haddpd", that I think is
> shorter/more efficient here.
C code:
#include <emmintrin.h>
double foo(const __m128d x) {
return x[0] + x[1];
}
int main() {
__m128d x = _mm_set_pd(1.0, 2.0);
return (int)foo(x);
}
Compiled with:
gcc -S -Ofast -fomit-frame-pointer -march=native -mfpmath=sse
-msse2 test.c -o test.s
GCC version 4.8.0
The asm of "foo":
_foo:
subl $20, %esp
haddpd %xmm0, %xmm0
movsd %xmm0, (%esp)
fldl (%esp)
addl $20, %esp
ret
Bye,
bearophile
More information about the digitalmars-d-ldc
mailing list