Fwd: SSE2 instructions with GCC compiler on windows

Ian Lance Taylor iant@google.com
Fri May 1 16:33:00 GMT 2009


Balakumar R <balakumar85@gmail.com> writes:

> Looks like the code works fine. But the error below comes up when i try to
> access the variable and printing it out.
>
> #include <emmintrin.h>
> double pv1[2];
> double pv2[2];
> void fn() {
>    __m128d a = {pv1[0],pv1[1]};
>    __m128d b = {pv2[0],pv2[1]};
>    __m128d sum1;
>
>    sum1 = _mm_add_pd(a, b);
>
>    double sum[2] = {sum1.m128d_f64[0],sum1.m128d_f64[1]};
>
> }
>
> and the error i get is:
>
> error: request for member 'm128d_f64' in 'sum1', which is of non-class type
> 'double __vector__'
>
> Any inputs on this please.

I don't know where you're getting that from, but you can't access the
elements that way.  To access the elements use something like the Intel
documented _mm_store_pd, _mm_storeu_pd, etc.  For that matter, you
shouldn't initialize the values that way, you should use _mm_set_pd.

Ian



More information about the Gcc-help mailing list