Bug Summary

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

Annotated Source Code

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