Hallo,

I have started looking at the SSE intrinsics commands for c++, but I cant the one of the first examples to compile, so I was wondering if anyone could give me a hand?

Code:

#include <iostream>
#include <xmmintrin.h>
using namespace std;
float pArray1[4] = {2.5 , 5.0 , 7.5, 10};
float pArray2[4] = {3.5 , 6.0 , 8.5, 11};
float result[4];
int main()
{
__m128 m1, m2, m3, m4;
__m128* a1 = (__m128*)pArray1;
__m128* a2 = (__m128*)pArray2;
__m128* res = (__m128*)result;
m1 = _mm_mul_ps(*a1, *a1); // m1 = *a1 * *a1
m2 = _mm_mul_ps(*a2, *a2); // m2 = *a2 * *a2
m3 = _mm_add_ps(m1, m2); // m3 = m1 + m2
m4 = _mm_sqrt_ps(m3); // m4 = sqrt(m3)
union u
{
__m128 m;
float f[4];
} x;
x.m = m4;
cout << x.f[0];
system("PAUSE");
return 0;
}

Thanks,