This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Fwd: SSE2 instructions with GCC compiler on windows
- From: Ian Lance Taylor <iant at google dot com>
- To: Balakumar R <balakumar85 at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Fri, 01 May 2009 09:33:03 -0700
- Subject: Re: Fwd: SSE2 instructions with GCC compiler on windows
- References: <edecb6ee0904291634h5071becdh3be3a2dd65c11495@mail.gmail.com> <edecb6ee0904291714y3acd00d0m56807737b9811ca9@mail.gmail.com> <m3tz46x205.fsf@google.com> <edecb6ee0905010845kf7d3e98ic0af6d4a9aa95ebd@mail.gmail.com>
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