I have to implement a simple program in SSE, and I don't know if I have done it in the right way (it's my first program in SSE).This is the C++ program:double distance (int x1, int x2, int y1, int y2){    double x = abs(x2 - x1);    double y = abs(y2 - y1);    double dist = sqrt(x*x + y*y);    return dist;}And this is the program in SSE instructions:__m128d vx1 _mm_load_pd(x1); // load x1 and x2__m128d vx2 = _mm_load_pd(x2);__m128d vdiff = _mm_sub_pd(vx2, vx1); // x2 - x1__m128d vnegdiff = mm_sub_pd(_mm_set1_pd(0.0), vdiff); // 0.0 - diff__m128d vabsX = _mm_max_pd(vdiff, vnegdiff);        //  abs = max(diff, - diff)__m128d vy1 = _mm_load_pd(y1); __m128d vy2 = _mm_load_pd(y2);__m128d vdiff2 = _mm_sub_pd(vy2, vy1); __m128d vnegdiff2 = mm_sub_pd(_mm_set1_pd(0.0), vdiff2); __m128d vabsY = _mm_max_pd(vdiff2, vnegdiff2);__m128d absX = _mm_mul_pd(vabsX,vabsX); //x*x__m128d absY = _mm_mul_pd(vabsY,vabsY); //y*y__m128d suma = _mm_add_pd(absX, absY); // x^2 + y^2__m128d square = _mm_sqrt_pd(suma); // square root x^2 + y^2return square;
Is this C++ program correctly implemented in SSE?
c++;assembly;sse