1 /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
4 * This file is part of GROMACS.
7 * Written by the Gromacs development team under coordination of
8 * David van der Spoel, Berk Hess, and Erik Lindahl.
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Lesser General Public License
12 * as published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
15 * To help us fund GROMACS development, we humbly ask that you cite
16 * the research papers on the package. Check out http://www.gromacs.org
19 * Gnomes, ROck Monsters And Chili Sauce
21 #ifndef _gmx_x86_simd_double_h_
22 #define _gmx_x86_simd_double_h_
24 /* This file includes the highest possible level of x86 (math) acceleration */
26 #ifdef GMX_X86_AVX_256
27 #include "gmx_x86_avx_256.h"
28 #include "gmx_math_x86_avx_256_double.h"
30 #ifdef GMX_X86_AVX_128_FMA
31 #include "gmx_x86_avx_128_fma.h"
32 #include "gmx_math_x86_avx_128_fma_double.h"
35 #include "gmx_x86_sse4_1.h"
36 #include "gmx_math_x86_sse4_1_double.h"
39 #include "gmx_x86_sse2.h"
40 #include "gmx_math_x86_sse2_double.h"
42 #error No x86 acceleration defined
49 gmx_mm_calc_rsq_pd(__m128d dx
, __m128d dy
, __m128d dz
)
51 return _mm_add_pd( _mm_add_pd( _mm_mul_pd(dx
,dx
), _mm_mul_pd(dy
,dy
) ), _mm_mul_pd(dz
,dz
) );
54 /* Normal sum of four __m128d registers */
55 #define gmx_mm_sum4_pd(t0,t1,t2,t3) _mm_add_pd(_mm_add_pd(t0,t1),_mm_add_pd(t2,t3))
57 #ifdef GMX_X86_AVX_256
60 gmx_mm256_calc_rsq_pd(__m256d dx
, __m256d dy
, __m256d dz
)
62 return _mm256_add_pd( _mm256_add_pd( _mm256_mul_pd(dx
,dx
), _mm256_mul_pd(dy
,dy
) ), _mm256_mul_pd(dz
,dz
) );
65 /* Normal sum of four xmm registers */
66 #define gmx_mm256_sum4_pd(t0,t1,t2,t3) _mm256_add_pd(_mm256_add_pd(t0,t1),_mm256_add_pd(t2,t3))
70 #endif /* _gmx_x86_simd_double_h_ */