Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_sse4_1_single.c
Location:line 111, column 22
Description:Value stored to 'two' during its initialization is never read

Annotated Source Code

1/*
2 * This file is part of the GROMACS molecular simulation package.
3 *
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
8 *
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
13 *
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 *
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
31 *
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
34 */
35/*
36 * Note: this file was generated by the GROMACS sse4_1_single kernel generator.
37 */
38#ifdef HAVE_CONFIG_H1
39#include <config.h>
40#endif
41
42#include <math.h>
43
44#include "../nb_kernel.h"
45#include "types/simple.h"
46#include "gromacs/math/vec.h"
47#include "nrnb.h"
48
49#include "gromacs/simd/math_x86_sse4_1_single.h"
50#include "kernelutil_x86_sse4_1_single.h"
51
52/*
53 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_VF_sse4_1_single
54 * Electrostatics interaction: CubicSplineTable
55 * VdW interaction: CubicSplineTable
56 * Geometry: Water3-Particle
57 * Calculate force/pot: PotentialAndForce
58 */
59void
60nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_VF_sse4_1_single
61 (t_nblist * gmx_restrict nlist,
62 rvec * gmx_restrict xx,
63 rvec * gmx_restrict ff,
64 t_forcerec * gmx_restrict fr,
65 t_mdatoms * gmx_restrict mdatoms,
66 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
67 t_nrnb * gmx_restrict nrnb)
68{
69 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
70 * just 0 for non-waters.
71 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
72 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 */
74 int i_shift_offset,i_coord_offset,outeriter,inneriter;
75 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int jnrA,jnrB,jnrC,jnrD;
77 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
78 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
79 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
80 real rcutoff_scalar;
81 real *shiftvec,*fshift,*x,*f;
82 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
83 real scratch[4*DIM3];
84 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
85 int vdwioffset0;
86 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
87 int vdwioffset1;
88 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
89 int vdwioffset2;
90 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
91 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
92 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
93 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
94 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
95 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
96 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
97 real *charge;
98 int nvdwtype;
99 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
100 int *vdwtype;
101 real *vdwparam;
102 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
103 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
104 __m128i vfitab;
105 __m128i ifour = _mm_set1_epi32(4);
106 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
107 real *vftab;
108 __m128 dummy_mask,cutoff_mask;
109 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
110 __m128 one = _mm_set1_ps(1.0);
111 __m128 two = _mm_set1_ps(2.0);
Value stored to 'two' during its initialization is never read
112 x = xx[0];
113 f = ff[0];
114
115 nri = nlist->nri;
116 iinr = nlist->iinr;
117 jindex = nlist->jindex;
118 jjnr = nlist->jjnr;
119 shiftidx = nlist->shift;
120 gid = nlist->gid;
121 shiftvec = fr->shift_vec[0];
122 fshift = fr->fshift[0];
123 facel = _mm_set1_ps(fr->epsfac);
124 charge = mdatoms->chargeA;
125 nvdwtype = fr->ntype;
126 vdwparam = fr->nbfp;
127 vdwtype = mdatoms->typeA;
128
129 vftab = kernel_data->table_elec_vdw->data;
130 vftabscale = _mm_set1_ps(kernel_data->table_elec_vdw->scale);
131
132 /* Setup water-specific parameters */
133 inr = nlist->iinr[0];
134 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
135 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
136 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
137 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
138
139 /* Avoid stupid compiler warnings */
140 jnrA = jnrB = jnrC = jnrD = 0;
141 j_coord_offsetA = 0;
142 j_coord_offsetB = 0;
143 j_coord_offsetC = 0;
144 j_coord_offsetD = 0;
145
146 outeriter = 0;
147 inneriter = 0;
148
149 for(iidx=0;iidx<4*DIM3;iidx++)
150 {
151 scratch[iidx] = 0.0;
152 }
153
154 /* Start outer loop over neighborlists */
155 for(iidx=0; iidx<nri; iidx++)
156 {
157 /* Load shift vector for this list */
158 i_shift_offset = DIM3*shiftidx[iidx];
159
160 /* Load limits for loop over neighbors */
161 j_index_start = jindex[iidx];
162 j_index_end = jindex[iidx+1];
163
164 /* Get outer coordinate index */
165 inr = iinr[iidx];
166 i_coord_offset = DIM3*inr;
167
168 /* Load i particle coords and add shift vector */
169 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
170 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
171
172 fix0 = _mm_setzero_ps();
173 fiy0 = _mm_setzero_ps();
174 fiz0 = _mm_setzero_ps();
175 fix1 = _mm_setzero_ps();
176 fiy1 = _mm_setzero_ps();
177 fiz1 = _mm_setzero_ps();
178 fix2 = _mm_setzero_ps();
179 fiy2 = _mm_setzero_ps();
180 fiz2 = _mm_setzero_ps();
181
182 /* Reset potential sums */
183 velecsum = _mm_setzero_ps();
184 vvdwsum = _mm_setzero_ps();
185
186 /* Start inner kernel loop */
187 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
188 {
189
190 /* Get j neighbor index, and coordinate index */
191 jnrA = jjnr[jidx];
192 jnrB = jjnr[jidx+1];
193 jnrC = jjnr[jidx+2];
194 jnrD = jjnr[jidx+3];
195 j_coord_offsetA = DIM3*jnrA;
196 j_coord_offsetB = DIM3*jnrB;
197 j_coord_offsetC = DIM3*jnrC;
198 j_coord_offsetD = DIM3*jnrD;
199
200 /* load j atom coordinates */
201 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
202 x+j_coord_offsetC,x+j_coord_offsetD,
203 &jx0,&jy0,&jz0);
204
205 /* Calculate displacement vector */
206 dx00 = _mm_sub_ps(ix0,jx0);
207 dy00 = _mm_sub_ps(iy0,jy0);
208 dz00 = _mm_sub_ps(iz0,jz0);
209 dx10 = _mm_sub_ps(ix1,jx0);
210 dy10 = _mm_sub_ps(iy1,jy0);
211 dz10 = _mm_sub_ps(iz1,jz0);
212 dx20 = _mm_sub_ps(ix2,jx0);
213 dy20 = _mm_sub_ps(iy2,jy0);
214 dz20 = _mm_sub_ps(iz2,jz0);
215
216 /* Calculate squared distance and things based on it */
217 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
218 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
219 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
220
221 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
222 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
223 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
224
225 /* Load parameters for j particles */
226 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
227 charge+jnrC+0,charge+jnrD+0);
228 vdwjidx0A = 2*vdwtype[jnrA+0];
229 vdwjidx0B = 2*vdwtype[jnrB+0];
230 vdwjidx0C = 2*vdwtype[jnrC+0];
231 vdwjidx0D = 2*vdwtype[jnrD+0];
232
233 fjx0 = _mm_setzero_ps();
234 fjy0 = _mm_setzero_ps();
235 fjz0 = _mm_setzero_ps();
236
237 /**************************
238 * CALCULATE INTERACTIONS *
239 **************************/
240
241 r00 = _mm_mul_ps(rsq00,rinv00);
242
243 /* Compute parameters for interactions between i and j atoms */
244 qq00 = _mm_mul_ps(iq0,jq0);
245 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
246 vdwparam+vdwioffset0+vdwjidx0B,
247 vdwparam+vdwioffset0+vdwjidx0C,
248 vdwparam+vdwioffset0+vdwjidx0D,
249 &c6_00,&c12_00);
250
251 /* Calculate table index by multiplying r with table scale and truncate to integer */
252 rt = _mm_mul_ps(r00,vftabscale);
253 vfitab = _mm_cvttps_epi32(rt);
254 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
255 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
256
257 /* CUBIC SPLINE TABLE ELECTROSTATICS */
258 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
259 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
260 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
261 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
262 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
263 Heps = _mm_mul_ps(vfeps,H);
264 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
265 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
266 velec = _mm_mul_ps(qq00,VV);
267 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
268 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq00,FF),_mm_mul_ps(vftabscale,rinv00)));
269
270 /* CUBIC SPLINE TABLE DISPERSION */
271 vfitab = _mm_add_epi32(vfitab,ifour);
272 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
273 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
274 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
275 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
276 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
277 Heps = _mm_mul_ps(vfeps,H);
278 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
279 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
280 vvdw6 = _mm_mul_ps(c6_00,VV);
281 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
282 fvdw6 = _mm_mul_ps(c6_00,FF);
283
284 /* CUBIC SPLINE TABLE REPULSION */
285 vfitab = _mm_add_epi32(vfitab,ifour);
286 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
287 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
288 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
289 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
290 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
291 Heps = _mm_mul_ps(vfeps,H);
292 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
293 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
294 vvdw12 = _mm_mul_ps(c12_00,VV);
295 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
296 fvdw12 = _mm_mul_ps(c12_00,FF);
297 vvdw = _mm_add_ps(vvdw12,vvdw6);
298 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
299
300 /* Update potential sum for this i atom from the interaction with this j atom. */
301 velecsum = _mm_add_ps(velecsum,velec);
302 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
303
304 fscal = _mm_add_ps(felec,fvdw);
305
306 /* Calculate temporary vectorial force */
307 tx = _mm_mul_ps(fscal,dx00);
308 ty = _mm_mul_ps(fscal,dy00);
309 tz = _mm_mul_ps(fscal,dz00);
310
311 /* Update vectorial force */
312 fix0 = _mm_add_ps(fix0,tx);
313 fiy0 = _mm_add_ps(fiy0,ty);
314 fiz0 = _mm_add_ps(fiz0,tz);
315
316 fjx0 = _mm_add_ps(fjx0,tx);
317 fjy0 = _mm_add_ps(fjy0,ty);
318 fjz0 = _mm_add_ps(fjz0,tz);
319
320 /**************************
321 * CALCULATE INTERACTIONS *
322 **************************/
323
324 r10 = _mm_mul_ps(rsq10,rinv10);
325
326 /* Compute parameters for interactions between i and j atoms */
327 qq10 = _mm_mul_ps(iq1,jq0);
328
329 /* Calculate table index by multiplying r with table scale and truncate to integer */
330 rt = _mm_mul_ps(r10,vftabscale);
331 vfitab = _mm_cvttps_epi32(rt);
332 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
333 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
334
335 /* CUBIC SPLINE TABLE ELECTROSTATICS */
336 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
337 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
338 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
339 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
340 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
341 Heps = _mm_mul_ps(vfeps,H);
342 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
343 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
344 velec = _mm_mul_ps(qq10,VV);
345 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
346 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq10,FF),_mm_mul_ps(vftabscale,rinv10)));
347
348 /* Update potential sum for this i atom from the interaction with this j atom. */
349 velecsum = _mm_add_ps(velecsum,velec);
350
351 fscal = felec;
352
353 /* Calculate temporary vectorial force */
354 tx = _mm_mul_ps(fscal,dx10);
355 ty = _mm_mul_ps(fscal,dy10);
356 tz = _mm_mul_ps(fscal,dz10);
357
358 /* Update vectorial force */
359 fix1 = _mm_add_ps(fix1,tx);
360 fiy1 = _mm_add_ps(fiy1,ty);
361 fiz1 = _mm_add_ps(fiz1,tz);
362
363 fjx0 = _mm_add_ps(fjx0,tx);
364 fjy0 = _mm_add_ps(fjy0,ty);
365 fjz0 = _mm_add_ps(fjz0,tz);
366
367 /**************************
368 * CALCULATE INTERACTIONS *
369 **************************/
370
371 r20 = _mm_mul_ps(rsq20,rinv20);
372
373 /* Compute parameters for interactions between i and j atoms */
374 qq20 = _mm_mul_ps(iq2,jq0);
375
376 /* Calculate table index by multiplying r with table scale and truncate to integer */
377 rt = _mm_mul_ps(r20,vftabscale);
378 vfitab = _mm_cvttps_epi32(rt);
379 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
380 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
381
382 /* CUBIC SPLINE TABLE ELECTROSTATICS */
383 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
384 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
385 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
386 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
387 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
388 Heps = _mm_mul_ps(vfeps,H);
389 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
390 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
391 velec = _mm_mul_ps(qq20,VV);
392 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
393 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq20,FF),_mm_mul_ps(vftabscale,rinv20)));
394
395 /* Update potential sum for this i atom from the interaction with this j atom. */
396 velecsum = _mm_add_ps(velecsum,velec);
397
398 fscal = felec;
399
400 /* Calculate temporary vectorial force */
401 tx = _mm_mul_ps(fscal,dx20);
402 ty = _mm_mul_ps(fscal,dy20);
403 tz = _mm_mul_ps(fscal,dz20);
404
405 /* Update vectorial force */
406 fix2 = _mm_add_ps(fix2,tx);
407 fiy2 = _mm_add_ps(fiy2,ty);
408 fiz2 = _mm_add_ps(fiz2,tz);
409
410 fjx0 = _mm_add_ps(fjx0,tx);
411 fjy0 = _mm_add_ps(fjy0,ty);
412 fjz0 = _mm_add_ps(fjz0,tz);
413
414 fjptrA = f+j_coord_offsetA;
415 fjptrB = f+j_coord_offsetB;
416 fjptrC = f+j_coord_offsetC;
417 fjptrD = f+j_coord_offsetD;
418
419 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
420
421 /* Inner loop uses 159 flops */
422 }
423
424 if(jidx<j_index_end)
425 {
426
427 /* Get j neighbor index, and coordinate index */
428 jnrlistA = jjnr[jidx];
429 jnrlistB = jjnr[jidx+1];
430 jnrlistC = jjnr[jidx+2];
431 jnrlistD = jjnr[jidx+3];
432 /* Sign of each element will be negative for non-real atoms.
433 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
434 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
435 */
436 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
437 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
438 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
439 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
440 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
441 j_coord_offsetA = DIM3*jnrA;
442 j_coord_offsetB = DIM3*jnrB;
443 j_coord_offsetC = DIM3*jnrC;
444 j_coord_offsetD = DIM3*jnrD;
445
446 /* load j atom coordinates */
447 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
448 x+j_coord_offsetC,x+j_coord_offsetD,
449 &jx0,&jy0,&jz0);
450
451 /* Calculate displacement vector */
452 dx00 = _mm_sub_ps(ix0,jx0);
453 dy00 = _mm_sub_ps(iy0,jy0);
454 dz00 = _mm_sub_ps(iz0,jz0);
455 dx10 = _mm_sub_ps(ix1,jx0);
456 dy10 = _mm_sub_ps(iy1,jy0);
457 dz10 = _mm_sub_ps(iz1,jz0);
458 dx20 = _mm_sub_ps(ix2,jx0);
459 dy20 = _mm_sub_ps(iy2,jy0);
460 dz20 = _mm_sub_ps(iz2,jz0);
461
462 /* Calculate squared distance and things based on it */
463 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
464 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
465 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
466
467 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
468 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
469 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
470
471 /* Load parameters for j particles */
472 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
473 charge+jnrC+0,charge+jnrD+0);
474 vdwjidx0A = 2*vdwtype[jnrA+0];
475 vdwjidx0B = 2*vdwtype[jnrB+0];
476 vdwjidx0C = 2*vdwtype[jnrC+0];
477 vdwjidx0D = 2*vdwtype[jnrD+0];
478
479 fjx0 = _mm_setzero_ps();
480 fjy0 = _mm_setzero_ps();
481 fjz0 = _mm_setzero_ps();
482
483 /**************************
484 * CALCULATE INTERACTIONS *
485 **************************/
486
487 r00 = _mm_mul_ps(rsq00,rinv00);
488 r00 = _mm_andnot_ps(dummy_mask,r00);
489
490 /* Compute parameters for interactions between i and j atoms */
491 qq00 = _mm_mul_ps(iq0,jq0);
492 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
493 vdwparam+vdwioffset0+vdwjidx0B,
494 vdwparam+vdwioffset0+vdwjidx0C,
495 vdwparam+vdwioffset0+vdwjidx0D,
496 &c6_00,&c12_00);
497
498 /* Calculate table index by multiplying r with table scale and truncate to integer */
499 rt = _mm_mul_ps(r00,vftabscale);
500 vfitab = _mm_cvttps_epi32(rt);
501 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
502 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
503
504 /* CUBIC SPLINE TABLE ELECTROSTATICS */
505 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
506 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
507 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
508 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
509 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
510 Heps = _mm_mul_ps(vfeps,H);
511 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
512 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
513 velec = _mm_mul_ps(qq00,VV);
514 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
515 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq00,FF),_mm_mul_ps(vftabscale,rinv00)));
516
517 /* CUBIC SPLINE TABLE DISPERSION */
518 vfitab = _mm_add_epi32(vfitab,ifour);
519 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
520 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
521 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
522 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
523 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
524 Heps = _mm_mul_ps(vfeps,H);
525 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
526 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
527 vvdw6 = _mm_mul_ps(c6_00,VV);
528 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
529 fvdw6 = _mm_mul_ps(c6_00,FF);
530
531 /* CUBIC SPLINE TABLE REPULSION */
532 vfitab = _mm_add_epi32(vfitab,ifour);
533 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
534 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
535 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
536 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
537 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
538 Heps = _mm_mul_ps(vfeps,H);
539 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
540 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
541 vvdw12 = _mm_mul_ps(c12_00,VV);
542 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
543 fvdw12 = _mm_mul_ps(c12_00,FF);
544 vvdw = _mm_add_ps(vvdw12,vvdw6);
545 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
546
547 /* Update potential sum for this i atom from the interaction with this j atom. */
548 velec = _mm_andnot_ps(dummy_mask,velec);
549 velecsum = _mm_add_ps(velecsum,velec);
550 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
551 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
552
553 fscal = _mm_add_ps(felec,fvdw);
554
555 fscal = _mm_andnot_ps(dummy_mask,fscal);
556
557 /* Calculate temporary vectorial force */
558 tx = _mm_mul_ps(fscal,dx00);
559 ty = _mm_mul_ps(fscal,dy00);
560 tz = _mm_mul_ps(fscal,dz00);
561
562 /* Update vectorial force */
563 fix0 = _mm_add_ps(fix0,tx);
564 fiy0 = _mm_add_ps(fiy0,ty);
565 fiz0 = _mm_add_ps(fiz0,tz);
566
567 fjx0 = _mm_add_ps(fjx0,tx);
568 fjy0 = _mm_add_ps(fjy0,ty);
569 fjz0 = _mm_add_ps(fjz0,tz);
570
571 /**************************
572 * CALCULATE INTERACTIONS *
573 **************************/
574
575 r10 = _mm_mul_ps(rsq10,rinv10);
576 r10 = _mm_andnot_ps(dummy_mask,r10);
577
578 /* Compute parameters for interactions between i and j atoms */
579 qq10 = _mm_mul_ps(iq1,jq0);
580
581 /* Calculate table index by multiplying r with table scale and truncate to integer */
582 rt = _mm_mul_ps(r10,vftabscale);
583 vfitab = _mm_cvttps_epi32(rt);
584 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
585 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
586
587 /* CUBIC SPLINE TABLE ELECTROSTATICS */
588 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
589 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
590 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
591 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
592 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
593 Heps = _mm_mul_ps(vfeps,H);
594 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
595 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
596 velec = _mm_mul_ps(qq10,VV);
597 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
598 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq10,FF),_mm_mul_ps(vftabscale,rinv10)));
599
600 /* Update potential sum for this i atom from the interaction with this j atom. */
601 velec = _mm_andnot_ps(dummy_mask,velec);
602 velecsum = _mm_add_ps(velecsum,velec);
603
604 fscal = felec;
605
606 fscal = _mm_andnot_ps(dummy_mask,fscal);
607
608 /* Calculate temporary vectorial force */
609 tx = _mm_mul_ps(fscal,dx10);
610 ty = _mm_mul_ps(fscal,dy10);
611 tz = _mm_mul_ps(fscal,dz10);
612
613 /* Update vectorial force */
614 fix1 = _mm_add_ps(fix1,tx);
615 fiy1 = _mm_add_ps(fiy1,ty);
616 fiz1 = _mm_add_ps(fiz1,tz);
617
618 fjx0 = _mm_add_ps(fjx0,tx);
619 fjy0 = _mm_add_ps(fjy0,ty);
620 fjz0 = _mm_add_ps(fjz0,tz);
621
622 /**************************
623 * CALCULATE INTERACTIONS *
624 **************************/
625
626 r20 = _mm_mul_ps(rsq20,rinv20);
627 r20 = _mm_andnot_ps(dummy_mask,r20);
628
629 /* Compute parameters for interactions between i and j atoms */
630 qq20 = _mm_mul_ps(iq2,jq0);
631
632 /* Calculate table index by multiplying r with table scale and truncate to integer */
633 rt = _mm_mul_ps(r20,vftabscale);
634 vfitab = _mm_cvttps_epi32(rt);
635 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
636 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
637
638 /* CUBIC SPLINE TABLE ELECTROSTATICS */
639 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
640 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
641 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
642 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
643 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
644 Heps = _mm_mul_ps(vfeps,H);
645 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
646 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
647 velec = _mm_mul_ps(qq20,VV);
648 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
649 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq20,FF),_mm_mul_ps(vftabscale,rinv20)));
650
651 /* Update potential sum for this i atom from the interaction with this j atom. */
652 velec = _mm_andnot_ps(dummy_mask,velec);
653 velecsum = _mm_add_ps(velecsum,velec);
654
655 fscal = felec;
656
657 fscal = _mm_andnot_ps(dummy_mask,fscal);
658
659 /* Calculate temporary vectorial force */
660 tx = _mm_mul_ps(fscal,dx20);
661 ty = _mm_mul_ps(fscal,dy20);
662 tz = _mm_mul_ps(fscal,dz20);
663
664 /* Update vectorial force */
665 fix2 = _mm_add_ps(fix2,tx);
666 fiy2 = _mm_add_ps(fiy2,ty);
667 fiz2 = _mm_add_ps(fiz2,tz);
668
669 fjx0 = _mm_add_ps(fjx0,tx);
670 fjy0 = _mm_add_ps(fjy0,ty);
671 fjz0 = _mm_add_ps(fjz0,tz);
672
673 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
674 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
675 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
676 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
677
678 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
679
680 /* Inner loop uses 162 flops */
681 }
682
683 /* End of innermost loop */
684
685 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
686 f+i_coord_offset,fshift+i_shift_offset);
687
688 ggid = gid[iidx];
689 /* Update potential energies */
690 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
691 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
692
693 /* Increment number of inner iterations */
694 inneriter += j_index_end - j_index_start;
695
696 /* Outer loop uses 20 flops */
697 }
698
699 /* Increment number of outer iterations */
700 outeriter += nri;
701
702 /* Update outer/inner flops */
703
704 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*162)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3_VF] += outeriter*20 + inneriter
*162
;
705}
706/*
707 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_F_sse4_1_single
708 * Electrostatics interaction: CubicSplineTable
709 * VdW interaction: CubicSplineTable
710 * Geometry: Water3-Particle
711 * Calculate force/pot: Force
712 */
713void
714nb_kernel_ElecCSTab_VdwCSTab_GeomW3P1_F_sse4_1_single
715 (t_nblist * gmx_restrict nlist,
716 rvec * gmx_restrict xx,
717 rvec * gmx_restrict ff,
718 t_forcerec * gmx_restrict fr,
719 t_mdatoms * gmx_restrict mdatoms,
720 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
721 t_nrnb * gmx_restrict nrnb)
722{
723 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
724 * just 0 for non-waters.
725 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
726 * jnr indices corresponding to data put in the four positions in the SIMD register.
727 */
728 int i_shift_offset,i_coord_offset,outeriter,inneriter;
729 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
730 int jnrA,jnrB,jnrC,jnrD;
731 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
732 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
733 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
734 real rcutoff_scalar;
735 real *shiftvec,*fshift,*x,*f;
736 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
737 real scratch[4*DIM3];
738 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
739 int vdwioffset0;
740 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
741 int vdwioffset1;
742 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
743 int vdwioffset2;
744 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
745 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
746 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
747 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
748 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
749 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
750 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
751 real *charge;
752 int nvdwtype;
753 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
754 int *vdwtype;
755 real *vdwparam;
756 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
757 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
758 __m128i vfitab;
759 __m128i ifour = _mm_set1_epi32(4);
760 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
761 real *vftab;
762 __m128 dummy_mask,cutoff_mask;
763 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
764 __m128 one = _mm_set1_ps(1.0);
765 __m128 two = _mm_set1_ps(2.0);
766 x = xx[0];
767 f = ff[0];
768
769 nri = nlist->nri;
770 iinr = nlist->iinr;
771 jindex = nlist->jindex;
772 jjnr = nlist->jjnr;
773 shiftidx = nlist->shift;
774 gid = nlist->gid;
775 shiftvec = fr->shift_vec[0];
776 fshift = fr->fshift[0];
777 facel = _mm_set1_ps(fr->epsfac);
778 charge = mdatoms->chargeA;
779 nvdwtype = fr->ntype;
780 vdwparam = fr->nbfp;
781 vdwtype = mdatoms->typeA;
782
783 vftab = kernel_data->table_elec_vdw->data;
784 vftabscale = _mm_set1_ps(kernel_data->table_elec_vdw->scale);
785
786 /* Setup water-specific parameters */
787 inr = nlist->iinr[0];
788 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
789 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
790 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
791 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
792
793 /* Avoid stupid compiler warnings */
794 jnrA = jnrB = jnrC = jnrD = 0;
795 j_coord_offsetA = 0;
796 j_coord_offsetB = 0;
797 j_coord_offsetC = 0;
798 j_coord_offsetD = 0;
799
800 outeriter = 0;
801 inneriter = 0;
802
803 for(iidx=0;iidx<4*DIM3;iidx++)
804 {
805 scratch[iidx] = 0.0;
806 }
807
808 /* Start outer loop over neighborlists */
809 for(iidx=0; iidx<nri; iidx++)
810 {
811 /* Load shift vector for this list */
812 i_shift_offset = DIM3*shiftidx[iidx];
813
814 /* Load limits for loop over neighbors */
815 j_index_start = jindex[iidx];
816 j_index_end = jindex[iidx+1];
817
818 /* Get outer coordinate index */
819 inr = iinr[iidx];
820 i_coord_offset = DIM3*inr;
821
822 /* Load i particle coords and add shift vector */
823 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
824 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
825
826 fix0 = _mm_setzero_ps();
827 fiy0 = _mm_setzero_ps();
828 fiz0 = _mm_setzero_ps();
829 fix1 = _mm_setzero_ps();
830 fiy1 = _mm_setzero_ps();
831 fiz1 = _mm_setzero_ps();
832 fix2 = _mm_setzero_ps();
833 fiy2 = _mm_setzero_ps();
834 fiz2 = _mm_setzero_ps();
835
836 /* Start inner kernel loop */
837 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
838 {
839
840 /* Get j neighbor index, and coordinate index */
841 jnrA = jjnr[jidx];
842 jnrB = jjnr[jidx+1];
843 jnrC = jjnr[jidx+2];
844 jnrD = jjnr[jidx+3];
845 j_coord_offsetA = DIM3*jnrA;
846 j_coord_offsetB = DIM3*jnrB;
847 j_coord_offsetC = DIM3*jnrC;
848 j_coord_offsetD = DIM3*jnrD;
849
850 /* load j atom coordinates */
851 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
852 x+j_coord_offsetC,x+j_coord_offsetD,
853 &jx0,&jy0,&jz0);
854
855 /* Calculate displacement vector */
856 dx00 = _mm_sub_ps(ix0,jx0);
857 dy00 = _mm_sub_ps(iy0,jy0);
858 dz00 = _mm_sub_ps(iz0,jz0);
859 dx10 = _mm_sub_ps(ix1,jx0);
860 dy10 = _mm_sub_ps(iy1,jy0);
861 dz10 = _mm_sub_ps(iz1,jz0);
862 dx20 = _mm_sub_ps(ix2,jx0);
863 dy20 = _mm_sub_ps(iy2,jy0);
864 dz20 = _mm_sub_ps(iz2,jz0);
865
866 /* Calculate squared distance and things based on it */
867 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
868 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
869 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
870
871 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
872 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
873 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
874
875 /* Load parameters for j particles */
876 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
877 charge+jnrC+0,charge+jnrD+0);
878 vdwjidx0A = 2*vdwtype[jnrA+0];
879 vdwjidx0B = 2*vdwtype[jnrB+0];
880 vdwjidx0C = 2*vdwtype[jnrC+0];
881 vdwjidx0D = 2*vdwtype[jnrD+0];
882
883 fjx0 = _mm_setzero_ps();
884 fjy0 = _mm_setzero_ps();
885 fjz0 = _mm_setzero_ps();
886
887 /**************************
888 * CALCULATE INTERACTIONS *
889 **************************/
890
891 r00 = _mm_mul_ps(rsq00,rinv00);
892
893 /* Compute parameters for interactions between i and j atoms */
894 qq00 = _mm_mul_ps(iq0,jq0);
895 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
896 vdwparam+vdwioffset0+vdwjidx0B,
897 vdwparam+vdwioffset0+vdwjidx0C,
898 vdwparam+vdwioffset0+vdwjidx0D,
899 &c6_00,&c12_00);
900
901 /* Calculate table index by multiplying r with table scale and truncate to integer */
902 rt = _mm_mul_ps(r00,vftabscale);
903 vfitab = _mm_cvttps_epi32(rt);
904 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
905 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
906
907 /* CUBIC SPLINE TABLE ELECTROSTATICS */
908 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
909 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
910 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
911 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
912 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
913 Heps = _mm_mul_ps(vfeps,H);
914 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
915 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
916 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq00,FF),_mm_mul_ps(vftabscale,rinv00)));
917
918 /* CUBIC SPLINE TABLE DISPERSION */
919 vfitab = _mm_add_epi32(vfitab,ifour);
920 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
921 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
922 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
923 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
924 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
925 Heps = _mm_mul_ps(vfeps,H);
926 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
927 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
928 fvdw6 = _mm_mul_ps(c6_00,FF);
929
930 /* CUBIC SPLINE TABLE REPULSION */
931 vfitab = _mm_add_epi32(vfitab,ifour);
932 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
933 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
934 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
935 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
936 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
937 Heps = _mm_mul_ps(vfeps,H);
938 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
939 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
940 fvdw12 = _mm_mul_ps(c12_00,FF);
941 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
942
943 fscal = _mm_add_ps(felec,fvdw);
944
945 /* Calculate temporary vectorial force */
946 tx = _mm_mul_ps(fscal,dx00);
947 ty = _mm_mul_ps(fscal,dy00);
948 tz = _mm_mul_ps(fscal,dz00);
949
950 /* Update vectorial force */
951 fix0 = _mm_add_ps(fix0,tx);
952 fiy0 = _mm_add_ps(fiy0,ty);
953 fiz0 = _mm_add_ps(fiz0,tz);
954
955 fjx0 = _mm_add_ps(fjx0,tx);
956 fjy0 = _mm_add_ps(fjy0,ty);
957 fjz0 = _mm_add_ps(fjz0,tz);
958
959 /**************************
960 * CALCULATE INTERACTIONS *
961 **************************/
962
963 r10 = _mm_mul_ps(rsq10,rinv10);
964
965 /* Compute parameters for interactions between i and j atoms */
966 qq10 = _mm_mul_ps(iq1,jq0);
967
968 /* Calculate table index by multiplying r with table scale and truncate to integer */
969 rt = _mm_mul_ps(r10,vftabscale);
970 vfitab = _mm_cvttps_epi32(rt);
971 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
972 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
973
974 /* CUBIC SPLINE TABLE ELECTROSTATICS */
975 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
976 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
977 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
978 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
979 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
980 Heps = _mm_mul_ps(vfeps,H);
981 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
982 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
983 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq10,FF),_mm_mul_ps(vftabscale,rinv10)));
984
985 fscal = felec;
986
987 /* Calculate temporary vectorial force */
988 tx = _mm_mul_ps(fscal,dx10);
989 ty = _mm_mul_ps(fscal,dy10);
990 tz = _mm_mul_ps(fscal,dz10);
991
992 /* Update vectorial force */
993 fix1 = _mm_add_ps(fix1,tx);
994 fiy1 = _mm_add_ps(fiy1,ty);
995 fiz1 = _mm_add_ps(fiz1,tz);
996
997 fjx0 = _mm_add_ps(fjx0,tx);
998 fjy0 = _mm_add_ps(fjy0,ty);
999 fjz0 = _mm_add_ps(fjz0,tz);
1000
1001 /**************************
1002 * CALCULATE INTERACTIONS *
1003 **************************/
1004
1005 r20 = _mm_mul_ps(rsq20,rinv20);
1006
1007 /* Compute parameters for interactions between i and j atoms */
1008 qq20 = _mm_mul_ps(iq2,jq0);
1009
1010 /* Calculate table index by multiplying r with table scale and truncate to integer */
1011 rt = _mm_mul_ps(r20,vftabscale);
1012 vfitab = _mm_cvttps_epi32(rt);
1013 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1014 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1015
1016 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1017 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1018 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1019 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1020 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1021 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
1022 Heps = _mm_mul_ps(vfeps,H);
1023 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1024 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1025 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq20,FF),_mm_mul_ps(vftabscale,rinv20)));
1026
1027 fscal = felec;
1028
1029 /* Calculate temporary vectorial force */
1030 tx = _mm_mul_ps(fscal,dx20);
1031 ty = _mm_mul_ps(fscal,dy20);
1032 tz = _mm_mul_ps(fscal,dz20);
1033
1034 /* Update vectorial force */
1035 fix2 = _mm_add_ps(fix2,tx);
1036 fiy2 = _mm_add_ps(fiy2,ty);
1037 fiz2 = _mm_add_ps(fiz2,tz);
1038
1039 fjx0 = _mm_add_ps(fjx0,tx);
1040 fjy0 = _mm_add_ps(fjy0,ty);
1041 fjz0 = _mm_add_ps(fjz0,tz);
1042
1043 fjptrA = f+j_coord_offsetA;
1044 fjptrB = f+j_coord_offsetB;
1045 fjptrC = f+j_coord_offsetC;
1046 fjptrD = f+j_coord_offsetD;
1047
1048 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1049
1050 /* Inner loop uses 139 flops */
1051 }
1052
1053 if(jidx<j_index_end)
1054 {
1055
1056 /* Get j neighbor index, and coordinate index */
1057 jnrlistA = jjnr[jidx];
1058 jnrlistB = jjnr[jidx+1];
1059 jnrlistC = jjnr[jidx+2];
1060 jnrlistD = jjnr[jidx+3];
1061 /* Sign of each element will be negative for non-real atoms.
1062 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
1063 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
1064 */
1065 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
1066 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
1067 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
1068 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
1069 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
1070 j_coord_offsetA = DIM3*jnrA;
1071 j_coord_offsetB = DIM3*jnrB;
1072 j_coord_offsetC = DIM3*jnrC;
1073 j_coord_offsetD = DIM3*jnrD;
1074
1075 /* load j atom coordinates */
1076 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
1077 x+j_coord_offsetC,x+j_coord_offsetD,
1078 &jx0,&jy0,&jz0);
1079
1080 /* Calculate displacement vector */
1081 dx00 = _mm_sub_ps(ix0,jx0);
1082 dy00 = _mm_sub_ps(iy0,jy0);
1083 dz00 = _mm_sub_ps(iz0,jz0);
1084 dx10 = _mm_sub_ps(ix1,jx0);
1085 dy10 = _mm_sub_ps(iy1,jy0);
1086 dz10 = _mm_sub_ps(iz1,jz0);
1087 dx20 = _mm_sub_ps(ix2,jx0);
1088 dy20 = _mm_sub_ps(iy2,jy0);
1089 dz20 = _mm_sub_ps(iz2,jz0);
1090
1091 /* Calculate squared distance and things based on it */
1092 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
1093 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
1094 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
1095
1096 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
1097 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
1098 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
1099
1100 /* Load parameters for j particles */
1101 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
1102 charge+jnrC+0,charge+jnrD+0);
1103 vdwjidx0A = 2*vdwtype[jnrA+0];
1104 vdwjidx0B = 2*vdwtype[jnrB+0];
1105 vdwjidx0C = 2*vdwtype[jnrC+0];
1106 vdwjidx0D = 2*vdwtype[jnrD+0];
1107
1108 fjx0 = _mm_setzero_ps();
1109 fjy0 = _mm_setzero_ps();
1110 fjz0 = _mm_setzero_ps();
1111
1112 /**************************
1113 * CALCULATE INTERACTIONS *
1114 **************************/
1115
1116 r00 = _mm_mul_ps(rsq00,rinv00);
1117 r00 = _mm_andnot_ps(dummy_mask,r00);
1118
1119 /* Compute parameters for interactions between i and j atoms */
1120 qq00 = _mm_mul_ps(iq0,jq0);
1121 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
1122 vdwparam+vdwioffset0+vdwjidx0B,
1123 vdwparam+vdwioffset0+vdwjidx0C,
1124 vdwparam+vdwioffset0+vdwjidx0D,
1125 &c6_00,&c12_00);
1126
1127 /* Calculate table index by multiplying r with table scale and truncate to integer */
1128 rt = _mm_mul_ps(r00,vftabscale);
1129 vfitab = _mm_cvttps_epi32(rt);
1130 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1131 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1132
1133 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1134 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1135 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1136 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1137 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1138 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
1139 Heps = _mm_mul_ps(vfeps,H);
1140 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1141 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1142 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq00,FF),_mm_mul_ps(vftabscale,rinv00)));
1143
1144 /* CUBIC SPLINE TABLE DISPERSION */
1145 vfitab = _mm_add_epi32(vfitab,ifour);
1146 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1147 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1148 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1149 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1150 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
1151 Heps = _mm_mul_ps(vfeps,H);
1152 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1153 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1154 fvdw6 = _mm_mul_ps(c6_00,FF);
1155
1156 /* CUBIC SPLINE TABLE REPULSION */
1157 vfitab = _mm_add_epi32(vfitab,ifour);
1158 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1159 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1160 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1161 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1162 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
1163 Heps = _mm_mul_ps(vfeps,H);
1164 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1165 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1166 fvdw12 = _mm_mul_ps(c12_00,FF);
1167 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1168
1169 fscal = _mm_add_ps(felec,fvdw);
1170
1171 fscal = _mm_andnot_ps(dummy_mask,fscal);
1172
1173 /* Calculate temporary vectorial force */
1174 tx = _mm_mul_ps(fscal,dx00);
1175 ty = _mm_mul_ps(fscal,dy00);
1176 tz = _mm_mul_ps(fscal,dz00);
1177
1178 /* Update vectorial force */
1179 fix0 = _mm_add_ps(fix0,tx);
1180 fiy0 = _mm_add_ps(fiy0,ty);
1181 fiz0 = _mm_add_ps(fiz0,tz);
1182
1183 fjx0 = _mm_add_ps(fjx0,tx);
1184 fjy0 = _mm_add_ps(fjy0,ty);
1185 fjz0 = _mm_add_ps(fjz0,tz);
1186
1187 /**************************
1188 * CALCULATE INTERACTIONS *
1189 **************************/
1190
1191 r10 = _mm_mul_ps(rsq10,rinv10);
1192 r10 = _mm_andnot_ps(dummy_mask,r10);
1193
1194 /* Compute parameters for interactions between i and j atoms */
1195 qq10 = _mm_mul_ps(iq1,jq0);
1196
1197 /* Calculate table index by multiplying r with table scale and truncate to integer */
1198 rt = _mm_mul_ps(r10,vftabscale);
1199 vfitab = _mm_cvttps_epi32(rt);
1200 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1201 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1202
1203 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1204 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1205 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1206 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1207 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1208 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
1209 Heps = _mm_mul_ps(vfeps,H);
1210 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1211 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1212 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq10,FF),_mm_mul_ps(vftabscale,rinv10)));
1213
1214 fscal = felec;
1215
1216 fscal = _mm_andnot_ps(dummy_mask,fscal);
1217
1218 /* Calculate temporary vectorial force */
1219 tx = _mm_mul_ps(fscal,dx10);
1220 ty = _mm_mul_ps(fscal,dy10);
1221 tz = _mm_mul_ps(fscal,dz10);
1222
1223 /* Update vectorial force */
1224 fix1 = _mm_add_ps(fix1,tx);
1225 fiy1 = _mm_add_ps(fiy1,ty);
1226 fiz1 = _mm_add_ps(fiz1,tz);
1227
1228 fjx0 = _mm_add_ps(fjx0,tx);
1229 fjy0 = _mm_add_ps(fjy0,ty);
1230 fjz0 = _mm_add_ps(fjz0,tz);
1231
1232 /**************************
1233 * CALCULATE INTERACTIONS *
1234 **************************/
1235
1236 r20 = _mm_mul_ps(rsq20,rinv20);
1237 r20 = _mm_andnot_ps(dummy_mask,r20);
1238
1239 /* Compute parameters for interactions between i and j atoms */
1240 qq20 = _mm_mul_ps(iq2,jq0);
1241
1242 /* Calculate table index by multiplying r with table scale and truncate to integer */
1243 rt = _mm_mul_ps(r20,vftabscale);
1244 vfitab = _mm_cvttps_epi32(rt);
1245 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1246 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1247
1248 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1249 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1250 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1251 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1252 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1253 _MM_TRANSPOSE4_PS(Y,F,G,H)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((Y
), (F)); tmp2 = _mm_unpacklo_ps((G), (H)); tmp1 = _mm_unpackhi_ps
((Y), (F)); tmp3 = _mm_unpackhi_ps((G), (H)); (Y) = _mm_movelh_ps
(tmp0, tmp2); (F) = _mm_movehl_ps(tmp2, tmp0); (G) = _mm_movelh_ps
(tmp1, tmp3); (H) = _mm_movehl_ps(tmp3, tmp1); } while (0)
;
1254 Heps = _mm_mul_ps(vfeps,H);
1255 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1256 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1257 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq20,FF),_mm_mul_ps(vftabscale,rinv20)));
1258
1259 fscal = felec;
1260
1261 fscal = _mm_andnot_ps(dummy_mask,fscal);
1262
1263 /* Calculate temporary vectorial force */
1264 tx = _mm_mul_ps(fscal,dx20);
1265 ty = _mm_mul_ps(fscal,dy20);
1266 tz = _mm_mul_ps(fscal,dz20);
1267
1268 /* Update vectorial force */
1269 fix2 = _mm_add_ps(fix2,tx);
1270 fiy2 = _mm_add_ps(fiy2,ty);
1271 fiz2 = _mm_add_ps(fiz2,tz);
1272
1273 fjx0 = _mm_add_ps(fjx0,tx);
1274 fjy0 = _mm_add_ps(fjy0,ty);
1275 fjz0 = _mm_add_ps(fjz0,tz);
1276
1277 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1278 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1279 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1280 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1281
1282 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1283
1284 /* Inner loop uses 142 flops */
1285 }
1286
1287 /* End of innermost loop */
1288
1289 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1290 f+i_coord_offset,fshift+i_shift_offset);
1291
1292 /* Increment number of inner iterations */
1293 inneriter += j_index_end - j_index_start;
1294
1295 /* Outer loop uses 18 flops */
1296 }
1297
1298 /* Increment number of outer iterations */
1299 outeriter += nri;
1300
1301 /* Update outer/inner flops */
1302
1303 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*142)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3_F] += outeriter*18 + inneriter
*142
;
1304}