SSE3 Programming question

I am trying to use the sample code in Visual Studio 2005 Beta 2 to compile SSE3 math operations, and am having problems. The first issue is that the intrinsic math functions (_mm_addsub_pd for example) are not declared in emmintrin.h. This is the only file that the MSDN help says is needed to include. If the sample code is compiled with this header file, unresolved externals occur. I managed to find pmmintrin.h in the Intel C++ compiler installation which fixed the problem of unresolved externals, and declares the SSE3 functions. The next problem is that the sample code causes an access violation: "Access violation reading location 0xffffffff" in the _mm_load_pd intrinsic. Thus, the sample code is completely broken. Could someone point me in the right direction for getting rid of this access violation, and is there a Visual Studio counterpart to pmmintrin.h?
[890 byte] By [VijayHariharan] at [2008-3-1]
# 1
Use:
mmintrin.h for MMX
xmmintrin.h for SSE
emmintrin.h for SSE2
pmmintrin.h for SSE3
The last one does not appear to be included with Beta2, but can be found in Intel's compiler distro (http://www.intel.com/cd/software/products/asmo-na/eng/compilers/cwin/index.htm).
- NK
narechk at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 2

Hi Vijay, it appears that the code example given does not use our current intrinsic header file. I've modified the code below to make use of this. I'll let our doc team know about this.

Unfortunately I don't have an SSE3 machine connected at the moment, but I'll get this tested later today to see what the issue is with runtime.

Thanks,

Kang Su Gatlin
Visual C++ Program Manager

#include <stdio.h>
#include <intrin.h>

int main( )
{
__m128d u, v, w;
double a[2] = { 0.1, 0.2 };
double b[2] = { 0.001, 0.002 };

printf_s("Loading double values %e %e into XMM register.\n",
a[0], a[1] );
u = _mm_load_pd(a);
printf_s("Loading double values %e %e into XMM register.\n",
b[0], b[1] );
v = _mm_load_pd(b);

printf_s("Calling _mm_addsub_pd to modify these values.\n");
w = _mm_addsub_pd ( u , v);

printf_s("Result: %e %e \n", w.m128d_f64[0], w.m128d_f64[1]);
}

KangSuGatlin at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...
# 3
Well it appears that this code that I posted works fine. Could you let me know if this does or doesn't work OK for you.

Thanks,

Kang Su Gatlin
Visual C++ Program Manager

KangSuGatlin at 2007-9-9 > top of Msdn Tech,Visual C++,Visual C++ Language...