Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecCoul_VdwCSTab_GeomW3P1_sse4_1_single.c
Location:line 713, column 5
Description:Value stored to 'j_coord_offsetA' 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_ElecCoul_VdwCSTab_GeomW3P1_VF_sse4_1_single
54 * Electrostatics interaction: Coulomb
55 * VdW interaction: CubicSplineTable
56 * Geometry: Water3-Particle
57 * Calculate force/pot: PotentialAndForce
58 */
59void
60nb_kernel_ElecCoul_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);
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_vdw->data;
130 vftabscale = _mm_set1_ps(kernel_data->table_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 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
226 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
227 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
228
229 /* Load parameters for j particles */
230 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
231 charge+jnrC+0,charge+jnrD+0);
232 vdwjidx0A = 2*vdwtype[jnrA+0];
233 vdwjidx0B = 2*vdwtype[jnrB+0];
234 vdwjidx0C = 2*vdwtype[jnrC+0];
235 vdwjidx0D = 2*vdwtype[jnrD+0];
236
237 fjx0 = _mm_setzero_ps();
238 fjy0 = _mm_setzero_ps();
239 fjz0 = _mm_setzero_ps();
240
241 /**************************
242 * CALCULATE INTERACTIONS *
243 **************************/
244
245 r00 = _mm_mul_ps(rsq00,rinv00);
246
247 /* Compute parameters for interactions between i and j atoms */
248 qq00 = _mm_mul_ps(iq0,jq0);
249 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
250 vdwparam+vdwioffset0+vdwjidx0B,
251 vdwparam+vdwioffset0+vdwjidx0C,
252 vdwparam+vdwioffset0+vdwjidx0D,
253 &c6_00,&c12_00);
254
255 /* Calculate table index by multiplying r with table scale and truncate to integer */
256 rt = _mm_mul_ps(r00,vftabscale);
257 vfitab = _mm_cvttps_epi32(rt);
258 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
259 vfitab = _mm_slli_epi32(vfitab,3);
260
261 /* COULOMB ELECTROSTATICS */
262 velec = _mm_mul_ps(qq00,rinv00);
263 felec = _mm_mul_ps(velec,rinvsq00);
264
265 /* CUBIC SPLINE TABLE DISPERSION */
266 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
267 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
268 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
269 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
270 _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)
;
271 Heps = _mm_mul_ps(vfeps,H);
272 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
273 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
274 vvdw6 = _mm_mul_ps(c6_00,VV);
275 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
276 fvdw6 = _mm_mul_ps(c6_00,FF);
277
278 /* CUBIC SPLINE TABLE REPULSION */
279 vfitab = _mm_add_epi32(vfitab,ifour);
280 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
281 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
282 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
283 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
284 _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)
;
285 Heps = _mm_mul_ps(vfeps,H);
286 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
287 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
288 vvdw12 = _mm_mul_ps(c12_00,VV);
289 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
290 fvdw12 = _mm_mul_ps(c12_00,FF);
291 vvdw = _mm_add_ps(vvdw12,vvdw6);
292 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
293
294 /* Update potential sum for this i atom from the interaction with this j atom. */
295 velecsum = _mm_add_ps(velecsum,velec);
296 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
297
298 fscal = _mm_add_ps(felec,fvdw);
299
300 /* Calculate temporary vectorial force */
301 tx = _mm_mul_ps(fscal,dx00);
302 ty = _mm_mul_ps(fscal,dy00);
303 tz = _mm_mul_ps(fscal,dz00);
304
305 /* Update vectorial force */
306 fix0 = _mm_add_ps(fix0,tx);
307 fiy0 = _mm_add_ps(fiy0,ty);
308 fiz0 = _mm_add_ps(fiz0,tz);
309
310 fjx0 = _mm_add_ps(fjx0,tx);
311 fjy0 = _mm_add_ps(fjy0,ty);
312 fjz0 = _mm_add_ps(fjz0,tz);
313
314 /**************************
315 * CALCULATE INTERACTIONS *
316 **************************/
317
318 /* Compute parameters for interactions between i and j atoms */
319 qq10 = _mm_mul_ps(iq1,jq0);
320
321 /* COULOMB ELECTROSTATICS */
322 velec = _mm_mul_ps(qq10,rinv10);
323 felec = _mm_mul_ps(velec,rinvsq10);
324
325 /* Update potential sum for this i atom from the interaction with this j atom. */
326 velecsum = _mm_add_ps(velecsum,velec);
327
328 fscal = felec;
329
330 /* Calculate temporary vectorial force */
331 tx = _mm_mul_ps(fscal,dx10);
332 ty = _mm_mul_ps(fscal,dy10);
333 tz = _mm_mul_ps(fscal,dz10);
334
335 /* Update vectorial force */
336 fix1 = _mm_add_ps(fix1,tx);
337 fiy1 = _mm_add_ps(fiy1,ty);
338 fiz1 = _mm_add_ps(fiz1,tz);
339
340 fjx0 = _mm_add_ps(fjx0,tx);
341 fjy0 = _mm_add_ps(fjy0,ty);
342 fjz0 = _mm_add_ps(fjz0,tz);
343
344 /**************************
345 * CALCULATE INTERACTIONS *
346 **************************/
347
348 /* Compute parameters for interactions between i and j atoms */
349 qq20 = _mm_mul_ps(iq2,jq0);
350
351 /* COULOMB ELECTROSTATICS */
352 velec = _mm_mul_ps(qq20,rinv20);
353 felec = _mm_mul_ps(velec,rinvsq20);
354
355 /* Update potential sum for this i atom from the interaction with this j atom. */
356 velecsum = _mm_add_ps(velecsum,velec);
357
358 fscal = felec;
359
360 /* Calculate temporary vectorial force */
361 tx = _mm_mul_ps(fscal,dx20);
362 ty = _mm_mul_ps(fscal,dy20);
363 tz = _mm_mul_ps(fscal,dz20);
364
365 /* Update vectorial force */
366 fix2 = _mm_add_ps(fix2,tx);
367 fiy2 = _mm_add_ps(fiy2,ty);
368 fiz2 = _mm_add_ps(fiz2,tz);
369
370 fjx0 = _mm_add_ps(fjx0,tx);
371 fjy0 = _mm_add_ps(fjy0,ty);
372 fjz0 = _mm_add_ps(fjz0,tz);
373
374 fjptrA = f+j_coord_offsetA;
375 fjptrB = f+j_coord_offsetB;
376 fjptrC = f+j_coord_offsetC;
377 fjptrD = f+j_coord_offsetD;
378
379 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
380
381 /* Inner loop uses 119 flops */
382 }
383
384 if(jidx<j_index_end)
385 {
386
387 /* Get j neighbor index, and coordinate index */
388 jnrlistA = jjnr[jidx];
389 jnrlistB = jjnr[jidx+1];
390 jnrlistC = jjnr[jidx+2];
391 jnrlistD = jjnr[jidx+3];
392 /* Sign of each element will be negative for non-real atoms.
393 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
394 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
395 */
396 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
397 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
398 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
399 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
400 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
401 j_coord_offsetA = DIM3*jnrA;
402 j_coord_offsetB = DIM3*jnrB;
403 j_coord_offsetC = DIM3*jnrC;
404 j_coord_offsetD = DIM3*jnrD;
405
406 /* load j atom coordinates */
407 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
408 x+j_coord_offsetC,x+j_coord_offsetD,
409 &jx0,&jy0,&jz0);
410
411 /* Calculate displacement vector */
412 dx00 = _mm_sub_ps(ix0,jx0);
413 dy00 = _mm_sub_ps(iy0,jy0);
414 dz00 = _mm_sub_ps(iz0,jz0);
415 dx10 = _mm_sub_ps(ix1,jx0);
416 dy10 = _mm_sub_ps(iy1,jy0);
417 dz10 = _mm_sub_ps(iz1,jz0);
418 dx20 = _mm_sub_ps(ix2,jx0);
419 dy20 = _mm_sub_ps(iy2,jy0);
420 dz20 = _mm_sub_ps(iz2,jz0);
421
422 /* Calculate squared distance and things based on it */
423 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
424 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
425 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
426
427 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
428 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
429 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
430
431 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
432 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
433 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
434
435 /* Load parameters for j particles */
436 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
437 charge+jnrC+0,charge+jnrD+0);
438 vdwjidx0A = 2*vdwtype[jnrA+0];
439 vdwjidx0B = 2*vdwtype[jnrB+0];
440 vdwjidx0C = 2*vdwtype[jnrC+0];
441 vdwjidx0D = 2*vdwtype[jnrD+0];
442
443 fjx0 = _mm_setzero_ps();
444 fjy0 = _mm_setzero_ps();
445 fjz0 = _mm_setzero_ps();
446
447 /**************************
448 * CALCULATE INTERACTIONS *
449 **************************/
450
451 r00 = _mm_mul_ps(rsq00,rinv00);
452 r00 = _mm_andnot_ps(dummy_mask,r00);
453
454 /* Compute parameters for interactions between i and j atoms */
455 qq00 = _mm_mul_ps(iq0,jq0);
456 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
457 vdwparam+vdwioffset0+vdwjidx0B,
458 vdwparam+vdwioffset0+vdwjidx0C,
459 vdwparam+vdwioffset0+vdwjidx0D,
460 &c6_00,&c12_00);
461
462 /* Calculate table index by multiplying r with table scale and truncate to integer */
463 rt = _mm_mul_ps(r00,vftabscale);
464 vfitab = _mm_cvttps_epi32(rt);
465 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
466 vfitab = _mm_slli_epi32(vfitab,3);
467
468 /* COULOMB ELECTROSTATICS */
469 velec = _mm_mul_ps(qq00,rinv00);
470 felec = _mm_mul_ps(velec,rinvsq00);
471
472 /* CUBIC SPLINE TABLE DISPERSION */
473 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
474 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
475 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
476 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
477 _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)
;
478 Heps = _mm_mul_ps(vfeps,H);
479 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
480 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
481 vvdw6 = _mm_mul_ps(c6_00,VV);
482 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
483 fvdw6 = _mm_mul_ps(c6_00,FF);
484
485 /* CUBIC SPLINE TABLE REPULSION */
486 vfitab = _mm_add_epi32(vfitab,ifour);
487 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
488 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
489 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
490 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
491 _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)
;
492 Heps = _mm_mul_ps(vfeps,H);
493 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
494 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
495 vvdw12 = _mm_mul_ps(c12_00,VV);
496 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
497 fvdw12 = _mm_mul_ps(c12_00,FF);
498 vvdw = _mm_add_ps(vvdw12,vvdw6);
499 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
500
501 /* Update potential sum for this i atom from the interaction with this j atom. */
502 velec = _mm_andnot_ps(dummy_mask,velec);
503 velecsum = _mm_add_ps(velecsum,velec);
504 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
505 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
506
507 fscal = _mm_add_ps(felec,fvdw);
508
509 fscal = _mm_andnot_ps(dummy_mask,fscal);
510
511 /* Calculate temporary vectorial force */
512 tx = _mm_mul_ps(fscal,dx00);
513 ty = _mm_mul_ps(fscal,dy00);
514 tz = _mm_mul_ps(fscal,dz00);
515
516 /* Update vectorial force */
517 fix0 = _mm_add_ps(fix0,tx);
518 fiy0 = _mm_add_ps(fiy0,ty);
519 fiz0 = _mm_add_ps(fiz0,tz);
520
521 fjx0 = _mm_add_ps(fjx0,tx);
522 fjy0 = _mm_add_ps(fjy0,ty);
523 fjz0 = _mm_add_ps(fjz0,tz);
524
525 /**************************
526 * CALCULATE INTERACTIONS *
527 **************************/
528
529 /* Compute parameters for interactions between i and j atoms */
530 qq10 = _mm_mul_ps(iq1,jq0);
531
532 /* COULOMB ELECTROSTATICS */
533 velec = _mm_mul_ps(qq10,rinv10);
534 felec = _mm_mul_ps(velec,rinvsq10);
535
536 /* Update potential sum for this i atom from the interaction with this j atom. */
537 velec = _mm_andnot_ps(dummy_mask,velec);
538 velecsum = _mm_add_ps(velecsum,velec);
539
540 fscal = felec;
541
542 fscal = _mm_andnot_ps(dummy_mask,fscal);
543
544 /* Calculate temporary vectorial force */
545 tx = _mm_mul_ps(fscal,dx10);
546 ty = _mm_mul_ps(fscal,dy10);
547 tz = _mm_mul_ps(fscal,dz10);
548
549 /* Update vectorial force */
550 fix1 = _mm_add_ps(fix1,tx);
551 fiy1 = _mm_add_ps(fiy1,ty);
552 fiz1 = _mm_add_ps(fiz1,tz);
553
554 fjx0 = _mm_add_ps(fjx0,tx);
555 fjy0 = _mm_add_ps(fjy0,ty);
556 fjz0 = _mm_add_ps(fjz0,tz);
557
558 /**************************
559 * CALCULATE INTERACTIONS *
560 **************************/
561
562 /* Compute parameters for interactions between i and j atoms */
563 qq20 = _mm_mul_ps(iq2,jq0);
564
565 /* COULOMB ELECTROSTATICS */
566 velec = _mm_mul_ps(qq20,rinv20);
567 felec = _mm_mul_ps(velec,rinvsq20);
568
569 /* Update potential sum for this i atom from the interaction with this j atom. */
570 velec = _mm_andnot_ps(dummy_mask,velec);
571 velecsum = _mm_add_ps(velecsum,velec);
572
573 fscal = felec;
574
575 fscal = _mm_andnot_ps(dummy_mask,fscal);
576
577 /* Calculate temporary vectorial force */
578 tx = _mm_mul_ps(fscal,dx20);
579 ty = _mm_mul_ps(fscal,dy20);
580 tz = _mm_mul_ps(fscal,dz20);
581
582 /* Update vectorial force */
583 fix2 = _mm_add_ps(fix2,tx);
584 fiy2 = _mm_add_ps(fiy2,ty);
585 fiz2 = _mm_add_ps(fiz2,tz);
586
587 fjx0 = _mm_add_ps(fjx0,tx);
588 fjy0 = _mm_add_ps(fjy0,ty);
589 fjz0 = _mm_add_ps(fjz0,tz);
590
591 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
592 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
593 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
594 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
595
596 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
597
598 /* Inner loop uses 120 flops */
599 }
600
601 /* End of innermost loop */
602
603 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
604 f+i_coord_offset,fshift+i_shift_offset);
605
606 ggid = gid[iidx];
607 /* Update potential energies */
608 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
609 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
610
611 /* Increment number of inner iterations */
612 inneriter += j_index_end - j_index_start;
613
614 /* Outer loop uses 20 flops */
615 }
616
617 /* Increment number of outer iterations */
618 outeriter += nri;
619
620 /* Update outer/inner flops */
621
622 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*120)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3_VF] += outeriter*20 + inneriter
*120
;
623}
624/*
625 * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwCSTab_GeomW3P1_F_sse4_1_single
626 * Electrostatics interaction: Coulomb
627 * VdW interaction: CubicSplineTable
628 * Geometry: Water3-Particle
629 * Calculate force/pot: Force
630 */
631void
632nb_kernel_ElecCoul_VdwCSTab_GeomW3P1_F_sse4_1_single
633 (t_nblist * gmx_restrict nlist,
634 rvec * gmx_restrict xx,
635 rvec * gmx_restrict ff,
636 t_forcerec * gmx_restrict fr,
637 t_mdatoms * gmx_restrict mdatoms,
638 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
639 t_nrnb * gmx_restrict nrnb)
640{
641 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
642 * just 0 for non-waters.
643 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
644 * jnr indices corresponding to data put in the four positions in the SIMD register.
645 */
646 int i_shift_offset,i_coord_offset,outeriter,inneriter;
647 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
648 int jnrA,jnrB,jnrC,jnrD;
649 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
650 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
651 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
652 real rcutoff_scalar;
653 real *shiftvec,*fshift,*x,*f;
654 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
655 real scratch[4*DIM3];
656 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
657 int vdwioffset0;
658 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
659 int vdwioffset1;
660 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
661 int vdwioffset2;
662 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
663 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
664 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
665 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
666 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
667 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
668 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
669 real *charge;
670 int nvdwtype;
671 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
672 int *vdwtype;
673 real *vdwparam;
674 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
675 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
676 __m128i vfitab;
677 __m128i ifour = _mm_set1_epi32(4);
678 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
679 real *vftab;
680 __m128 dummy_mask,cutoff_mask;
681 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
682 __m128 one = _mm_set1_ps(1.0);
683 __m128 two = _mm_set1_ps(2.0);
684 x = xx[0];
685 f = ff[0];
686
687 nri = nlist->nri;
688 iinr = nlist->iinr;
689 jindex = nlist->jindex;
690 jjnr = nlist->jjnr;
691 shiftidx = nlist->shift;
692 gid = nlist->gid;
693 shiftvec = fr->shift_vec[0];
694 fshift = fr->fshift[0];
695 facel = _mm_set1_ps(fr->epsfac);
696 charge = mdatoms->chargeA;
697 nvdwtype = fr->ntype;
698 vdwparam = fr->nbfp;
699 vdwtype = mdatoms->typeA;
700
701 vftab = kernel_data->table_vdw->data;
702 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
703
704 /* Setup water-specific parameters */
705 inr = nlist->iinr[0];
706 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
707 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
708 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
709 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
710
711 /* Avoid stupid compiler warnings */
712 jnrA = jnrB = jnrC = jnrD = 0;
713 j_coord_offsetA = 0;
Value stored to 'j_coord_offsetA' is never read
714 j_coord_offsetB = 0;
715 j_coord_offsetC = 0;
716 j_coord_offsetD = 0;
717
718 outeriter = 0;
719 inneriter = 0;
720
721 for(iidx=0;iidx<4*DIM3;iidx++)
722 {
723 scratch[iidx] = 0.0;
724 }
725
726 /* Start outer loop over neighborlists */
727 for(iidx=0; iidx<nri; iidx++)
728 {
729 /* Load shift vector for this list */
730 i_shift_offset = DIM3*shiftidx[iidx];
731
732 /* Load limits for loop over neighbors */
733 j_index_start = jindex[iidx];
734 j_index_end = jindex[iidx+1];
735
736 /* Get outer coordinate index */
737 inr = iinr[iidx];
738 i_coord_offset = DIM3*inr;
739
740 /* Load i particle coords and add shift vector */
741 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
742 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
743
744 fix0 = _mm_setzero_ps();
745 fiy0 = _mm_setzero_ps();
746 fiz0 = _mm_setzero_ps();
747 fix1 = _mm_setzero_ps();
748 fiy1 = _mm_setzero_ps();
749 fiz1 = _mm_setzero_ps();
750 fix2 = _mm_setzero_ps();
751 fiy2 = _mm_setzero_ps();
752 fiz2 = _mm_setzero_ps();
753
754 /* Start inner kernel loop */
755 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
756 {
757
758 /* Get j neighbor index, and coordinate index */
759 jnrA = jjnr[jidx];
760 jnrB = jjnr[jidx+1];
761 jnrC = jjnr[jidx+2];
762 jnrD = jjnr[jidx+3];
763 j_coord_offsetA = DIM3*jnrA;
764 j_coord_offsetB = DIM3*jnrB;
765 j_coord_offsetC = DIM3*jnrC;
766 j_coord_offsetD = DIM3*jnrD;
767
768 /* load j atom coordinates */
769 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
770 x+j_coord_offsetC,x+j_coord_offsetD,
771 &jx0,&jy0,&jz0);
772
773 /* Calculate displacement vector */
774 dx00 = _mm_sub_ps(ix0,jx0);
775 dy00 = _mm_sub_ps(iy0,jy0);
776 dz00 = _mm_sub_ps(iz0,jz0);
777 dx10 = _mm_sub_ps(ix1,jx0);
778 dy10 = _mm_sub_ps(iy1,jy0);
779 dz10 = _mm_sub_ps(iz1,jz0);
780 dx20 = _mm_sub_ps(ix2,jx0);
781 dy20 = _mm_sub_ps(iy2,jy0);
782 dz20 = _mm_sub_ps(iz2,jz0);
783
784 /* Calculate squared distance and things based on it */
785 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
786 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
787 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
788
789 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
790 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
791 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
792
793 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
794 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
795 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
796
797 /* Load parameters for j particles */
798 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
799 charge+jnrC+0,charge+jnrD+0);
800 vdwjidx0A = 2*vdwtype[jnrA+0];
801 vdwjidx0B = 2*vdwtype[jnrB+0];
802 vdwjidx0C = 2*vdwtype[jnrC+0];
803 vdwjidx0D = 2*vdwtype[jnrD+0];
804
805 fjx0 = _mm_setzero_ps();
806 fjy0 = _mm_setzero_ps();
807 fjz0 = _mm_setzero_ps();
808
809 /**************************
810 * CALCULATE INTERACTIONS *
811 **************************/
812
813 r00 = _mm_mul_ps(rsq00,rinv00);
814
815 /* Compute parameters for interactions between i and j atoms */
816 qq00 = _mm_mul_ps(iq0,jq0);
817 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
818 vdwparam+vdwioffset0+vdwjidx0B,
819 vdwparam+vdwioffset0+vdwjidx0C,
820 vdwparam+vdwioffset0+vdwjidx0D,
821 &c6_00,&c12_00);
822
823 /* Calculate table index by multiplying r with table scale and truncate to integer */
824 rt = _mm_mul_ps(r00,vftabscale);
825 vfitab = _mm_cvttps_epi32(rt);
826 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
827 vfitab = _mm_slli_epi32(vfitab,3);
828
829 /* COULOMB ELECTROSTATICS */
830 velec = _mm_mul_ps(qq00,rinv00);
831 felec = _mm_mul_ps(velec,rinvsq00);
832
833 /* CUBIC SPLINE TABLE DISPERSION */
834 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
835 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
836 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
837 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
838 _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)
;
839 Heps = _mm_mul_ps(vfeps,H);
840 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
841 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
842 fvdw6 = _mm_mul_ps(c6_00,FF);
843
844 /* CUBIC SPLINE TABLE REPULSION */
845 vfitab = _mm_add_epi32(vfitab,ifour);
846 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
847 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
848 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
849 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
850 _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)
;
851 Heps = _mm_mul_ps(vfeps,H);
852 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
853 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
854 fvdw12 = _mm_mul_ps(c12_00,FF);
855 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
856
857 fscal = _mm_add_ps(felec,fvdw);
858
859 /* Calculate temporary vectorial force */
860 tx = _mm_mul_ps(fscal,dx00);
861 ty = _mm_mul_ps(fscal,dy00);
862 tz = _mm_mul_ps(fscal,dz00);
863
864 /* Update vectorial force */
865 fix0 = _mm_add_ps(fix0,tx);
866 fiy0 = _mm_add_ps(fiy0,ty);
867 fiz0 = _mm_add_ps(fiz0,tz);
868
869 fjx0 = _mm_add_ps(fjx0,tx);
870 fjy0 = _mm_add_ps(fjy0,ty);
871 fjz0 = _mm_add_ps(fjz0,tz);
872
873 /**************************
874 * CALCULATE INTERACTIONS *
875 **************************/
876
877 /* Compute parameters for interactions between i and j atoms */
878 qq10 = _mm_mul_ps(iq1,jq0);
879
880 /* COULOMB ELECTROSTATICS */
881 velec = _mm_mul_ps(qq10,rinv10);
882 felec = _mm_mul_ps(velec,rinvsq10);
883
884 fscal = felec;
885
886 /* Calculate temporary vectorial force */
887 tx = _mm_mul_ps(fscal,dx10);
888 ty = _mm_mul_ps(fscal,dy10);
889 tz = _mm_mul_ps(fscal,dz10);
890
891 /* Update vectorial force */
892 fix1 = _mm_add_ps(fix1,tx);
893 fiy1 = _mm_add_ps(fiy1,ty);
894 fiz1 = _mm_add_ps(fiz1,tz);
895
896 fjx0 = _mm_add_ps(fjx0,tx);
897 fjy0 = _mm_add_ps(fjy0,ty);
898 fjz0 = _mm_add_ps(fjz0,tz);
899
900 /**************************
901 * CALCULATE INTERACTIONS *
902 **************************/
903
904 /* Compute parameters for interactions between i and j atoms */
905 qq20 = _mm_mul_ps(iq2,jq0);
906
907 /* COULOMB ELECTROSTATICS */
908 velec = _mm_mul_ps(qq20,rinv20);
909 felec = _mm_mul_ps(velec,rinvsq20);
910
911 fscal = felec;
912
913 /* Calculate temporary vectorial force */
914 tx = _mm_mul_ps(fscal,dx20);
915 ty = _mm_mul_ps(fscal,dy20);
916 tz = _mm_mul_ps(fscal,dz20);
917
918 /* Update vectorial force */
919 fix2 = _mm_add_ps(fix2,tx);
920 fiy2 = _mm_add_ps(fiy2,ty);
921 fiz2 = _mm_add_ps(fiz2,tz);
922
923 fjx0 = _mm_add_ps(fjx0,tx);
924 fjy0 = _mm_add_ps(fjy0,ty);
925 fjz0 = _mm_add_ps(fjz0,tz);
926
927 fjptrA = f+j_coord_offsetA;
928 fjptrB = f+j_coord_offsetB;
929 fjptrC = f+j_coord_offsetC;
930 fjptrD = f+j_coord_offsetD;
931
932 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
933
934 /* Inner loop uses 108 flops */
935 }
936
937 if(jidx<j_index_end)
938 {
939
940 /* Get j neighbor index, and coordinate index */
941 jnrlistA = jjnr[jidx];
942 jnrlistB = jjnr[jidx+1];
943 jnrlistC = jjnr[jidx+2];
944 jnrlistD = jjnr[jidx+3];
945 /* Sign of each element will be negative for non-real atoms.
946 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
947 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
948 */
949 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
950 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
951 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
952 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
953 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
954 j_coord_offsetA = DIM3*jnrA;
955 j_coord_offsetB = DIM3*jnrB;
956 j_coord_offsetC = DIM3*jnrC;
957 j_coord_offsetD = DIM3*jnrD;
958
959 /* load j atom coordinates */
960 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
961 x+j_coord_offsetC,x+j_coord_offsetD,
962 &jx0,&jy0,&jz0);
963
964 /* Calculate displacement vector */
965 dx00 = _mm_sub_ps(ix0,jx0);
966 dy00 = _mm_sub_ps(iy0,jy0);
967 dz00 = _mm_sub_ps(iz0,jz0);
968 dx10 = _mm_sub_ps(ix1,jx0);
969 dy10 = _mm_sub_ps(iy1,jy0);
970 dz10 = _mm_sub_ps(iz1,jz0);
971 dx20 = _mm_sub_ps(ix2,jx0);
972 dy20 = _mm_sub_ps(iy2,jy0);
973 dz20 = _mm_sub_ps(iz2,jz0);
974
975 /* Calculate squared distance and things based on it */
976 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
977 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
978 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
979
980 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
981 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
982 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
983
984 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
985 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
986 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
987
988 /* Load parameters for j particles */
989 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
990 charge+jnrC+0,charge+jnrD+0);
991 vdwjidx0A = 2*vdwtype[jnrA+0];
992 vdwjidx0B = 2*vdwtype[jnrB+0];
993 vdwjidx0C = 2*vdwtype[jnrC+0];
994 vdwjidx0D = 2*vdwtype[jnrD+0];
995
996 fjx0 = _mm_setzero_ps();
997 fjy0 = _mm_setzero_ps();
998 fjz0 = _mm_setzero_ps();
999
1000 /**************************
1001 * CALCULATE INTERACTIONS *
1002 **************************/
1003
1004 r00 = _mm_mul_ps(rsq00,rinv00);
1005 r00 = _mm_andnot_ps(dummy_mask,r00);
1006
1007 /* Compute parameters for interactions between i and j atoms */
1008 qq00 = _mm_mul_ps(iq0,jq0);
1009 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
1010 vdwparam+vdwioffset0+vdwjidx0B,
1011 vdwparam+vdwioffset0+vdwjidx0C,
1012 vdwparam+vdwioffset0+vdwjidx0D,
1013 &c6_00,&c12_00);
1014
1015 /* Calculate table index by multiplying r with table scale and truncate to integer */
1016 rt = _mm_mul_ps(r00,vftabscale);
1017 vfitab = _mm_cvttps_epi32(rt);
1018 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1019 vfitab = _mm_slli_epi32(vfitab,3);
1020
1021 /* COULOMB ELECTROSTATICS */
1022 velec = _mm_mul_ps(qq00,rinv00);
1023 felec = _mm_mul_ps(velec,rinvsq00);
1024
1025 /* CUBIC SPLINE TABLE DISPERSION */
1026 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1027 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1028 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1029 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1030 _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)
;
1031 Heps = _mm_mul_ps(vfeps,H);
1032 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1033 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1034 fvdw6 = _mm_mul_ps(c6_00,FF);
1035
1036 /* CUBIC SPLINE TABLE REPULSION */
1037 vfitab = _mm_add_epi32(vfitab,ifour);
1038 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1039 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1040 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1041 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1042 _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)
;
1043 Heps = _mm_mul_ps(vfeps,H);
1044 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1045 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1046 fvdw12 = _mm_mul_ps(c12_00,FF);
1047 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1048
1049 fscal = _mm_add_ps(felec,fvdw);
1050
1051 fscal = _mm_andnot_ps(dummy_mask,fscal);
1052
1053 /* Calculate temporary vectorial force */
1054 tx = _mm_mul_ps(fscal,dx00);
1055 ty = _mm_mul_ps(fscal,dy00);
1056 tz = _mm_mul_ps(fscal,dz00);
1057
1058 /* Update vectorial force */
1059 fix0 = _mm_add_ps(fix0,tx);
1060 fiy0 = _mm_add_ps(fiy0,ty);
1061 fiz0 = _mm_add_ps(fiz0,tz);
1062
1063 fjx0 = _mm_add_ps(fjx0,tx);
1064 fjy0 = _mm_add_ps(fjy0,ty);
1065 fjz0 = _mm_add_ps(fjz0,tz);
1066
1067 /**************************
1068 * CALCULATE INTERACTIONS *
1069 **************************/
1070
1071 /* Compute parameters for interactions between i and j atoms */
1072 qq10 = _mm_mul_ps(iq1,jq0);
1073
1074 /* COULOMB ELECTROSTATICS */
1075 velec = _mm_mul_ps(qq10,rinv10);
1076 felec = _mm_mul_ps(velec,rinvsq10);
1077
1078 fscal = felec;
1079
1080 fscal = _mm_andnot_ps(dummy_mask,fscal);
1081
1082 /* Calculate temporary vectorial force */
1083 tx = _mm_mul_ps(fscal,dx10);
1084 ty = _mm_mul_ps(fscal,dy10);
1085 tz = _mm_mul_ps(fscal,dz10);
1086
1087 /* Update vectorial force */
1088 fix1 = _mm_add_ps(fix1,tx);
1089 fiy1 = _mm_add_ps(fiy1,ty);
1090 fiz1 = _mm_add_ps(fiz1,tz);
1091
1092 fjx0 = _mm_add_ps(fjx0,tx);
1093 fjy0 = _mm_add_ps(fjy0,ty);
1094 fjz0 = _mm_add_ps(fjz0,tz);
1095
1096 /**************************
1097 * CALCULATE INTERACTIONS *
1098 **************************/
1099
1100 /* Compute parameters for interactions between i and j atoms */
1101 qq20 = _mm_mul_ps(iq2,jq0);
1102
1103 /* COULOMB ELECTROSTATICS */
1104 velec = _mm_mul_ps(qq20,rinv20);
1105 felec = _mm_mul_ps(velec,rinvsq20);
1106
1107 fscal = felec;
1108
1109 fscal = _mm_andnot_ps(dummy_mask,fscal);
1110
1111 /* Calculate temporary vectorial force */
1112 tx = _mm_mul_ps(fscal,dx20);
1113 ty = _mm_mul_ps(fscal,dy20);
1114 tz = _mm_mul_ps(fscal,dz20);
1115
1116 /* Update vectorial force */
1117 fix2 = _mm_add_ps(fix2,tx);
1118 fiy2 = _mm_add_ps(fiy2,ty);
1119 fiz2 = _mm_add_ps(fiz2,tz);
1120
1121 fjx0 = _mm_add_ps(fjx0,tx);
1122 fjy0 = _mm_add_ps(fjy0,ty);
1123 fjz0 = _mm_add_ps(fjz0,tz);
1124
1125 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1126 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1127 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1128 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1129
1130 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1131
1132 /* Inner loop uses 109 flops */
1133 }
1134
1135 /* End of innermost loop */
1136
1137 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1138 f+i_coord_offset,fshift+i_shift_offset);
1139
1140 /* Increment number of inner iterations */
1141 inneriter += j_index_end - j_index_start;
1142
1143 /* Outer loop uses 18 flops */
1144 }
1145
1146 /* Increment number of outer iterations */
1147 outeriter += nri;
1148
1149 /* Update outer/inner flops */
1150
1151 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*109)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3_F] += outeriter*18 + inneriter
*109
;
1152}