Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecEwSw_VdwLJSw_GeomP1P1_sse4_1_single.c
Location:line 147, column 5
Description:Value stored to 'jnrA' 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_ElecEwSw_VdwLJSw_GeomP1P1_VF_sse4_1_single
54 * Electrostatics interaction: Ewald
55 * VdW interaction: LennardJones
56 * Geometry: Particle-Particle
57 * Calculate force/pot: PotentialAndForce
58 */
59void
60nb_kernel_ElecEwSw_VdwLJSw_GeomP1P1_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 vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
88 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
89 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
90 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
91 real *charge;
92 int nvdwtype;
93 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
94 int *vdwtype;
95 real *vdwparam;
96 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
97 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
98 __m128i ewitab;
99 __m128 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
100 real *ewtab;
101 __m128 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
102 real rswitch_scalar,d_scalar;
103 __m128 dummy_mask,cutoff_mask;
104 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
105 __m128 one = _mm_set1_ps(1.0);
106 __m128 two = _mm_set1_ps(2.0);
107 x = xx[0];
108 f = ff[0];
109
110 nri = nlist->nri;
111 iinr = nlist->iinr;
112 jindex = nlist->jindex;
113 jjnr = nlist->jjnr;
114 shiftidx = nlist->shift;
115 gid = nlist->gid;
116 shiftvec = fr->shift_vec[0];
117 fshift = fr->fshift[0];
118 facel = _mm_set1_ps(fr->epsfac);
119 charge = mdatoms->chargeA;
120 nvdwtype = fr->ntype;
121 vdwparam = fr->nbfp;
122 vdwtype = mdatoms->typeA;
123
124 sh_ewald = _mm_set1_ps(fr->ic->sh_ewald);
125 ewtab = fr->ic->tabq_coul_FDV0;
126 ewtabscale = _mm_set1_ps(fr->ic->tabq_scale);
127 ewtabhalfspace = _mm_set1_ps(0.5/fr->ic->tabq_scale);
128
129 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
130 rcutoff_scalar = fr->rcoulomb;
131 rcutoff = _mm_set1_ps(rcutoff_scalar);
132 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
133
134 rswitch_scalar = fr->rcoulomb_switch;
135 rswitch = _mm_set1_ps(rswitch_scalar);
136 /* Setup switch parameters */
137 d_scalar = rcutoff_scalar-rswitch_scalar;
138 d = _mm_set1_ps(d_scalar);
139 swV3 = _mm_set1_ps(-10.0/(d_scalar*d_scalar*d_scalar));
140 swV4 = _mm_set1_ps( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
141 swV5 = _mm_set1_ps( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
142 swF2 = _mm_set1_ps(-30.0/(d_scalar*d_scalar*d_scalar));
143 swF3 = _mm_set1_ps( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
144 swF4 = _mm_set1_ps(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
145
146 /* Avoid stupid compiler warnings */
147 jnrA = jnrB = jnrC = jnrD = 0;
Value stored to 'jnrA' is never read
148 j_coord_offsetA = 0;
149 j_coord_offsetB = 0;
150 j_coord_offsetC = 0;
151 j_coord_offsetD = 0;
152
153 outeriter = 0;
154 inneriter = 0;
155
156 for(iidx=0;iidx<4*DIM3;iidx++)
157 {
158 scratch[iidx] = 0.0;
159 }
160
161 /* Start outer loop over neighborlists */
162 for(iidx=0; iidx<nri; iidx++)
163 {
164 /* Load shift vector for this list */
165 i_shift_offset = DIM3*shiftidx[iidx];
166
167 /* Load limits for loop over neighbors */
168 j_index_start = jindex[iidx];
169 j_index_end = jindex[iidx+1];
170
171 /* Get outer coordinate index */
172 inr = iinr[iidx];
173 i_coord_offset = DIM3*inr;
174
175 /* Load i particle coords and add shift vector */
176 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
177
178 fix0 = _mm_setzero_ps();
179 fiy0 = _mm_setzero_ps();
180 fiz0 = _mm_setzero_ps();
181
182 /* Load parameters for i particles */
183 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
184 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
185
186 /* Reset potential sums */
187 velecsum = _mm_setzero_ps();
188 vvdwsum = _mm_setzero_ps();
189
190 /* Start inner kernel loop */
191 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
192 {
193
194 /* Get j neighbor index, and coordinate index */
195 jnrA = jjnr[jidx];
196 jnrB = jjnr[jidx+1];
197 jnrC = jjnr[jidx+2];
198 jnrD = jjnr[jidx+3];
199 j_coord_offsetA = DIM3*jnrA;
200 j_coord_offsetB = DIM3*jnrB;
201 j_coord_offsetC = DIM3*jnrC;
202 j_coord_offsetD = DIM3*jnrD;
203
204 /* load j atom coordinates */
205 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
206 x+j_coord_offsetC,x+j_coord_offsetD,
207 &jx0,&jy0,&jz0);
208
209 /* Calculate displacement vector */
210 dx00 = _mm_sub_ps(ix0,jx0);
211 dy00 = _mm_sub_ps(iy0,jy0);
212 dz00 = _mm_sub_ps(iz0,jz0);
213
214 /* Calculate squared distance and things based on it */
215 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
216
217 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
218
219 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
220
221 /* Load parameters for j particles */
222 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
223 charge+jnrC+0,charge+jnrD+0);
224 vdwjidx0A = 2*vdwtype[jnrA+0];
225 vdwjidx0B = 2*vdwtype[jnrB+0];
226 vdwjidx0C = 2*vdwtype[jnrC+0];
227 vdwjidx0D = 2*vdwtype[jnrD+0];
228
229 /**************************
230 * CALCULATE INTERACTIONS *
231 **************************/
232
233 if (gmx_mm_any_lt(rsq00,rcutoff2))
234 {
235
236 r00 = _mm_mul_ps(rsq00,rinv00);
237
238 /* Compute parameters for interactions between i and j atoms */
239 qq00 = _mm_mul_ps(iq0,jq0);
240 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
241 vdwparam+vdwioffset0+vdwjidx0B,
242 vdwparam+vdwioffset0+vdwjidx0C,
243 vdwparam+vdwioffset0+vdwjidx0D,
244 &c6_00,&c12_00);
245
246 /* EWALD ELECTROSTATICS */
247
248 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
249 ewrt = _mm_mul_ps(r00,ewtabscale);
250 ewitab = _mm_cvttps_epi32(ewrt);
251 eweps = _mm_sub_ps(ewrt,_mm_round_ps(ewrt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (ewrt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
252 ewitab = _mm_slli_epi32(ewitab,2);
253 ewtabF = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,0)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(0) &
3];}))
);
254 ewtabD = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,1)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(1) &
3];}))
);
255 ewtabV = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,2)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(2) &
3];}))
);
256 ewtabFn = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,3)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(3) &
3];}))
);
257 _MM_TRANSPOSE4_PS(ewtabF,ewtabD,ewtabV,ewtabFn)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((ewtabF
), (ewtabD)); tmp2 = _mm_unpacklo_ps((ewtabV), (ewtabFn)); tmp1
= _mm_unpackhi_ps((ewtabF), (ewtabD)); tmp3 = _mm_unpackhi_ps
((ewtabV), (ewtabFn)); (ewtabF) = _mm_movelh_ps(tmp0, tmp2); (
ewtabD) = _mm_movehl_ps(tmp2, tmp0); (ewtabV) = _mm_movelh_ps
(tmp1, tmp3); (ewtabFn) = _mm_movehl_ps(tmp3, tmp1); } while (
0)
;
258 felec = _mm_add_ps(ewtabF,_mm_mul_ps(eweps,ewtabD));
259 velec = _mm_sub_ps(ewtabV,_mm_mul_ps(_mm_mul_ps(ewtabhalfspace,eweps),_mm_add_ps(ewtabF,felec)));
260 velec = _mm_mul_ps(qq00,_mm_sub_ps(rinv00,velec));
261 felec = _mm_mul_ps(_mm_mul_ps(qq00,rinv00),_mm_sub_ps(rinvsq00,felec));
262
263 /* LENNARD-JONES DISPERSION/REPULSION */
264
265 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
266 vvdw6 = _mm_mul_ps(c6_00,rinvsix);
267 vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix));
268 vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) );
269 fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00);
270
271 d = _mm_sub_ps(r00,rswitch);
272 d = _mm_max_ps(d,_mm_setzero_ps());
273 d2 = _mm_mul_ps(d,d);
274 sw = _mm_add_ps(one,_mm_mul_ps(d2,_mm_mul_ps(d,_mm_add_ps(swV3,_mm_mul_ps(d,_mm_add_ps(swV4,_mm_mul_ps(d,swV5)))))));
275
276 dsw = _mm_mul_ps(d2,_mm_add_ps(swF2,_mm_mul_ps(d,_mm_add_ps(swF3,_mm_mul_ps(d,swF4)))));
277
278 /* Evaluate switch function */
279 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
280 felec = _mm_sub_ps( _mm_mul_ps(felec,sw) , _mm_mul_ps(rinv00,_mm_mul_ps(velec,dsw)) );
281 fvdw = _mm_sub_ps( _mm_mul_ps(fvdw,sw) , _mm_mul_ps(rinv00,_mm_mul_ps(vvdw,dsw)) );
282 velec = _mm_mul_ps(velec,sw);
283 vvdw = _mm_mul_ps(vvdw,sw);
284 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
285
286 /* Update potential sum for this i atom from the interaction with this j atom. */
287 velec = _mm_and_ps(velec,cutoff_mask);
288 velecsum = _mm_add_ps(velecsum,velec);
289 vvdw = _mm_and_ps(vvdw,cutoff_mask);
290 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
291
292 fscal = _mm_add_ps(felec,fvdw);
293
294 fscal = _mm_and_ps(fscal,cutoff_mask);
295
296 /* Calculate temporary vectorial force */
297 tx = _mm_mul_ps(fscal,dx00);
298 ty = _mm_mul_ps(fscal,dy00);
299 tz = _mm_mul_ps(fscal,dz00);
300
301 /* Update vectorial force */
302 fix0 = _mm_add_ps(fix0,tx);
303 fiy0 = _mm_add_ps(fiy0,ty);
304 fiz0 = _mm_add_ps(fiz0,tz);
305
306 fjptrA = f+j_coord_offsetA;
307 fjptrB = f+j_coord_offsetB;
308 fjptrC = f+j_coord_offsetC;
309 fjptrD = f+j_coord_offsetD;
310 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
311
312 }
313
314 /* Inner loop uses 83 flops */
315 }
316
317 if(jidx<j_index_end)
318 {
319
320 /* Get j neighbor index, and coordinate index */
321 jnrlistA = jjnr[jidx];
322 jnrlistB = jjnr[jidx+1];
323 jnrlistC = jjnr[jidx+2];
324 jnrlistD = jjnr[jidx+3];
325 /* Sign of each element will be negative for non-real atoms.
326 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
327 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
328 */
329 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
330 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
331 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
332 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
333 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
334 j_coord_offsetA = DIM3*jnrA;
335 j_coord_offsetB = DIM3*jnrB;
336 j_coord_offsetC = DIM3*jnrC;
337 j_coord_offsetD = DIM3*jnrD;
338
339 /* load j atom coordinates */
340 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
341 x+j_coord_offsetC,x+j_coord_offsetD,
342 &jx0,&jy0,&jz0);
343
344 /* Calculate displacement vector */
345 dx00 = _mm_sub_ps(ix0,jx0);
346 dy00 = _mm_sub_ps(iy0,jy0);
347 dz00 = _mm_sub_ps(iz0,jz0);
348
349 /* Calculate squared distance and things based on it */
350 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
351
352 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
353
354 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
355
356 /* Load parameters for j particles */
357 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
358 charge+jnrC+0,charge+jnrD+0);
359 vdwjidx0A = 2*vdwtype[jnrA+0];
360 vdwjidx0B = 2*vdwtype[jnrB+0];
361 vdwjidx0C = 2*vdwtype[jnrC+0];
362 vdwjidx0D = 2*vdwtype[jnrD+0];
363
364 /**************************
365 * CALCULATE INTERACTIONS *
366 **************************/
367
368 if (gmx_mm_any_lt(rsq00,rcutoff2))
369 {
370
371 r00 = _mm_mul_ps(rsq00,rinv00);
372 r00 = _mm_andnot_ps(dummy_mask,r00);
373
374 /* Compute parameters for interactions between i and j atoms */
375 qq00 = _mm_mul_ps(iq0,jq0);
376 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
377 vdwparam+vdwioffset0+vdwjidx0B,
378 vdwparam+vdwioffset0+vdwjidx0C,
379 vdwparam+vdwioffset0+vdwjidx0D,
380 &c6_00,&c12_00);
381
382 /* EWALD ELECTROSTATICS */
383
384 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
385 ewrt = _mm_mul_ps(r00,ewtabscale);
386 ewitab = _mm_cvttps_epi32(ewrt);
387 eweps = _mm_sub_ps(ewrt,_mm_round_ps(ewrt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (ewrt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
388 ewitab = _mm_slli_epi32(ewitab,2);
389 ewtabF = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,0)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(0) &
3];}))
);
390 ewtabD = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,1)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(1) &
3];}))
);
391 ewtabV = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,2)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(2) &
3];}))
);
392 ewtabFn = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,3)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(3) &
3];}))
);
393 _MM_TRANSPOSE4_PS(ewtabF,ewtabD,ewtabV,ewtabFn)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((ewtabF
), (ewtabD)); tmp2 = _mm_unpacklo_ps((ewtabV), (ewtabFn)); tmp1
= _mm_unpackhi_ps((ewtabF), (ewtabD)); tmp3 = _mm_unpackhi_ps
((ewtabV), (ewtabFn)); (ewtabF) = _mm_movelh_ps(tmp0, tmp2); (
ewtabD) = _mm_movehl_ps(tmp2, tmp0); (ewtabV) = _mm_movelh_ps
(tmp1, tmp3); (ewtabFn) = _mm_movehl_ps(tmp3, tmp1); } while (
0)
;
394 felec = _mm_add_ps(ewtabF,_mm_mul_ps(eweps,ewtabD));
395 velec = _mm_sub_ps(ewtabV,_mm_mul_ps(_mm_mul_ps(ewtabhalfspace,eweps),_mm_add_ps(ewtabF,felec)));
396 velec = _mm_mul_ps(qq00,_mm_sub_ps(rinv00,velec));
397 felec = _mm_mul_ps(_mm_mul_ps(qq00,rinv00),_mm_sub_ps(rinvsq00,felec));
398
399 /* LENNARD-JONES DISPERSION/REPULSION */
400
401 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
402 vvdw6 = _mm_mul_ps(c6_00,rinvsix);
403 vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix));
404 vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) );
405 fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00);
406
407 d = _mm_sub_ps(r00,rswitch);
408 d = _mm_max_ps(d,_mm_setzero_ps());
409 d2 = _mm_mul_ps(d,d);
410 sw = _mm_add_ps(one,_mm_mul_ps(d2,_mm_mul_ps(d,_mm_add_ps(swV3,_mm_mul_ps(d,_mm_add_ps(swV4,_mm_mul_ps(d,swV5)))))));
411
412 dsw = _mm_mul_ps(d2,_mm_add_ps(swF2,_mm_mul_ps(d,_mm_add_ps(swF3,_mm_mul_ps(d,swF4)))));
413
414 /* Evaluate switch function */
415 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
416 felec = _mm_sub_ps( _mm_mul_ps(felec,sw) , _mm_mul_ps(rinv00,_mm_mul_ps(velec,dsw)) );
417 fvdw = _mm_sub_ps( _mm_mul_ps(fvdw,sw) , _mm_mul_ps(rinv00,_mm_mul_ps(vvdw,dsw)) );
418 velec = _mm_mul_ps(velec,sw);
419 vvdw = _mm_mul_ps(vvdw,sw);
420 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
421
422 /* Update potential sum for this i atom from the interaction with this j atom. */
423 velec = _mm_and_ps(velec,cutoff_mask);
424 velec = _mm_andnot_ps(dummy_mask,velec);
425 velecsum = _mm_add_ps(velecsum,velec);
426 vvdw = _mm_and_ps(vvdw,cutoff_mask);
427 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
428 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
429
430 fscal = _mm_add_ps(felec,fvdw);
431
432 fscal = _mm_and_ps(fscal,cutoff_mask);
433
434 fscal = _mm_andnot_ps(dummy_mask,fscal);
435
436 /* Calculate temporary vectorial force */
437 tx = _mm_mul_ps(fscal,dx00);
438 ty = _mm_mul_ps(fscal,dy00);
439 tz = _mm_mul_ps(fscal,dz00);
440
441 /* Update vectorial force */
442 fix0 = _mm_add_ps(fix0,tx);
443 fiy0 = _mm_add_ps(fiy0,ty);
444 fiz0 = _mm_add_ps(fiz0,tz);
445
446 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
447 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
448 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
449 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
450 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
451
452 }
453
454 /* Inner loop uses 84 flops */
455 }
456
457 /* End of innermost loop */
458
459 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
460 f+i_coord_offset,fshift+i_shift_offset);
461
462 ggid = gid[iidx];
463 /* Update potential energies */
464 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
465 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
466
467 /* Increment number of inner iterations */
468 inneriter += j_index_end - j_index_start;
469
470 /* Outer loop uses 9 flops */
471 }
472
473 /* Increment number of outer iterations */
474 outeriter += nri;
475
476 /* Update outer/inner flops */
477
478 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*84)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_VF] += outeriter*9 + inneriter
*84
;
479}
480/*
481 * Gromacs nonbonded kernel: nb_kernel_ElecEwSw_VdwLJSw_GeomP1P1_F_sse4_1_single
482 * Electrostatics interaction: Ewald
483 * VdW interaction: LennardJones
484 * Geometry: Particle-Particle
485 * Calculate force/pot: Force
486 */
487void
488nb_kernel_ElecEwSw_VdwLJSw_GeomP1P1_F_sse4_1_single
489 (t_nblist * gmx_restrict nlist,
490 rvec * gmx_restrict xx,
491 rvec * gmx_restrict ff,
492 t_forcerec * gmx_restrict fr,
493 t_mdatoms * gmx_restrict mdatoms,
494 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
495 t_nrnb * gmx_restrict nrnb)
496{
497 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
498 * just 0 for non-waters.
499 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
500 * jnr indices corresponding to data put in the four positions in the SIMD register.
501 */
502 int i_shift_offset,i_coord_offset,outeriter,inneriter;
503 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
504 int jnrA,jnrB,jnrC,jnrD;
505 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
506 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
507 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
508 real rcutoff_scalar;
509 real *shiftvec,*fshift,*x,*f;
510 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
511 real scratch[4*DIM3];
512 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
513 int vdwioffset0;
514 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
515 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
516 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
517 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
518 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
519 real *charge;
520 int nvdwtype;
521 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
522 int *vdwtype;
523 real *vdwparam;
524 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
525 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
526 __m128i ewitab;
527 __m128 ewtabscale,eweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
528 real *ewtab;
529 __m128 rswitch,swV3,swV4,swV5,swF2,swF3,swF4,d,d2,sw,dsw;
530 real rswitch_scalar,d_scalar;
531 __m128 dummy_mask,cutoff_mask;
532 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
533 __m128 one = _mm_set1_ps(1.0);
534 __m128 two = _mm_set1_ps(2.0);
535 x = xx[0];
536 f = ff[0];
537
538 nri = nlist->nri;
539 iinr = nlist->iinr;
540 jindex = nlist->jindex;
541 jjnr = nlist->jjnr;
542 shiftidx = nlist->shift;
543 gid = nlist->gid;
544 shiftvec = fr->shift_vec[0];
545 fshift = fr->fshift[0];
546 facel = _mm_set1_ps(fr->epsfac);
547 charge = mdatoms->chargeA;
548 nvdwtype = fr->ntype;
549 vdwparam = fr->nbfp;
550 vdwtype = mdatoms->typeA;
551
552 sh_ewald = _mm_set1_ps(fr->ic->sh_ewald);
553 ewtab = fr->ic->tabq_coul_FDV0;
554 ewtabscale = _mm_set1_ps(fr->ic->tabq_scale);
555 ewtabhalfspace = _mm_set1_ps(0.5/fr->ic->tabq_scale);
556
557 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
558 rcutoff_scalar = fr->rcoulomb;
559 rcutoff = _mm_set1_ps(rcutoff_scalar);
560 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
561
562 rswitch_scalar = fr->rcoulomb_switch;
563 rswitch = _mm_set1_ps(rswitch_scalar);
564 /* Setup switch parameters */
565 d_scalar = rcutoff_scalar-rswitch_scalar;
566 d = _mm_set1_ps(d_scalar);
567 swV3 = _mm_set1_ps(-10.0/(d_scalar*d_scalar*d_scalar));
568 swV4 = _mm_set1_ps( 15.0/(d_scalar*d_scalar*d_scalar*d_scalar));
569 swV5 = _mm_set1_ps( -6.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
570 swF2 = _mm_set1_ps(-30.0/(d_scalar*d_scalar*d_scalar));
571 swF3 = _mm_set1_ps( 60.0/(d_scalar*d_scalar*d_scalar*d_scalar));
572 swF4 = _mm_set1_ps(-30.0/(d_scalar*d_scalar*d_scalar*d_scalar*d_scalar));
573
574 /* Avoid stupid compiler warnings */
575 jnrA = jnrB = jnrC = jnrD = 0;
576 j_coord_offsetA = 0;
577 j_coord_offsetB = 0;
578 j_coord_offsetC = 0;
579 j_coord_offsetD = 0;
580
581 outeriter = 0;
582 inneriter = 0;
583
584 for(iidx=0;iidx<4*DIM3;iidx++)
585 {
586 scratch[iidx] = 0.0;
587 }
588
589 /* Start outer loop over neighborlists */
590 for(iidx=0; iidx<nri; iidx++)
591 {
592 /* Load shift vector for this list */
593 i_shift_offset = DIM3*shiftidx[iidx];
594
595 /* Load limits for loop over neighbors */
596 j_index_start = jindex[iidx];
597 j_index_end = jindex[iidx+1];
598
599 /* Get outer coordinate index */
600 inr = iinr[iidx];
601 i_coord_offset = DIM3*inr;
602
603 /* Load i particle coords and add shift vector */
604 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
605
606 fix0 = _mm_setzero_ps();
607 fiy0 = _mm_setzero_ps();
608 fiz0 = _mm_setzero_ps();
609
610 /* Load parameters for i particles */
611 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
612 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
613
614 /* Start inner kernel loop */
615 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
616 {
617
618 /* Get j neighbor index, and coordinate index */
619 jnrA = jjnr[jidx];
620 jnrB = jjnr[jidx+1];
621 jnrC = jjnr[jidx+2];
622 jnrD = jjnr[jidx+3];
623 j_coord_offsetA = DIM3*jnrA;
624 j_coord_offsetB = DIM3*jnrB;
625 j_coord_offsetC = DIM3*jnrC;
626 j_coord_offsetD = DIM3*jnrD;
627
628 /* load j atom coordinates */
629 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
630 x+j_coord_offsetC,x+j_coord_offsetD,
631 &jx0,&jy0,&jz0);
632
633 /* Calculate displacement vector */
634 dx00 = _mm_sub_ps(ix0,jx0);
635 dy00 = _mm_sub_ps(iy0,jy0);
636 dz00 = _mm_sub_ps(iz0,jz0);
637
638 /* Calculate squared distance and things based on it */
639 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
640
641 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
642
643 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
644
645 /* Load parameters for j particles */
646 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
647 charge+jnrC+0,charge+jnrD+0);
648 vdwjidx0A = 2*vdwtype[jnrA+0];
649 vdwjidx0B = 2*vdwtype[jnrB+0];
650 vdwjidx0C = 2*vdwtype[jnrC+0];
651 vdwjidx0D = 2*vdwtype[jnrD+0];
652
653 /**************************
654 * CALCULATE INTERACTIONS *
655 **************************/
656
657 if (gmx_mm_any_lt(rsq00,rcutoff2))
658 {
659
660 r00 = _mm_mul_ps(rsq00,rinv00);
661
662 /* Compute parameters for interactions between i and j atoms */
663 qq00 = _mm_mul_ps(iq0,jq0);
664 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
665 vdwparam+vdwioffset0+vdwjidx0B,
666 vdwparam+vdwioffset0+vdwjidx0C,
667 vdwparam+vdwioffset0+vdwjidx0D,
668 &c6_00,&c12_00);
669
670 /* EWALD ELECTROSTATICS */
671
672 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
673 ewrt = _mm_mul_ps(r00,ewtabscale);
674 ewitab = _mm_cvttps_epi32(ewrt);
675 eweps = _mm_sub_ps(ewrt,_mm_round_ps(ewrt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (ewrt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
676 ewitab = _mm_slli_epi32(ewitab,2);
677 ewtabF = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,0)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(0) &
3];}))
);
678 ewtabD = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,1)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(1) &
3];}))
);
679 ewtabV = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,2)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(2) &
3];}))
);
680 ewtabFn = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,3)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(3) &
3];}))
);
681 _MM_TRANSPOSE4_PS(ewtabF,ewtabD,ewtabV,ewtabFn)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((ewtabF
), (ewtabD)); tmp2 = _mm_unpacklo_ps((ewtabV), (ewtabFn)); tmp1
= _mm_unpackhi_ps((ewtabF), (ewtabD)); tmp3 = _mm_unpackhi_ps
((ewtabV), (ewtabFn)); (ewtabF) = _mm_movelh_ps(tmp0, tmp2); (
ewtabD) = _mm_movehl_ps(tmp2, tmp0); (ewtabV) = _mm_movelh_ps
(tmp1, tmp3); (ewtabFn) = _mm_movehl_ps(tmp3, tmp1); } while (
0)
;
682 felec = _mm_add_ps(ewtabF,_mm_mul_ps(eweps,ewtabD));
683 velec = _mm_sub_ps(ewtabV,_mm_mul_ps(_mm_mul_ps(ewtabhalfspace,eweps),_mm_add_ps(ewtabF,felec)));
684 velec = _mm_mul_ps(qq00,_mm_sub_ps(rinv00,velec));
685 felec = _mm_mul_ps(_mm_mul_ps(qq00,rinv00),_mm_sub_ps(rinvsq00,felec));
686
687 /* LENNARD-JONES DISPERSION/REPULSION */
688
689 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
690 vvdw6 = _mm_mul_ps(c6_00,rinvsix);
691 vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix));
692 vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) );
693 fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00);
694
695 d = _mm_sub_ps(r00,rswitch);
696 d = _mm_max_ps(d,_mm_setzero_ps());
697 d2 = _mm_mul_ps(d,d);
698 sw = _mm_add_ps(one,_mm_mul_ps(d2,_mm_mul_ps(d,_mm_add_ps(swV3,_mm_mul_ps(d,_mm_add_ps(swV4,_mm_mul_ps(d,swV5)))))));
699
700 dsw = _mm_mul_ps(d2,_mm_add_ps(swF2,_mm_mul_ps(d,_mm_add_ps(swF3,_mm_mul_ps(d,swF4)))));
701
702 /* Evaluate switch function */
703 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
704 felec = _mm_sub_ps( _mm_mul_ps(felec,sw) , _mm_mul_ps(rinv00,_mm_mul_ps(velec,dsw)) );
705 fvdw = _mm_sub_ps( _mm_mul_ps(fvdw,sw) , _mm_mul_ps(rinv00,_mm_mul_ps(vvdw,dsw)) );
706 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
707
708 fscal = _mm_add_ps(felec,fvdw);
709
710 fscal = _mm_and_ps(fscal,cutoff_mask);
711
712 /* Calculate temporary vectorial force */
713 tx = _mm_mul_ps(fscal,dx00);
714 ty = _mm_mul_ps(fscal,dy00);
715 tz = _mm_mul_ps(fscal,dz00);
716
717 /* Update vectorial force */
718 fix0 = _mm_add_ps(fix0,tx);
719 fiy0 = _mm_add_ps(fiy0,ty);
720 fiz0 = _mm_add_ps(fiz0,tz);
721
722 fjptrA = f+j_coord_offsetA;
723 fjptrB = f+j_coord_offsetB;
724 fjptrC = f+j_coord_offsetC;
725 fjptrD = f+j_coord_offsetD;
726 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
727
728 }
729
730 /* Inner loop uses 77 flops */
731 }
732
733 if(jidx<j_index_end)
734 {
735
736 /* Get j neighbor index, and coordinate index */
737 jnrlistA = jjnr[jidx];
738 jnrlistB = jjnr[jidx+1];
739 jnrlistC = jjnr[jidx+2];
740 jnrlistD = jjnr[jidx+3];
741 /* Sign of each element will be negative for non-real atoms.
742 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
743 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
744 */
745 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
746 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
747 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
748 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
749 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
750 j_coord_offsetA = DIM3*jnrA;
751 j_coord_offsetB = DIM3*jnrB;
752 j_coord_offsetC = DIM3*jnrC;
753 j_coord_offsetD = DIM3*jnrD;
754
755 /* load j atom coordinates */
756 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
757 x+j_coord_offsetC,x+j_coord_offsetD,
758 &jx0,&jy0,&jz0);
759
760 /* Calculate displacement vector */
761 dx00 = _mm_sub_ps(ix0,jx0);
762 dy00 = _mm_sub_ps(iy0,jy0);
763 dz00 = _mm_sub_ps(iz0,jz0);
764
765 /* Calculate squared distance and things based on it */
766 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
767
768 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
769
770 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
771
772 /* Load parameters for j particles */
773 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
774 charge+jnrC+0,charge+jnrD+0);
775 vdwjidx0A = 2*vdwtype[jnrA+0];
776 vdwjidx0B = 2*vdwtype[jnrB+0];
777 vdwjidx0C = 2*vdwtype[jnrC+0];
778 vdwjidx0D = 2*vdwtype[jnrD+0];
779
780 /**************************
781 * CALCULATE INTERACTIONS *
782 **************************/
783
784 if (gmx_mm_any_lt(rsq00,rcutoff2))
785 {
786
787 r00 = _mm_mul_ps(rsq00,rinv00);
788 r00 = _mm_andnot_ps(dummy_mask,r00);
789
790 /* Compute parameters for interactions between i and j atoms */
791 qq00 = _mm_mul_ps(iq0,jq0);
792 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
793 vdwparam+vdwioffset0+vdwjidx0B,
794 vdwparam+vdwioffset0+vdwjidx0C,
795 vdwparam+vdwioffset0+vdwjidx0D,
796 &c6_00,&c12_00);
797
798 /* EWALD ELECTROSTATICS */
799
800 /* Calculate Ewald table index by multiplying r with scale and truncate to integer */
801 ewrt = _mm_mul_ps(r00,ewtabscale);
802 ewitab = _mm_cvttps_epi32(ewrt);
803 eweps = _mm_sub_ps(ewrt,_mm_round_ps(ewrt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (ewrt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
804 ewitab = _mm_slli_epi32(ewitab,2);
805 ewtabF = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,0)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(0) &
3];}))
);
806 ewtabD = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,1)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(1) &
3];}))
);
807 ewtabV = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,2)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(2) &
3];}))
);
808 ewtabFn = _mm_load_ps( ewtab + gmx_mm_extract_epi32(ewitab,3)(__extension__ ({ __v4si __a = (__v4si)(ewitab); __a[(3) &
3];}))
);
809 _MM_TRANSPOSE4_PS(ewtabF,ewtabD,ewtabV,ewtabFn)do { __m128 tmp3, tmp2, tmp1, tmp0; tmp0 = _mm_unpacklo_ps((ewtabF
), (ewtabD)); tmp2 = _mm_unpacklo_ps((ewtabV), (ewtabFn)); tmp1
= _mm_unpackhi_ps((ewtabF), (ewtabD)); tmp3 = _mm_unpackhi_ps
((ewtabV), (ewtabFn)); (ewtabF) = _mm_movelh_ps(tmp0, tmp2); (
ewtabD) = _mm_movehl_ps(tmp2, tmp0); (ewtabV) = _mm_movelh_ps
(tmp1, tmp3); (ewtabFn) = _mm_movehl_ps(tmp3, tmp1); } while (
0)
;
810 felec = _mm_add_ps(ewtabF,_mm_mul_ps(eweps,ewtabD));
811 velec = _mm_sub_ps(ewtabV,_mm_mul_ps(_mm_mul_ps(ewtabhalfspace,eweps),_mm_add_ps(ewtabF,felec)));
812 velec = _mm_mul_ps(qq00,_mm_sub_ps(rinv00,velec));
813 felec = _mm_mul_ps(_mm_mul_ps(qq00,rinv00),_mm_sub_ps(rinvsq00,felec));
814
815 /* LENNARD-JONES DISPERSION/REPULSION */
816
817 rinvsix = _mm_mul_ps(_mm_mul_ps(rinvsq00,rinvsq00),rinvsq00);
818 vvdw6 = _mm_mul_ps(c6_00,rinvsix);
819 vvdw12 = _mm_mul_ps(c12_00,_mm_mul_ps(rinvsix,rinvsix));
820 vvdw = _mm_sub_ps( _mm_mul_ps(vvdw12,one_twelfth) , _mm_mul_ps(vvdw6,one_sixth) );
821 fvdw = _mm_mul_ps(_mm_sub_ps(vvdw12,vvdw6),rinvsq00);
822
823 d = _mm_sub_ps(r00,rswitch);
824 d = _mm_max_ps(d,_mm_setzero_ps());
825 d2 = _mm_mul_ps(d,d);
826 sw = _mm_add_ps(one,_mm_mul_ps(d2,_mm_mul_ps(d,_mm_add_ps(swV3,_mm_mul_ps(d,_mm_add_ps(swV4,_mm_mul_ps(d,swV5)))))));
827
828 dsw = _mm_mul_ps(d2,_mm_add_ps(swF2,_mm_mul_ps(d,_mm_add_ps(swF3,_mm_mul_ps(d,swF4)))));
829
830 /* Evaluate switch function */
831 /* fscal'=f'/r=-(v*sw)'/r=-(v'*sw+v*dsw)/r=-v'*sw/r-v*dsw/r=fscal*sw-v*dsw/r */
832 felec = _mm_sub_ps( _mm_mul_ps(felec,sw) , _mm_mul_ps(rinv00,_mm_mul_ps(velec,dsw)) );
833 fvdw = _mm_sub_ps( _mm_mul_ps(fvdw,sw) , _mm_mul_ps(rinv00,_mm_mul_ps(vvdw,dsw)) );
834 cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2);
835
836 fscal = _mm_add_ps(felec,fvdw);
837
838 fscal = _mm_and_ps(fscal,cutoff_mask);
839
840 fscal = _mm_andnot_ps(dummy_mask,fscal);
841
842 /* Calculate temporary vectorial force */
843 tx = _mm_mul_ps(fscal,dx00);
844 ty = _mm_mul_ps(fscal,dy00);
845 tz = _mm_mul_ps(fscal,dz00);
846
847 /* Update vectorial force */
848 fix0 = _mm_add_ps(fix0,tx);
849 fiy0 = _mm_add_ps(fiy0,ty);
850 fiz0 = _mm_add_ps(fiz0,tz);
851
852 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
853 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
854 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
855 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
856 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
857
858 }
859
860 /* Inner loop uses 78 flops */
861 }
862
863 /* End of innermost loop */
864
865 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
866 f+i_coord_offset,fshift+i_shift_offset);
867
868 /* Increment number of inner iterations */
869 inneriter += j_index_end - j_index_start;
870
871 /* Outer loop uses 7 flops */
872 }
873
874 /* Increment number of outer iterations */
875 outeriter += nri;
876
877 /* Update outer/inner flops */
878
879 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*78)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_F] += outeriter*7 + inneriter
*78
;
880}