This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fwd: SSE2 instructions with GCC compiler on windows


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]