Absolutwert von Intel intrinsisch

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

 void vectorAbs(double *x, double *y, unsigned int N);
 int main()
 {
     double x[] = { -1, -2, -3, -4, -5, -6 };
     double y[] = { 2, 2, 2, 2, 2, 2 };
     double *pX = x, *pY = y;

     vectorAbs(pX, pY, 6);
 }

__m128d abs_sample1 (__m128d val)
    {
    return _mm_castsi128_pd (_mm_srli_epi64 (_mm_slli_epi64 (_mm_castpd_si128 (val), 1), 1));
    }

__m128d abs_sample2 (__m128d val)
    {
    const __m128d mask = _mm_castsi128_pd (_mm_set1_epi64x (0x7FFFFFFFFFFFFFFF));
    return _mm_and_pd (mask, val);
    }

 void vectorAbs(double *x, double *y, unsigned int N)
 {
     __m128d xVar;
     __m128d yVar;

     printf("\nSquare of x : \n");
     for (int i = 0; i < N; i += 2)
     {
       xVar = _mm_loadu_pd(&x[i]);  // load *x[i] to xVar 

       yVar = abs_sample1(xVar); // abs of x
       _mm_storeu_pd(&y[i], yVar); // store yVar to y[i]
       printf("%lf, %lf, ", y[i], y[i + 1]);
     }
     system("pause");

}
Prickly Pigeon