Bug Summary

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

Annotated Source Code

1/*
2 * This file is part of the GROMACS molecular simulation package.
3 *
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
8 *
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
13 *
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 *
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
31 *
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
34 */
35/*
36 * Note: this file was generated by the GROMACS sse4_1_single kernel generator.
37 */
38#ifdef HAVE_CONFIG_H1
39#include <config.h>
40#endif
41
42#include <math.h>
43
44#include "../nb_kernel.h"
45#include "types/simple.h"
46#include "gromacs/math/vec.h"
47#include "nrnb.h"
48
49#include "gromacs/simd/math_x86_sse4_1_single.h"
50#include "kernelutil_x86_sse4_1_single.h"
51
52/*
53 * Gromacs nonbonded kernel: nb_kernel_ElecGB_VdwCSTab_GeomP1P1_VF_sse4_1_single
54 * Electrostatics interaction: GeneralizedBorn
55 * VdW interaction: CubicSplineTable
56 * Geometry: Particle-Particle
57 * Calculate force/pot: PotentialAndForce
58 */
59void
60nb_kernel_ElecGB_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 __m128i gbitab;
93 __m128 vgb,fgb,vgbsum,dvdasum,gbscale,gbtabscale,isaprod,gbqqfactor,gbinvepsdiff,gbeps,dvdatmp;
94 __m128 minushalf = _mm_set1_ps(-0.5);
95 real *invsqrta,*dvda,*gbtab;
96 int nvdwtype;
97 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
98 int *vdwtype;
99 real *vdwparam;
100 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
101 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
102 __m128i vfitab;
103 __m128i ifour = _mm_set1_epi32(4);
104 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
105 real *vftab;
106 __m128 dummy_mask,cutoff_mask;
107 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
108 __m128 one = _mm_set1_ps(1.0);
109 __m128 two = _mm_set1_ps(2.0);
110 x = xx[0];
111 f = ff[0];
112
113 nri = nlist->nri;
114 iinr = nlist->iinr;
115 jindex = nlist->jindex;
116 jjnr = nlist->jjnr;
117 shiftidx = nlist->shift;
118 gid = nlist->gid;
119 shiftvec = fr->shift_vec[0];
120 fshift = fr->fshift[0];
121 facel = _mm_set1_ps(fr->epsfac);
122 charge = mdatoms->chargeA;
123 nvdwtype = fr->ntype;
124 vdwparam = fr->nbfp;
125 vdwtype = mdatoms->typeA;
126
127 vftab = kernel_data->table_vdw->data;
128 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
129
130 invsqrta = fr->invsqrta;
131 dvda = fr->dvda;
132 gbtabscale = _mm_set1_ps(fr->gbtab.scale);
133 gbtab = fr->gbtab.data;
134 gbinvepsdiff = _mm_set1_ps((1.0/fr->epsilon_r) - (1.0/fr->gb_epsilon_solvent));
135
136 /* Avoid stupid compiler warnings */
137 jnrA = jnrB = jnrC = jnrD = 0;
138 j_coord_offsetA = 0;
139 j_coord_offsetB = 0;
140 j_coord_offsetC = 0;
141 j_coord_offsetD = 0;
142
143 outeriter = 0;
144 inneriter = 0;
145
146 for(iidx=0;iidx<4*DIM3;iidx++)
147 {
148 scratch[iidx] = 0.0;
149 }
150
151 /* Start outer loop over neighborlists */
152 for(iidx=0; iidx<nri; iidx++)
153 {
154 /* Load shift vector for this list */
155 i_shift_offset = DIM3*shiftidx[iidx];
156
157 /* Load limits for loop over neighbors */
158 j_index_start = jindex[iidx];
159 j_index_end = jindex[iidx+1];
160
161 /* Get outer coordinate index */
162 inr = iinr[iidx];
163 i_coord_offset = DIM3*inr;
164
165 /* Load i particle coords and add shift vector */
166 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
167
168 fix0 = _mm_setzero_ps();
169 fiy0 = _mm_setzero_ps();
170 fiz0 = _mm_setzero_ps();
171
172 /* Load parameters for i particles */
173 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
174 isai0 = _mm_load1_ps(invsqrta+inr+0);
175 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
176
177 /* Reset potential sums */
178 velecsum = _mm_setzero_ps();
179 vgbsum = _mm_setzero_ps();
180 vvdwsum = _mm_setzero_ps();
181 dvdasum = _mm_setzero_ps();
182
183 /* Start inner kernel loop */
184 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
185 {
186
187 /* Get j neighbor index, and coordinate index */
188 jnrA = jjnr[jidx];
189 jnrB = jjnr[jidx+1];
190 jnrC = jjnr[jidx+2];
191 jnrD = jjnr[jidx+3];
192 j_coord_offsetA = DIM3*jnrA;
193 j_coord_offsetB = DIM3*jnrB;
194 j_coord_offsetC = DIM3*jnrC;
195 j_coord_offsetD = DIM3*jnrD;
196
197 /* load j atom coordinates */
198 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
199 x+j_coord_offsetC,x+j_coord_offsetD,
200 &jx0,&jy0,&jz0);
201
202 /* Calculate displacement vector */
203 dx00 = _mm_sub_ps(ix0,jx0);
204 dy00 = _mm_sub_ps(iy0,jy0);
205 dz00 = _mm_sub_ps(iz0,jz0);
206
207 /* Calculate squared distance and things based on it */
208 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
209
210 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
211
212 /* Load parameters for j particles */
213 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
214 charge+jnrC+0,charge+jnrD+0);
215 isaj0 = gmx_mm_load_4real_swizzle_ps(invsqrta+jnrA+0,invsqrta+jnrB+0,
216 invsqrta+jnrC+0,invsqrta+jnrD+0);
217 vdwjidx0A = 2*vdwtype[jnrA+0];
218 vdwjidx0B = 2*vdwtype[jnrB+0];
219 vdwjidx0C = 2*vdwtype[jnrC+0];
220 vdwjidx0D = 2*vdwtype[jnrD+0];
221
222 /**************************
223 * CALCULATE INTERACTIONS *
224 **************************/
225
226 r00 = _mm_mul_ps(rsq00,rinv00);
227
228 /* Compute parameters for interactions between i and j atoms */
229 qq00 = _mm_mul_ps(iq0,jq0);
230 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
231 vdwparam+vdwioffset0+vdwjidx0B,
232 vdwparam+vdwioffset0+vdwjidx0C,
233 vdwparam+vdwioffset0+vdwjidx0D,
234 &c6_00,&c12_00);
235
236 /* Calculate table index by multiplying r with table scale and truncate to integer */
237 rt = _mm_mul_ps(r00,vftabscale);
238 vfitab = _mm_cvttps_epi32(rt);
239 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
240 vfitab = _mm_slli_epi32(vfitab,3);
241
242 /* GENERALIZED BORN AND COULOMB ELECTROSTATICS */
243 isaprod = _mm_mul_ps(isai0,isaj0);
244 gbqqfactor = _mm_xor_ps(signbit,_mm_mul_ps(qq00,_mm_mul_ps(isaprod,gbinvepsdiff)));
245 gbscale = _mm_mul_ps(isaprod,gbtabscale);
246
247 /* Calculate generalized born table index - this is a separate table from the normal one,
248 * but we use the same procedure by multiplying r with scale and truncating to integer.
249 */
250 rt = _mm_mul_ps(r00,gbscale);
251 gbitab = _mm_cvttps_epi32(rt);
252 gbeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
253 gbitab = _mm_slli_epi32(gbitab,2);
254 Y = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,0)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(0) &
3];}))
);
255 F = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,1)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(1) &
3];}))
);
256 G = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,2)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(2) &
3];}))
);
257 H = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,3)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(3) &
3];}))
);
258 _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)
;
259 Heps = _mm_mul_ps(gbeps,H);
260 Fp = _mm_add_ps(F,_mm_mul_ps(gbeps,_mm_add_ps(G,Heps)));
261 VV = _mm_add_ps(Y,_mm_mul_ps(gbeps,Fp));
262 vgb = _mm_mul_ps(gbqqfactor,VV);
263
264 FF = _mm_add_ps(Fp,_mm_mul_ps(gbeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
265 fgb = _mm_mul_ps(gbqqfactor,_mm_mul_ps(FF,gbscale));
266 dvdatmp = _mm_mul_ps(minushalf,_mm_add_ps(vgb,_mm_mul_ps(fgb,r00)));
267 dvdasum = _mm_add_ps(dvdasum,dvdatmp);
268 fjptrA = dvda+jnrA;
269 fjptrB = dvda+jnrB;
270 fjptrC = dvda+jnrC;
271 fjptrD = dvda+jnrD;
272 gmx_mm_increment_4real_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,_mm_mul_ps(dvdatmp,_mm_mul_ps(isaj0,isaj0)));
273 velec = _mm_mul_ps(qq00,rinv00);
274 felec = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(velec,rinv00),fgb),rinv00);
275
276 /* CUBIC SPLINE TABLE DISPERSION */
277 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
278 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
279 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
280 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
281 _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)
;
282 Heps = _mm_mul_ps(vfeps,H);
283 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
284 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
285 vvdw6 = _mm_mul_ps(c6_00,VV);
286 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
287 fvdw6 = _mm_mul_ps(c6_00,FF);
288
289 /* CUBIC SPLINE TABLE REPULSION */
290 vfitab = _mm_add_epi32(vfitab,ifour);
291 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
292 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
293 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
294 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
295 _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)
;
296 Heps = _mm_mul_ps(vfeps,H);
297 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
298 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
299 vvdw12 = _mm_mul_ps(c12_00,VV);
300 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
301 fvdw12 = _mm_mul_ps(c12_00,FF);
302 vvdw = _mm_add_ps(vvdw12,vvdw6);
303 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
304
305 /* Update potential sum for this i atom from the interaction with this j atom. */
306 velecsum = _mm_add_ps(velecsum,velec);
307 vgbsum = _mm_add_ps(vgbsum,vgb);
308 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
309
310 fscal = _mm_add_ps(felec,fvdw);
311
312 /* Calculate temporary vectorial force */
313 tx = _mm_mul_ps(fscal,dx00);
314 ty = _mm_mul_ps(fscal,dy00);
315 tz = _mm_mul_ps(fscal,dz00);
316
317 /* Update vectorial force */
318 fix0 = _mm_add_ps(fix0,tx);
319 fiy0 = _mm_add_ps(fiy0,ty);
320 fiz0 = _mm_add_ps(fiz0,tz);
321
322 fjptrA = f+j_coord_offsetA;
323 fjptrB = f+j_coord_offsetB;
324 fjptrC = f+j_coord_offsetC;
325 fjptrD = f+j_coord_offsetD;
326 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
327
328 /* Inner loop uses 92 flops */
329 }
330
331 if(jidx<j_index_end)
332 {
333
334 /* Get j neighbor index, and coordinate index */
335 jnrlistA = jjnr[jidx];
336 jnrlistB = jjnr[jidx+1];
337 jnrlistC = jjnr[jidx+2];
338 jnrlistD = jjnr[jidx+3];
339 /* Sign of each element will be negative for non-real atoms.
340 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
341 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
342 */
343 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
344 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
345 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
346 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
347 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
348 j_coord_offsetA = DIM3*jnrA;
349 j_coord_offsetB = DIM3*jnrB;
350 j_coord_offsetC = DIM3*jnrC;
351 j_coord_offsetD = DIM3*jnrD;
352
353 /* load j atom coordinates */
354 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
355 x+j_coord_offsetC,x+j_coord_offsetD,
356 &jx0,&jy0,&jz0);
357
358 /* Calculate displacement vector */
359 dx00 = _mm_sub_ps(ix0,jx0);
360 dy00 = _mm_sub_ps(iy0,jy0);
361 dz00 = _mm_sub_ps(iz0,jz0);
362
363 /* Calculate squared distance and things based on it */
364 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
365
366 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
367
368 /* Load parameters for j particles */
369 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
370 charge+jnrC+0,charge+jnrD+0);
371 isaj0 = gmx_mm_load_4real_swizzle_ps(invsqrta+jnrA+0,invsqrta+jnrB+0,
372 invsqrta+jnrC+0,invsqrta+jnrD+0);
373 vdwjidx0A = 2*vdwtype[jnrA+0];
374 vdwjidx0B = 2*vdwtype[jnrB+0];
375 vdwjidx0C = 2*vdwtype[jnrC+0];
376 vdwjidx0D = 2*vdwtype[jnrD+0];
377
378 /**************************
379 * CALCULATE INTERACTIONS *
380 **************************/
381
382 r00 = _mm_mul_ps(rsq00,rinv00);
383 r00 = _mm_andnot_ps(dummy_mask,r00);
384
385 /* Compute parameters for interactions between i and j atoms */
386 qq00 = _mm_mul_ps(iq0,jq0);
387 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
388 vdwparam+vdwioffset0+vdwjidx0B,
389 vdwparam+vdwioffset0+vdwjidx0C,
390 vdwparam+vdwioffset0+vdwjidx0D,
391 &c6_00,&c12_00);
392
393 /* Calculate table index by multiplying r with table scale and truncate to integer */
394 rt = _mm_mul_ps(r00,vftabscale);
395 vfitab = _mm_cvttps_epi32(rt);
396 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
397 vfitab = _mm_slli_epi32(vfitab,3);
398
399 /* GENERALIZED BORN AND COULOMB ELECTROSTATICS */
400 isaprod = _mm_mul_ps(isai0,isaj0);
401 gbqqfactor = _mm_xor_ps(signbit,_mm_mul_ps(qq00,_mm_mul_ps(isaprod,gbinvepsdiff)));
402 gbscale = _mm_mul_ps(isaprod,gbtabscale);
403
404 /* Calculate generalized born table index - this is a separate table from the normal one,
405 * but we use the same procedure by multiplying r with scale and truncating to integer.
406 */
407 rt = _mm_mul_ps(r00,gbscale);
408 gbitab = _mm_cvttps_epi32(rt);
409 gbeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
410 gbitab = _mm_slli_epi32(gbitab,2);
411 Y = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,0)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(0) &
3];}))
);
412 F = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,1)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(1) &
3];}))
);
413 G = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,2)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(2) &
3];}))
);
414 H = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,3)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(3) &
3];}))
);
415 _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)
;
416 Heps = _mm_mul_ps(gbeps,H);
417 Fp = _mm_add_ps(F,_mm_mul_ps(gbeps,_mm_add_ps(G,Heps)));
418 VV = _mm_add_ps(Y,_mm_mul_ps(gbeps,Fp));
419 vgb = _mm_mul_ps(gbqqfactor,VV);
420
421 FF = _mm_add_ps(Fp,_mm_mul_ps(gbeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
422 fgb = _mm_mul_ps(gbqqfactor,_mm_mul_ps(FF,gbscale));
423 dvdatmp = _mm_mul_ps(minushalf,_mm_add_ps(vgb,_mm_mul_ps(fgb,r00)));
424 dvdatmp = _mm_andnot_ps(dummy_mask,dvdatmp);
425 dvdasum = _mm_add_ps(dvdasum,dvdatmp);
426 /* The pointers to scratch make sure that this code with compilers that take gmx_restrict seriously (e.g. icc 13) really can't screw things up. */
427 fjptrA = (jnrlistA>=0) ? dvda+jnrA : scratch;
428 fjptrB = (jnrlistB>=0) ? dvda+jnrB : scratch;
429 fjptrC = (jnrlistC>=0) ? dvda+jnrC : scratch;
430 fjptrD = (jnrlistD>=0) ? dvda+jnrD : scratch;
431 gmx_mm_increment_4real_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,_mm_mul_ps(dvdatmp,_mm_mul_ps(isaj0,isaj0)));
432 velec = _mm_mul_ps(qq00,rinv00);
433 felec = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(velec,rinv00),fgb),rinv00);
434
435 /* CUBIC SPLINE TABLE DISPERSION */
436 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
437 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
438 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
439 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
440 _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)
;
441 Heps = _mm_mul_ps(vfeps,H);
442 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
443 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
444 vvdw6 = _mm_mul_ps(c6_00,VV);
445 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
446 fvdw6 = _mm_mul_ps(c6_00,FF);
447
448 /* CUBIC SPLINE TABLE REPULSION */
449 vfitab = _mm_add_epi32(vfitab,ifour);
450 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
451 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
452 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
453 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
454 _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)
;
455 Heps = _mm_mul_ps(vfeps,H);
456 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
457 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
458 vvdw12 = _mm_mul_ps(c12_00,VV);
459 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
460 fvdw12 = _mm_mul_ps(c12_00,FF);
461 vvdw = _mm_add_ps(vvdw12,vvdw6);
462 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
463
464 /* Update potential sum for this i atom from the interaction with this j atom. */
465 velec = _mm_andnot_ps(dummy_mask,velec);
466 velecsum = _mm_add_ps(velecsum,velec);
467 vgb = _mm_andnot_ps(dummy_mask,vgb);
468 vgbsum = _mm_add_ps(vgbsum,vgb);
469 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
470 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
471
472 fscal = _mm_add_ps(felec,fvdw);
473
474 fscal = _mm_andnot_ps(dummy_mask,fscal);
475
476 /* Calculate temporary vectorial force */
477 tx = _mm_mul_ps(fscal,dx00);
478 ty = _mm_mul_ps(fscal,dy00);
479 tz = _mm_mul_ps(fscal,dz00);
480
481 /* Update vectorial force */
482 fix0 = _mm_add_ps(fix0,tx);
483 fiy0 = _mm_add_ps(fiy0,ty);
484 fiz0 = _mm_add_ps(fiz0,tz);
485
486 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
487 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
488 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
489 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
490 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
491
492 /* Inner loop uses 93 flops */
493 }
494
495 /* End of innermost loop */
496
497 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
498 f+i_coord_offset,fshift+i_shift_offset);
499
500 ggid = gid[iidx];
501 /* Update potential energies */
502 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
503 gmx_mm_update_1pot_ps(vgbsum,kernel_data->energygrp_polarization+ggid);
504 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
505 dvdasum = _mm_mul_ps(dvdasum, _mm_mul_ps(isai0,isai0));
506 gmx_mm_update_1pot_ps(dvdasum,dvda+inr);
507
508 /* Increment number of inner iterations */
509 inneriter += j_index_end - j_index_start;
510
511 /* Outer loop uses 10 flops */
512 }
513
514 /* Increment number of outer iterations */
515 outeriter += nri;
516
517 /* Update outer/inner flops */
518
519 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*10 + inneriter*93)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_VF] += outeriter*10 + inneriter
*93
;
520}
521/*
522 * Gromacs nonbonded kernel: nb_kernel_ElecGB_VdwCSTab_GeomP1P1_F_sse4_1_single
523 * Electrostatics interaction: GeneralizedBorn
524 * VdW interaction: CubicSplineTable
525 * Geometry: Particle-Particle
526 * Calculate force/pot: Force
527 */
528void
529nb_kernel_ElecGB_VdwCSTab_GeomP1P1_F_sse4_1_single
530 (t_nblist * gmx_restrict nlist,
531 rvec * gmx_restrict xx,
532 rvec * gmx_restrict ff,
533 t_forcerec * gmx_restrict fr,
534 t_mdatoms * gmx_restrict mdatoms,
535 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
536 t_nrnb * gmx_restrict nrnb)
537{
538 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
539 * just 0 for non-waters.
540 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
541 * jnr indices corresponding to data put in the four positions in the SIMD register.
542 */
543 int i_shift_offset,i_coord_offset,outeriter,inneriter;
544 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
545 int jnrA,jnrB,jnrC,jnrD;
546 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
547 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
548 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
549 real rcutoff_scalar;
550 real *shiftvec,*fshift,*x,*f;
551 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
552 real scratch[4*DIM3];
553 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
554 int vdwioffset0;
555 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
556 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
557 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
558 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
559 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
560 real *charge;
561 __m128i gbitab;
562 __m128 vgb,fgb,vgbsum,dvdasum,gbscale,gbtabscale,isaprod,gbqqfactor,gbinvepsdiff,gbeps,dvdatmp;
563 __m128 minushalf = _mm_set1_ps(-0.5);
564 real *invsqrta,*dvda,*gbtab;
565 int nvdwtype;
566 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
567 int *vdwtype;
568 real *vdwparam;
569 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
Value stored to 'one_sixth' during its initialization is never read
570 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
571 __m128i vfitab;
572 __m128i ifour = _mm_set1_epi32(4);
573 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
574 real *vftab;
575 __m128 dummy_mask,cutoff_mask;
576 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
577 __m128 one = _mm_set1_ps(1.0);
578 __m128 two = _mm_set1_ps(2.0);
579 x = xx[0];
580 f = ff[0];
581
582 nri = nlist->nri;
583 iinr = nlist->iinr;
584 jindex = nlist->jindex;
585 jjnr = nlist->jjnr;
586 shiftidx = nlist->shift;
587 gid = nlist->gid;
588 shiftvec = fr->shift_vec[0];
589 fshift = fr->fshift[0];
590 facel = _mm_set1_ps(fr->epsfac);
591 charge = mdatoms->chargeA;
592 nvdwtype = fr->ntype;
593 vdwparam = fr->nbfp;
594 vdwtype = mdatoms->typeA;
595
596 vftab = kernel_data->table_vdw->data;
597 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
598
599 invsqrta = fr->invsqrta;
600 dvda = fr->dvda;
601 gbtabscale = _mm_set1_ps(fr->gbtab.scale);
602 gbtab = fr->gbtab.data;
603 gbinvepsdiff = _mm_set1_ps((1.0/fr->epsilon_r) - (1.0/fr->gb_epsilon_solvent));
604
605 /* Avoid stupid compiler warnings */
606 jnrA = jnrB = jnrC = jnrD = 0;
607 j_coord_offsetA = 0;
608 j_coord_offsetB = 0;
609 j_coord_offsetC = 0;
610 j_coord_offsetD = 0;
611
612 outeriter = 0;
613 inneriter = 0;
614
615 for(iidx=0;iidx<4*DIM3;iidx++)
616 {
617 scratch[iidx] = 0.0;
618 }
619
620 /* Start outer loop over neighborlists */
621 for(iidx=0; iidx<nri; iidx++)
622 {
623 /* Load shift vector for this list */
624 i_shift_offset = DIM3*shiftidx[iidx];
625
626 /* Load limits for loop over neighbors */
627 j_index_start = jindex[iidx];
628 j_index_end = jindex[iidx+1];
629
630 /* Get outer coordinate index */
631 inr = iinr[iidx];
632 i_coord_offset = DIM3*inr;
633
634 /* Load i particle coords and add shift vector */
635 gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0);
636
637 fix0 = _mm_setzero_ps();
638 fiy0 = _mm_setzero_ps();
639 fiz0 = _mm_setzero_ps();
640
641 /* Load parameters for i particles */
642 iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0));
643 isai0 = _mm_load1_ps(invsqrta+inr+0);
644 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
645
646 dvdasum = _mm_setzero_ps();
647
648 /* Start inner kernel loop */
649 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
650 {
651
652 /* Get j neighbor index, and coordinate index */
653 jnrA = jjnr[jidx];
654 jnrB = jjnr[jidx+1];
655 jnrC = jjnr[jidx+2];
656 jnrD = jjnr[jidx+3];
657 j_coord_offsetA = DIM3*jnrA;
658 j_coord_offsetB = DIM3*jnrB;
659 j_coord_offsetC = DIM3*jnrC;
660 j_coord_offsetD = DIM3*jnrD;
661
662 /* load j atom coordinates */
663 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
664 x+j_coord_offsetC,x+j_coord_offsetD,
665 &jx0,&jy0,&jz0);
666
667 /* Calculate displacement vector */
668 dx00 = _mm_sub_ps(ix0,jx0);
669 dy00 = _mm_sub_ps(iy0,jy0);
670 dz00 = _mm_sub_ps(iz0,jz0);
671
672 /* Calculate squared distance and things based on it */
673 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
674
675 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
676
677 /* Load parameters for j particles */
678 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
679 charge+jnrC+0,charge+jnrD+0);
680 isaj0 = gmx_mm_load_4real_swizzle_ps(invsqrta+jnrA+0,invsqrta+jnrB+0,
681 invsqrta+jnrC+0,invsqrta+jnrD+0);
682 vdwjidx0A = 2*vdwtype[jnrA+0];
683 vdwjidx0B = 2*vdwtype[jnrB+0];
684 vdwjidx0C = 2*vdwtype[jnrC+0];
685 vdwjidx0D = 2*vdwtype[jnrD+0];
686
687 /**************************
688 * CALCULATE INTERACTIONS *
689 **************************/
690
691 r00 = _mm_mul_ps(rsq00,rinv00);
692
693 /* Compute parameters for interactions between i and j atoms */
694 qq00 = _mm_mul_ps(iq0,jq0);
695 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
696 vdwparam+vdwioffset0+vdwjidx0B,
697 vdwparam+vdwioffset0+vdwjidx0C,
698 vdwparam+vdwioffset0+vdwjidx0D,
699 &c6_00,&c12_00);
700
701 /* Calculate table index by multiplying r with table scale and truncate to integer */
702 rt = _mm_mul_ps(r00,vftabscale);
703 vfitab = _mm_cvttps_epi32(rt);
704 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
705 vfitab = _mm_slli_epi32(vfitab,3);
706
707 /* GENERALIZED BORN AND COULOMB ELECTROSTATICS */
708 isaprod = _mm_mul_ps(isai0,isaj0);
709 gbqqfactor = _mm_xor_ps(signbit,_mm_mul_ps(qq00,_mm_mul_ps(isaprod,gbinvepsdiff)));
710 gbscale = _mm_mul_ps(isaprod,gbtabscale);
711
712 /* Calculate generalized born table index - this is a separate table from the normal one,
713 * but we use the same procedure by multiplying r with scale and truncating to integer.
714 */
715 rt = _mm_mul_ps(r00,gbscale);
716 gbitab = _mm_cvttps_epi32(rt);
717 gbeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
718 gbitab = _mm_slli_epi32(gbitab,2);
719 Y = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,0)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(0) &
3];}))
);
720 F = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,1)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(1) &
3];}))
);
721 G = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,2)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(2) &
3];}))
);
722 H = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,3)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(3) &
3];}))
);
723 _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)
;
724 Heps = _mm_mul_ps(gbeps,H);
725 Fp = _mm_add_ps(F,_mm_mul_ps(gbeps,_mm_add_ps(G,Heps)));
726 VV = _mm_add_ps(Y,_mm_mul_ps(gbeps,Fp));
727 vgb = _mm_mul_ps(gbqqfactor,VV);
728
729 FF = _mm_add_ps(Fp,_mm_mul_ps(gbeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
730 fgb = _mm_mul_ps(gbqqfactor,_mm_mul_ps(FF,gbscale));
731 dvdatmp = _mm_mul_ps(minushalf,_mm_add_ps(vgb,_mm_mul_ps(fgb,r00)));
732 dvdasum = _mm_add_ps(dvdasum,dvdatmp);
733 fjptrA = dvda+jnrA;
734 fjptrB = dvda+jnrB;
735 fjptrC = dvda+jnrC;
736 fjptrD = dvda+jnrD;
737 gmx_mm_increment_4real_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,_mm_mul_ps(dvdatmp,_mm_mul_ps(isaj0,isaj0)));
738 velec = _mm_mul_ps(qq00,rinv00);
739 felec = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(velec,rinv00),fgb),rinv00);
740
741 /* CUBIC SPLINE TABLE DISPERSION */
742 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
743 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
744 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
745 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
746 _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)
;
747 Heps = _mm_mul_ps(vfeps,H);
748 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
749 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
750 fvdw6 = _mm_mul_ps(c6_00,FF);
751
752 /* CUBIC SPLINE TABLE REPULSION */
753 vfitab = _mm_add_epi32(vfitab,ifour);
754 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
755 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
756 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
757 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
758 _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)
;
759 Heps = _mm_mul_ps(vfeps,H);
760 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
761 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
762 fvdw12 = _mm_mul_ps(c12_00,FF);
763 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
764
765 fscal = _mm_add_ps(felec,fvdw);
766
767 /* Calculate temporary vectorial force */
768 tx = _mm_mul_ps(fscal,dx00);
769 ty = _mm_mul_ps(fscal,dy00);
770 tz = _mm_mul_ps(fscal,dz00);
771
772 /* Update vectorial force */
773 fix0 = _mm_add_ps(fix0,tx);
774 fiy0 = _mm_add_ps(fiy0,ty);
775 fiz0 = _mm_add_ps(fiz0,tz);
776
777 fjptrA = f+j_coord_offsetA;
778 fjptrB = f+j_coord_offsetB;
779 fjptrC = f+j_coord_offsetC;
780 fjptrD = f+j_coord_offsetD;
781 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
782
783 /* Inner loop uses 82 flops */
784 }
785
786 if(jidx<j_index_end)
787 {
788
789 /* Get j neighbor index, and coordinate index */
790 jnrlistA = jjnr[jidx];
791 jnrlistB = jjnr[jidx+1];
792 jnrlistC = jjnr[jidx+2];
793 jnrlistD = jjnr[jidx+3];
794 /* Sign of each element will be negative for non-real atoms.
795 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
796 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
797 */
798 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
799 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
800 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
801 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
802 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
803 j_coord_offsetA = DIM3*jnrA;
804 j_coord_offsetB = DIM3*jnrB;
805 j_coord_offsetC = DIM3*jnrC;
806 j_coord_offsetD = DIM3*jnrD;
807
808 /* load j atom coordinates */
809 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
810 x+j_coord_offsetC,x+j_coord_offsetD,
811 &jx0,&jy0,&jz0);
812
813 /* Calculate displacement vector */
814 dx00 = _mm_sub_ps(ix0,jx0);
815 dy00 = _mm_sub_ps(iy0,jy0);
816 dz00 = _mm_sub_ps(iz0,jz0);
817
818 /* Calculate squared distance and things based on it */
819 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
820
821 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
822
823 /* Load parameters for j particles */
824 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
825 charge+jnrC+0,charge+jnrD+0);
826 isaj0 = gmx_mm_load_4real_swizzle_ps(invsqrta+jnrA+0,invsqrta+jnrB+0,
827 invsqrta+jnrC+0,invsqrta+jnrD+0);
828 vdwjidx0A = 2*vdwtype[jnrA+0];
829 vdwjidx0B = 2*vdwtype[jnrB+0];
830 vdwjidx0C = 2*vdwtype[jnrC+0];
831 vdwjidx0D = 2*vdwtype[jnrD+0];
832
833 /**************************
834 * CALCULATE INTERACTIONS *
835 **************************/
836
837 r00 = _mm_mul_ps(rsq00,rinv00);
838 r00 = _mm_andnot_ps(dummy_mask,r00);
839
840 /* Compute parameters for interactions between i and j atoms */
841 qq00 = _mm_mul_ps(iq0,jq0);
842 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
843 vdwparam+vdwioffset0+vdwjidx0B,
844 vdwparam+vdwioffset0+vdwjidx0C,
845 vdwparam+vdwioffset0+vdwjidx0D,
846 &c6_00,&c12_00);
847
848 /* Calculate table index by multiplying r with table scale and truncate to integer */
849 rt = _mm_mul_ps(r00,vftabscale);
850 vfitab = _mm_cvttps_epi32(rt);
851 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
852 vfitab = _mm_slli_epi32(vfitab,3);
853
854 /* GENERALIZED BORN AND COULOMB ELECTROSTATICS */
855 isaprod = _mm_mul_ps(isai0,isaj0);
856 gbqqfactor = _mm_xor_ps(signbit,_mm_mul_ps(qq00,_mm_mul_ps(isaprod,gbinvepsdiff)));
857 gbscale = _mm_mul_ps(isaprod,gbtabscale);
858
859 /* Calculate generalized born table index - this is a separate table from the normal one,
860 * but we use the same procedure by multiplying r with scale and truncating to integer.
861 */
862 rt = _mm_mul_ps(r00,gbscale);
863 gbitab = _mm_cvttps_epi32(rt);
864 gbeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
865 gbitab = _mm_slli_epi32(gbitab,2);
866 Y = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,0)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(0) &
3];}))
);
867 F = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,1)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(1) &
3];}))
);
868 G = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,2)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(2) &
3];}))
);
869 H = _mm_load_ps( gbtab + gmx_mm_extract_epi32(gbitab,3)(__extension__ ({ __v4si __a = (__v4si)(gbitab); __a[(3) &
3];}))
);
870 _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)
;
871 Heps = _mm_mul_ps(gbeps,H);
872 Fp = _mm_add_ps(F,_mm_mul_ps(gbeps,_mm_add_ps(G,Heps)));
873 VV = _mm_add_ps(Y,_mm_mul_ps(gbeps,Fp));
874 vgb = _mm_mul_ps(gbqqfactor,VV);
875
876 FF = _mm_add_ps(Fp,_mm_mul_ps(gbeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
877 fgb = _mm_mul_ps(gbqqfactor,_mm_mul_ps(FF,gbscale));
878 dvdatmp = _mm_mul_ps(minushalf,_mm_add_ps(vgb,_mm_mul_ps(fgb,r00)));
879 dvdatmp = _mm_andnot_ps(dummy_mask,dvdatmp);
880 dvdasum = _mm_add_ps(dvdasum,dvdatmp);
881 /* The pointers to scratch make sure that this code with compilers that take gmx_restrict seriously (e.g. icc 13) really can't screw things up. */
882 fjptrA = (jnrlistA>=0) ? dvda+jnrA : scratch;
883 fjptrB = (jnrlistB>=0) ? dvda+jnrB : scratch;
884 fjptrC = (jnrlistC>=0) ? dvda+jnrC : scratch;
885 fjptrD = (jnrlistD>=0) ? dvda+jnrD : scratch;
886 gmx_mm_increment_4real_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,_mm_mul_ps(dvdatmp,_mm_mul_ps(isaj0,isaj0)));
887 velec = _mm_mul_ps(qq00,rinv00);
888 felec = _mm_mul_ps(_mm_sub_ps(_mm_mul_ps(velec,rinv00),fgb),rinv00);
889
890 /* CUBIC SPLINE TABLE DISPERSION */
891 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
892 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
893 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
894 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
895 _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)
;
896 Heps = _mm_mul_ps(vfeps,H);
897 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
898 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
899 fvdw6 = _mm_mul_ps(c6_00,FF);
900
901 /* CUBIC SPLINE TABLE REPULSION */
902 vfitab = _mm_add_epi32(vfitab,ifour);
903 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
904 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
905 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
906 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
907 _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)
;
908 Heps = _mm_mul_ps(vfeps,H);
909 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
910 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
911 fvdw12 = _mm_mul_ps(c12_00,FF);
912 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
913
914 fscal = _mm_add_ps(felec,fvdw);
915
916 fscal = _mm_andnot_ps(dummy_mask,fscal);
917
918 /* Calculate temporary vectorial force */
919 tx = _mm_mul_ps(fscal,dx00);
920 ty = _mm_mul_ps(fscal,dy00);
921 tz = _mm_mul_ps(fscal,dz00);
922
923 /* Update vectorial force */
924 fix0 = _mm_add_ps(fix0,tx);
925 fiy0 = _mm_add_ps(fiy0,ty);
926 fiz0 = _mm_add_ps(fiz0,tz);
927
928 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
929 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
930 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
931 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
932 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz);
933
934 /* Inner loop uses 83 flops */
935 }
936
937 /* End of innermost loop */
938
939 gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0,
940 f+i_coord_offset,fshift+i_shift_offset);
941
942 dvdasum = _mm_mul_ps(dvdasum, _mm_mul_ps(isai0,isai0));
943 gmx_mm_update_1pot_ps(dvdasum,dvda+inr);
944
945 /* Increment number of inner iterations */
946 inneriter += j_index_end - j_index_start;
947
948 /* Outer loop uses 7 flops */
949 }
950
951 /* Increment number of outer iterations */
952 outeriter += nri;
953
954 /* Update outer/inner flops */
955
956 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*83)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_F] += outeriter*7 + inneriter
*83
;
957}