Bug Summary

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