Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_sse4_1_single.c
Location:line 860, 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_ElecCSTab_VdwCSTab_GeomW4P1_VF_sse4_1_single
54 * Electrostatics interaction: CubicSplineTable
55 * VdW interaction: CubicSplineTable
56 * Geometry: Water4-Particle
57 * Calculate force/pot: PotentialAndForce
58 */
59void
60nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_VF_sse4_1_single
61 (t_nblist * gmx_restrict nlist,
62 rvec * gmx_restrict xx,
63 rvec * gmx_restrict ff,
64 t_forcerec * gmx_restrict fr,
65 t_mdatoms * gmx_restrict mdatoms,
66 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
67 t_nrnb * gmx_restrict nrnb)
68{
69 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
70 * just 0 for non-waters.
71 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
72 * jnr indices corresponding to data put in the four positions in the SIMD register.
73 */
74 int i_shift_offset,i_coord_offset,outeriter,inneriter;
75 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
76 int jnrA,jnrB,jnrC,jnrD;
77 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
78 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
79 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
80 real rcutoff_scalar;
81 real *shiftvec,*fshift,*x,*f;
82 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
83 real scratch[4*DIM3];
84 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
85 int vdwioffset0;
86 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
87 int vdwioffset1;
88 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
89 int vdwioffset2;
90 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
91 int vdwioffset3;
92 __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
93 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
94 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
95 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
96 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
97 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
98 __m128 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
99 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
100 real *charge;
101 int nvdwtype;
102 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
103 int *vdwtype;
104 real *vdwparam;
105 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
106 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
107 __m128i vfitab;
108 __m128i ifour = _mm_set1_epi32(4);
109 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
110 real *vftab;
111 __m128 dummy_mask,cutoff_mask;
112 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
113 __m128 one = _mm_set1_ps(1.0);
114 __m128 two = _mm_set1_ps(2.0);
115 x = xx[0];
116 f = ff[0];
117
118 nri = nlist->nri;
119 iinr = nlist->iinr;
120 jindex = nlist->jindex;
121 jjnr = nlist->jjnr;
122 shiftidx = nlist->shift;
123 gid = nlist->gid;
124 shiftvec = fr->shift_vec[0];
125 fshift = fr->fshift[0];
126 facel = _mm_set1_ps(fr->epsfac);
127 charge = mdatoms->chargeA;
128 nvdwtype = fr->ntype;
129 vdwparam = fr->nbfp;
130 vdwtype = mdatoms->typeA;
131
132 vftab = kernel_data->table_elec_vdw->data;
133 vftabscale = _mm_set1_ps(kernel_data->table_elec_vdw->scale);
134
135 /* Setup water-specific parameters */
136 inr = nlist->iinr[0];
137 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
138 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
139 iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3]));
140 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
141
142 /* Avoid stupid compiler warnings */
143 jnrA = jnrB = jnrC = jnrD = 0;
144 j_coord_offsetA = 0;
145 j_coord_offsetB = 0;
146 j_coord_offsetC = 0;
147 j_coord_offsetD = 0;
148
149 outeriter = 0;
150 inneriter = 0;
151
152 for(iidx=0;iidx<4*DIM3;iidx++)
153 {
154 scratch[iidx] = 0.0;
155 }
156
157 /* Start outer loop over neighborlists */
158 for(iidx=0; iidx<nri; iidx++)
159 {
160 /* Load shift vector for this list */
161 i_shift_offset = DIM3*shiftidx[iidx];
162
163 /* Load limits for loop over neighbors */
164 j_index_start = jindex[iidx];
165 j_index_end = jindex[iidx+1];
166
167 /* Get outer coordinate index */
168 inr = iinr[iidx];
169 i_coord_offset = DIM3*inr;
170
171 /* Load i particle coords and add shift vector */
172 gmx_mm_load_shift_and_4rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
173 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
174
175 fix0 = _mm_setzero_ps();
176 fiy0 = _mm_setzero_ps();
177 fiz0 = _mm_setzero_ps();
178 fix1 = _mm_setzero_ps();
179 fiy1 = _mm_setzero_ps();
180 fiz1 = _mm_setzero_ps();
181 fix2 = _mm_setzero_ps();
182 fiy2 = _mm_setzero_ps();
183 fiz2 = _mm_setzero_ps();
184 fix3 = _mm_setzero_ps();
185 fiy3 = _mm_setzero_ps();
186 fiz3 = _mm_setzero_ps();
187
188 /* Reset potential sums */
189 velecsum = _mm_setzero_ps();
190 vvdwsum = _mm_setzero_ps();
191
192 /* Start inner kernel loop */
193 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
194 {
195
196 /* Get j neighbor index, and coordinate index */
197 jnrA = jjnr[jidx];
198 jnrB = jjnr[jidx+1];
199 jnrC = jjnr[jidx+2];
200 jnrD = jjnr[jidx+3];
201 j_coord_offsetA = DIM3*jnrA;
202 j_coord_offsetB = DIM3*jnrB;
203 j_coord_offsetC = DIM3*jnrC;
204 j_coord_offsetD = DIM3*jnrD;
205
206 /* load j atom coordinates */
207 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
208 x+j_coord_offsetC,x+j_coord_offsetD,
209 &jx0,&jy0,&jz0);
210
211 /* Calculate displacement vector */
212 dx00 = _mm_sub_ps(ix0,jx0);
213 dy00 = _mm_sub_ps(iy0,jy0);
214 dz00 = _mm_sub_ps(iz0,jz0);
215 dx10 = _mm_sub_ps(ix1,jx0);
216 dy10 = _mm_sub_ps(iy1,jy0);
217 dz10 = _mm_sub_ps(iz1,jz0);
218 dx20 = _mm_sub_ps(ix2,jx0);
219 dy20 = _mm_sub_ps(iy2,jy0);
220 dz20 = _mm_sub_ps(iz2,jz0);
221 dx30 = _mm_sub_ps(ix3,jx0);
222 dy30 = _mm_sub_ps(iy3,jy0);
223 dz30 = _mm_sub_ps(iz3,jz0);
224
225 /* Calculate squared distance and things based on it */
226 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
227 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
228 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
229 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
230
231 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
232 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
233 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
234 rinv30 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq30);
235
236 /* Load parameters for j particles */
237 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
238 charge+jnrC+0,charge+jnrD+0);
239 vdwjidx0A = 2*vdwtype[jnrA+0];
240 vdwjidx0B = 2*vdwtype[jnrB+0];
241 vdwjidx0C = 2*vdwtype[jnrC+0];
242 vdwjidx0D = 2*vdwtype[jnrD+0];
243
244 fjx0 = _mm_setzero_ps();
245 fjy0 = _mm_setzero_ps();
246 fjz0 = _mm_setzero_ps();
247
248 /**************************
249 * CALCULATE INTERACTIONS *
250 **************************/
251
252 r00 = _mm_mul_ps(rsq00,rinv00);
253
254 /* Compute parameters for interactions between i and j atoms */
255 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
256 vdwparam+vdwioffset0+vdwjidx0B,
257 vdwparam+vdwioffset0+vdwjidx0C,
258 vdwparam+vdwioffset0+vdwjidx0D,
259 &c6_00,&c12_00);
260
261 /* Calculate table index by multiplying r with table scale and truncate to integer */
262 rt = _mm_mul_ps(r00,vftabscale);
263 vfitab = _mm_cvttps_epi32(rt);
264 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
265 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
266
267 /* CUBIC SPLINE TABLE DISPERSION */
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 vvdw6 = _mm_mul_ps(c6_00,VV);
278 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
279 fvdw6 = _mm_mul_ps(c6_00,FF);
280
281 /* CUBIC SPLINE TABLE REPULSION */
282 vfitab = _mm_add_epi32(vfitab,ifour);
283 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
284 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
285 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
286 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
287 _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)
;
288 Heps = _mm_mul_ps(vfeps,H);
289 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
290 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
291 vvdw12 = _mm_mul_ps(c12_00,VV);
292 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
293 fvdw12 = _mm_mul_ps(c12_00,FF);
294 vvdw = _mm_add_ps(vvdw12,vvdw6);
295 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
296
297 /* Update potential sum for this i atom from the interaction with this j atom. */
298 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
299
300 fscal = fvdw;
301
302 /* Calculate temporary vectorial force */
303 tx = _mm_mul_ps(fscal,dx00);
304 ty = _mm_mul_ps(fscal,dy00);
305 tz = _mm_mul_ps(fscal,dz00);
306
307 /* Update vectorial force */
308 fix0 = _mm_add_ps(fix0,tx);
309 fiy0 = _mm_add_ps(fiy0,ty);
310 fiz0 = _mm_add_ps(fiz0,tz);
311
312 fjx0 = _mm_add_ps(fjx0,tx);
313 fjy0 = _mm_add_ps(fjy0,ty);
314 fjz0 = _mm_add_ps(fjz0,tz);
315
316 /**************************
317 * CALCULATE INTERACTIONS *
318 **************************/
319
320 r10 = _mm_mul_ps(rsq10,rinv10);
321
322 /* Compute parameters for interactions between i and j atoms */
323 qq10 = _mm_mul_ps(iq1,jq0);
324
325 /* Calculate table index by multiplying r with table scale and truncate to integer */
326 rt = _mm_mul_ps(r10,vftabscale);
327 vfitab = _mm_cvttps_epi32(rt);
328 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
329 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
330
331 /* CUBIC SPLINE TABLE ELECTROSTATICS */
332 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
333 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
334 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
335 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
336 _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)
;
337 Heps = _mm_mul_ps(vfeps,H);
338 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
339 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
340 velec = _mm_mul_ps(qq10,VV);
341 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
342 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq10,FF),_mm_mul_ps(vftabscale,rinv10)));
343
344 /* Update potential sum for this i atom from the interaction with this j atom. */
345 velecsum = _mm_add_ps(velecsum,velec);
346
347 fscal = felec;
348
349 /* Calculate temporary vectorial force */
350 tx = _mm_mul_ps(fscal,dx10);
351 ty = _mm_mul_ps(fscal,dy10);
352 tz = _mm_mul_ps(fscal,dz10);
353
354 /* Update vectorial force */
355 fix1 = _mm_add_ps(fix1,tx);
356 fiy1 = _mm_add_ps(fiy1,ty);
357 fiz1 = _mm_add_ps(fiz1,tz);
358
359 fjx0 = _mm_add_ps(fjx0,tx);
360 fjy0 = _mm_add_ps(fjy0,ty);
361 fjz0 = _mm_add_ps(fjz0,tz);
362
363 /**************************
364 * CALCULATE INTERACTIONS *
365 **************************/
366
367 r20 = _mm_mul_ps(rsq20,rinv20);
368
369 /* Compute parameters for interactions between i and j atoms */
370 qq20 = _mm_mul_ps(iq2,jq0);
371
372 /* Calculate table index by multiplying r with table scale and truncate to integer */
373 rt = _mm_mul_ps(r20,vftabscale);
374 vfitab = _mm_cvttps_epi32(rt);
375 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
376 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
377
378 /* CUBIC SPLINE TABLE ELECTROSTATICS */
379 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
380 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
381 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
382 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
383 _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)
;
384 Heps = _mm_mul_ps(vfeps,H);
385 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
386 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
387 velec = _mm_mul_ps(qq20,VV);
388 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
389 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq20,FF),_mm_mul_ps(vftabscale,rinv20)));
390
391 /* Update potential sum for this i atom from the interaction with this j atom. */
392 velecsum = _mm_add_ps(velecsum,velec);
393
394 fscal = felec;
395
396 /* Calculate temporary vectorial force */
397 tx = _mm_mul_ps(fscal,dx20);
398 ty = _mm_mul_ps(fscal,dy20);
399 tz = _mm_mul_ps(fscal,dz20);
400
401 /* Update vectorial force */
402 fix2 = _mm_add_ps(fix2,tx);
403 fiy2 = _mm_add_ps(fiy2,ty);
404 fiz2 = _mm_add_ps(fiz2,tz);
405
406 fjx0 = _mm_add_ps(fjx0,tx);
407 fjy0 = _mm_add_ps(fjy0,ty);
408 fjz0 = _mm_add_ps(fjz0,tz);
409
410 /**************************
411 * CALCULATE INTERACTIONS *
412 **************************/
413
414 r30 = _mm_mul_ps(rsq30,rinv30);
415
416 /* Compute parameters for interactions between i and j atoms */
417 qq30 = _mm_mul_ps(iq3,jq0);
418
419 /* Calculate table index by multiplying r with table scale and truncate to integer */
420 rt = _mm_mul_ps(r30,vftabscale);
421 vfitab = _mm_cvttps_epi32(rt);
422 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
423 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
424
425 /* CUBIC SPLINE TABLE ELECTROSTATICS */
426 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
427 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
428 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
429 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
430 _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)
;
431 Heps = _mm_mul_ps(vfeps,H);
432 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
433 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
434 velec = _mm_mul_ps(qq30,VV);
435 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
436 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq30,FF),_mm_mul_ps(vftabscale,rinv30)));
437
438 /* Update potential sum for this i atom from the interaction with this j atom. */
439 velecsum = _mm_add_ps(velecsum,velec);
440
441 fscal = felec;
442
443 /* Calculate temporary vectorial force */
444 tx = _mm_mul_ps(fscal,dx30);
445 ty = _mm_mul_ps(fscal,dy30);
446 tz = _mm_mul_ps(fscal,dz30);
447
448 /* Update vectorial force */
449 fix3 = _mm_add_ps(fix3,tx);
450 fiy3 = _mm_add_ps(fiy3,ty);
451 fiz3 = _mm_add_ps(fiz3,tz);
452
453 fjx0 = _mm_add_ps(fjx0,tx);
454 fjy0 = _mm_add_ps(fjy0,ty);
455 fjz0 = _mm_add_ps(fjz0,tz);
456
457 fjptrA = f+j_coord_offsetA;
458 fjptrB = f+j_coord_offsetB;
459 fjptrC = f+j_coord_offsetC;
460 fjptrD = f+j_coord_offsetD;
461
462 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
463
464 /* Inner loop uses 185 flops */
465 }
466
467 if(jidx<j_index_end)
468 {
469
470 /* Get j neighbor index, and coordinate index */
471 jnrlistA = jjnr[jidx];
472 jnrlistB = jjnr[jidx+1];
473 jnrlistC = jjnr[jidx+2];
474 jnrlistD = jjnr[jidx+3];
475 /* Sign of each element will be negative for non-real atoms.
476 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
477 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
478 */
479 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
480 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
481 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
482 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
483 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
484 j_coord_offsetA = DIM3*jnrA;
485 j_coord_offsetB = DIM3*jnrB;
486 j_coord_offsetC = DIM3*jnrC;
487 j_coord_offsetD = DIM3*jnrD;
488
489 /* load j atom coordinates */
490 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
491 x+j_coord_offsetC,x+j_coord_offsetD,
492 &jx0,&jy0,&jz0);
493
494 /* Calculate displacement vector */
495 dx00 = _mm_sub_ps(ix0,jx0);
496 dy00 = _mm_sub_ps(iy0,jy0);
497 dz00 = _mm_sub_ps(iz0,jz0);
498 dx10 = _mm_sub_ps(ix1,jx0);
499 dy10 = _mm_sub_ps(iy1,jy0);
500 dz10 = _mm_sub_ps(iz1,jz0);
501 dx20 = _mm_sub_ps(ix2,jx0);
502 dy20 = _mm_sub_ps(iy2,jy0);
503 dz20 = _mm_sub_ps(iz2,jz0);
504 dx30 = _mm_sub_ps(ix3,jx0);
505 dy30 = _mm_sub_ps(iy3,jy0);
506 dz30 = _mm_sub_ps(iz3,jz0);
507
508 /* Calculate squared distance and things based on it */
509 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
510 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
511 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
512 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
513
514 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
515 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
516 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
517 rinv30 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq30);
518
519 /* Load parameters for j particles */
520 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
521 charge+jnrC+0,charge+jnrD+0);
522 vdwjidx0A = 2*vdwtype[jnrA+0];
523 vdwjidx0B = 2*vdwtype[jnrB+0];
524 vdwjidx0C = 2*vdwtype[jnrC+0];
525 vdwjidx0D = 2*vdwtype[jnrD+0];
526
527 fjx0 = _mm_setzero_ps();
528 fjy0 = _mm_setzero_ps();
529 fjz0 = _mm_setzero_ps();
530
531 /**************************
532 * CALCULATE INTERACTIONS *
533 **************************/
534
535 r00 = _mm_mul_ps(rsq00,rinv00);
536 r00 = _mm_andnot_ps(dummy_mask,r00);
537
538 /* Compute parameters for interactions between i and j atoms */
539 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
540 vdwparam+vdwioffset0+vdwjidx0B,
541 vdwparam+vdwioffset0+vdwjidx0C,
542 vdwparam+vdwioffset0+vdwjidx0D,
543 &c6_00,&c12_00);
544
545 /* Calculate table index by multiplying r with table scale and truncate to integer */
546 rt = _mm_mul_ps(r00,vftabscale);
547 vfitab = _mm_cvttps_epi32(rt);
548 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
549 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
550
551 /* CUBIC SPLINE TABLE DISPERSION */
552 vfitab = _mm_add_epi32(vfitab,ifour);
553 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
554 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
555 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
556 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
557 _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)
;
558 Heps = _mm_mul_ps(vfeps,H);
559 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
560 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
561 vvdw6 = _mm_mul_ps(c6_00,VV);
562 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
563 fvdw6 = _mm_mul_ps(c6_00,FF);
564
565 /* CUBIC SPLINE TABLE REPULSION */
566 vfitab = _mm_add_epi32(vfitab,ifour);
567 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
568 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
569 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
570 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
571 _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)
;
572 Heps = _mm_mul_ps(vfeps,H);
573 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
574 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
575 vvdw12 = _mm_mul_ps(c12_00,VV);
576 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
577 fvdw12 = _mm_mul_ps(c12_00,FF);
578 vvdw = _mm_add_ps(vvdw12,vvdw6);
579 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
580
581 /* Update potential sum for this i atom from the interaction with this j atom. */
582 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
583 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
584
585 fscal = fvdw;
586
587 fscal = _mm_andnot_ps(dummy_mask,fscal);
588
589 /* Calculate temporary vectorial force */
590 tx = _mm_mul_ps(fscal,dx00);
591 ty = _mm_mul_ps(fscal,dy00);
592 tz = _mm_mul_ps(fscal,dz00);
593
594 /* Update vectorial force */
595 fix0 = _mm_add_ps(fix0,tx);
596 fiy0 = _mm_add_ps(fiy0,ty);
597 fiz0 = _mm_add_ps(fiz0,tz);
598
599 fjx0 = _mm_add_ps(fjx0,tx);
600 fjy0 = _mm_add_ps(fjy0,ty);
601 fjz0 = _mm_add_ps(fjz0,tz);
602
603 /**************************
604 * CALCULATE INTERACTIONS *
605 **************************/
606
607 r10 = _mm_mul_ps(rsq10,rinv10);
608 r10 = _mm_andnot_ps(dummy_mask,r10);
609
610 /* Compute parameters for interactions between i and j atoms */
611 qq10 = _mm_mul_ps(iq1,jq0);
612
613 /* Calculate table index by multiplying r with table scale and truncate to integer */
614 rt = _mm_mul_ps(r10,vftabscale);
615 vfitab = _mm_cvttps_epi32(rt);
616 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
617 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
618
619 /* CUBIC SPLINE TABLE ELECTROSTATICS */
620 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
621 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
622 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
623 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
624 _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)
;
625 Heps = _mm_mul_ps(vfeps,H);
626 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
627 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
628 velec = _mm_mul_ps(qq10,VV);
629 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
630 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq10,FF),_mm_mul_ps(vftabscale,rinv10)));
631
632 /* Update potential sum for this i atom from the interaction with this j atom. */
633 velec = _mm_andnot_ps(dummy_mask,velec);
634 velecsum = _mm_add_ps(velecsum,velec);
635
636 fscal = felec;
637
638 fscal = _mm_andnot_ps(dummy_mask,fscal);
639
640 /* Calculate temporary vectorial force */
641 tx = _mm_mul_ps(fscal,dx10);
642 ty = _mm_mul_ps(fscal,dy10);
643 tz = _mm_mul_ps(fscal,dz10);
644
645 /* Update vectorial force */
646 fix1 = _mm_add_ps(fix1,tx);
647 fiy1 = _mm_add_ps(fiy1,ty);
648 fiz1 = _mm_add_ps(fiz1,tz);
649
650 fjx0 = _mm_add_ps(fjx0,tx);
651 fjy0 = _mm_add_ps(fjy0,ty);
652 fjz0 = _mm_add_ps(fjz0,tz);
653
654 /**************************
655 * CALCULATE INTERACTIONS *
656 **************************/
657
658 r20 = _mm_mul_ps(rsq20,rinv20);
659 r20 = _mm_andnot_ps(dummy_mask,r20);
660
661 /* Compute parameters for interactions between i and j atoms */
662 qq20 = _mm_mul_ps(iq2,jq0);
663
664 /* Calculate table index by multiplying r with table scale and truncate to integer */
665 rt = _mm_mul_ps(r20,vftabscale);
666 vfitab = _mm_cvttps_epi32(rt);
667 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
668 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
669
670 /* CUBIC SPLINE TABLE ELECTROSTATICS */
671 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
672 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
673 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
674 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
675 _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)
;
676 Heps = _mm_mul_ps(vfeps,H);
677 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
678 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
679 velec = _mm_mul_ps(qq20,VV);
680 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
681 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq20,FF),_mm_mul_ps(vftabscale,rinv20)));
682
683 /* Update potential sum for this i atom from the interaction with this j atom. */
684 velec = _mm_andnot_ps(dummy_mask,velec);
685 velecsum = _mm_add_ps(velecsum,velec);
686
687 fscal = felec;
688
689 fscal = _mm_andnot_ps(dummy_mask,fscal);
690
691 /* Calculate temporary vectorial force */
692 tx = _mm_mul_ps(fscal,dx20);
693 ty = _mm_mul_ps(fscal,dy20);
694 tz = _mm_mul_ps(fscal,dz20);
695
696 /* Update vectorial force */
697 fix2 = _mm_add_ps(fix2,tx);
698 fiy2 = _mm_add_ps(fiy2,ty);
699 fiz2 = _mm_add_ps(fiz2,tz);
700
701 fjx0 = _mm_add_ps(fjx0,tx);
702 fjy0 = _mm_add_ps(fjy0,ty);
703 fjz0 = _mm_add_ps(fjz0,tz);
704
705 /**************************
706 * CALCULATE INTERACTIONS *
707 **************************/
708
709 r30 = _mm_mul_ps(rsq30,rinv30);
710 r30 = _mm_andnot_ps(dummy_mask,r30);
711
712 /* Compute parameters for interactions between i and j atoms */
713 qq30 = _mm_mul_ps(iq3,jq0);
714
715 /* Calculate table index by multiplying r with table scale and truncate to integer */
716 rt = _mm_mul_ps(r30,vftabscale);
717 vfitab = _mm_cvttps_epi32(rt);
718 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
719 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
720
721 /* CUBIC SPLINE TABLE ELECTROSTATICS */
722 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
723 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
724 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
725 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
726 _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)
;
727 Heps = _mm_mul_ps(vfeps,H);
728 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
729 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
730 velec = _mm_mul_ps(qq30,VV);
731 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
732 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq30,FF),_mm_mul_ps(vftabscale,rinv30)));
733
734 /* Update potential sum for this i atom from the interaction with this j atom. */
735 velec = _mm_andnot_ps(dummy_mask,velec);
736 velecsum = _mm_add_ps(velecsum,velec);
737
738 fscal = felec;
739
740 fscal = _mm_andnot_ps(dummy_mask,fscal);
741
742 /* Calculate temporary vectorial force */
743 tx = _mm_mul_ps(fscal,dx30);
744 ty = _mm_mul_ps(fscal,dy30);
745 tz = _mm_mul_ps(fscal,dz30);
746
747 /* Update vectorial force */
748 fix3 = _mm_add_ps(fix3,tx);
749 fiy3 = _mm_add_ps(fiy3,ty);
750 fiz3 = _mm_add_ps(fiz3,tz);
751
752 fjx0 = _mm_add_ps(fjx0,tx);
753 fjy0 = _mm_add_ps(fjy0,ty);
754 fjz0 = _mm_add_ps(fjz0,tz);
755
756 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
757 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
758 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
759 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
760
761 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
762
763 /* Inner loop uses 189 flops */
764 }
765
766 /* End of innermost loop */
767
768 gmx_mm_update_iforce_4atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
769 f+i_coord_offset,fshift+i_shift_offset);
770
771 ggid = gid[iidx];
772 /* Update potential energies */
773 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
774 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
775
776 /* Increment number of inner iterations */
777 inneriter += j_index_end - j_index_start;
778
779 /* Outer loop uses 26 flops */
780 }
781
782 /* Increment number of outer iterations */
783 outeriter += nri;
784
785 /* Update outer/inner flops */
786
787 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_VF,outeriter*26 + inneriter*189)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4_VF] += outeriter*26 + inneriter
*189
;
788}
789/*
790 * Gromacs nonbonded kernel: nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sse4_1_single
791 * Electrostatics interaction: CubicSplineTable
792 * VdW interaction: CubicSplineTable
793 * Geometry: Water4-Particle
794 * Calculate force/pot: Force
795 */
796void
797nb_kernel_ElecCSTab_VdwCSTab_GeomW4P1_F_sse4_1_single
798 (t_nblist * gmx_restrict nlist,
799 rvec * gmx_restrict xx,
800 rvec * gmx_restrict ff,
801 t_forcerec * gmx_restrict fr,
802 t_mdatoms * gmx_restrict mdatoms,
803 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
804 t_nrnb * gmx_restrict nrnb)
805{
806 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
807 * just 0 for non-waters.
808 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
809 * jnr indices corresponding to data put in the four positions in the SIMD register.
810 */
811 int i_shift_offset,i_coord_offset,outeriter,inneriter;
812 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
813 int jnrA,jnrB,jnrC,jnrD;
814 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
815 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
816 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
817 real rcutoff_scalar;
818 real *shiftvec,*fshift,*x,*f;
819 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
820 real scratch[4*DIM3];
821 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
822 int vdwioffset0;
823 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
824 int vdwioffset1;
825 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
826 int vdwioffset2;
827 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
828 int vdwioffset3;
829 __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
830 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
831 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
832 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
833 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
834 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
835 __m128 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
836 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
837 real *charge;
838 int nvdwtype;
839 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
840 int *vdwtype;
841 real *vdwparam;
842 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
843 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
844 __m128i vfitab;
845 __m128i ifour = _mm_set1_epi32(4);
846 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
847 real *vftab;
848 __m128 dummy_mask,cutoff_mask;
849 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
850 __m128 one = _mm_set1_ps(1.0);
851 __m128 two = _mm_set1_ps(2.0);
852 x = xx[0];
853 f = ff[0];
854
855 nri = nlist->nri;
856 iinr = nlist->iinr;
857 jindex = nlist->jindex;
858 jjnr = nlist->jjnr;
859 shiftidx = nlist->shift;
860 gid = nlist->gid;
Value stored to 'gid' is never read
861 shiftvec = fr->shift_vec[0];
862 fshift = fr->fshift[0];
863 facel = _mm_set1_ps(fr->epsfac);
864 charge = mdatoms->chargeA;
865 nvdwtype = fr->ntype;
866 vdwparam = fr->nbfp;
867 vdwtype = mdatoms->typeA;
868
869 vftab = kernel_data->table_elec_vdw->data;
870 vftabscale = _mm_set1_ps(kernel_data->table_elec_vdw->scale);
871
872 /* Setup water-specific parameters */
873 inr = nlist->iinr[0];
874 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
875 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
876 iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3]));
877 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
878
879 /* Avoid stupid compiler warnings */
880 jnrA = jnrB = jnrC = jnrD = 0;
881 j_coord_offsetA = 0;
882 j_coord_offsetB = 0;
883 j_coord_offsetC = 0;
884 j_coord_offsetD = 0;
885
886 outeriter = 0;
887 inneriter = 0;
888
889 for(iidx=0;iidx<4*DIM3;iidx++)
890 {
891 scratch[iidx] = 0.0;
892 }
893
894 /* Start outer loop over neighborlists */
895 for(iidx=0; iidx<nri; iidx++)
896 {
897 /* Load shift vector for this list */
898 i_shift_offset = DIM3*shiftidx[iidx];
899
900 /* Load limits for loop over neighbors */
901 j_index_start = jindex[iidx];
902 j_index_end = jindex[iidx+1];
903
904 /* Get outer coordinate index */
905 inr = iinr[iidx];
906 i_coord_offset = DIM3*inr;
907
908 /* Load i particle coords and add shift vector */
909 gmx_mm_load_shift_and_4rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
910 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
911
912 fix0 = _mm_setzero_ps();
913 fiy0 = _mm_setzero_ps();
914 fiz0 = _mm_setzero_ps();
915 fix1 = _mm_setzero_ps();
916 fiy1 = _mm_setzero_ps();
917 fiz1 = _mm_setzero_ps();
918 fix2 = _mm_setzero_ps();
919 fiy2 = _mm_setzero_ps();
920 fiz2 = _mm_setzero_ps();
921 fix3 = _mm_setzero_ps();
922 fiy3 = _mm_setzero_ps();
923 fiz3 = _mm_setzero_ps();
924
925 /* Start inner kernel loop */
926 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
927 {
928
929 /* Get j neighbor index, and coordinate index */
930 jnrA = jjnr[jidx];
931 jnrB = jjnr[jidx+1];
932 jnrC = jjnr[jidx+2];
933 jnrD = jjnr[jidx+3];
934 j_coord_offsetA = DIM3*jnrA;
935 j_coord_offsetB = DIM3*jnrB;
936 j_coord_offsetC = DIM3*jnrC;
937 j_coord_offsetD = DIM3*jnrD;
938
939 /* load j atom coordinates */
940 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
941 x+j_coord_offsetC,x+j_coord_offsetD,
942 &jx0,&jy0,&jz0);
943
944 /* Calculate displacement vector */
945 dx00 = _mm_sub_ps(ix0,jx0);
946 dy00 = _mm_sub_ps(iy0,jy0);
947 dz00 = _mm_sub_ps(iz0,jz0);
948 dx10 = _mm_sub_ps(ix1,jx0);
949 dy10 = _mm_sub_ps(iy1,jy0);
950 dz10 = _mm_sub_ps(iz1,jz0);
951 dx20 = _mm_sub_ps(ix2,jx0);
952 dy20 = _mm_sub_ps(iy2,jy0);
953 dz20 = _mm_sub_ps(iz2,jz0);
954 dx30 = _mm_sub_ps(ix3,jx0);
955 dy30 = _mm_sub_ps(iy3,jy0);
956 dz30 = _mm_sub_ps(iz3,jz0);
957
958 /* Calculate squared distance and things based on it */
959 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
960 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
961 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
962 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
963
964 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
965 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
966 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
967 rinv30 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq30);
968
969 /* Load parameters for j particles */
970 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
971 charge+jnrC+0,charge+jnrD+0);
972 vdwjidx0A = 2*vdwtype[jnrA+0];
973 vdwjidx0B = 2*vdwtype[jnrB+0];
974 vdwjidx0C = 2*vdwtype[jnrC+0];
975 vdwjidx0D = 2*vdwtype[jnrD+0];
976
977 fjx0 = _mm_setzero_ps();
978 fjy0 = _mm_setzero_ps();
979 fjz0 = _mm_setzero_ps();
980
981 /**************************
982 * CALCULATE INTERACTIONS *
983 **************************/
984
985 r00 = _mm_mul_ps(rsq00,rinv00);
986
987 /* Compute parameters for interactions between i and j atoms */
988 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
989 vdwparam+vdwioffset0+vdwjidx0B,
990 vdwparam+vdwioffset0+vdwjidx0C,
991 vdwparam+vdwioffset0+vdwjidx0D,
992 &c6_00,&c12_00);
993
994 /* Calculate table index by multiplying r with table scale and truncate to integer */
995 rt = _mm_mul_ps(r00,vftabscale);
996 vfitab = _mm_cvttps_epi32(rt);
997 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
998 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
999
1000 /* CUBIC SPLINE TABLE DISPERSION */
1001 vfitab = _mm_add_epi32(vfitab,ifour);
1002 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1003 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1004 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1005 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1006 _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)
;
1007 Heps = _mm_mul_ps(vfeps,H);
1008 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1009 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1010 fvdw6 = _mm_mul_ps(c6_00,FF);
1011
1012 /* CUBIC SPLINE TABLE REPULSION */
1013 vfitab = _mm_add_epi32(vfitab,ifour);
1014 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1015 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1016 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1017 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1018 _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)
;
1019 Heps = _mm_mul_ps(vfeps,H);
1020 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1021 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1022 fvdw12 = _mm_mul_ps(c12_00,FF);
1023 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1024
1025 fscal = fvdw;
1026
1027 /* Calculate temporary vectorial force */
1028 tx = _mm_mul_ps(fscal,dx00);
1029 ty = _mm_mul_ps(fscal,dy00);
1030 tz = _mm_mul_ps(fscal,dz00);
1031
1032 /* Update vectorial force */
1033 fix0 = _mm_add_ps(fix0,tx);
1034 fiy0 = _mm_add_ps(fiy0,ty);
1035 fiz0 = _mm_add_ps(fiz0,tz);
1036
1037 fjx0 = _mm_add_ps(fjx0,tx);
1038 fjy0 = _mm_add_ps(fjy0,ty);
1039 fjz0 = _mm_add_ps(fjz0,tz);
1040
1041 /**************************
1042 * CALCULATE INTERACTIONS *
1043 **************************/
1044
1045 r10 = _mm_mul_ps(rsq10,rinv10);
1046
1047 /* Compute parameters for interactions between i and j atoms */
1048 qq10 = _mm_mul_ps(iq1,jq0);
1049
1050 /* Calculate table index by multiplying r with table scale and truncate to integer */
1051 rt = _mm_mul_ps(r10,vftabscale);
1052 vfitab = _mm_cvttps_epi32(rt);
1053 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1054 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1055
1056 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1057 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1058 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1059 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1060 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1061 _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)
;
1062 Heps = _mm_mul_ps(vfeps,H);
1063 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1064 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1065 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq10,FF),_mm_mul_ps(vftabscale,rinv10)));
1066
1067 fscal = felec;
1068
1069 /* Calculate temporary vectorial force */
1070 tx = _mm_mul_ps(fscal,dx10);
1071 ty = _mm_mul_ps(fscal,dy10);
1072 tz = _mm_mul_ps(fscal,dz10);
1073
1074 /* Update vectorial force */
1075 fix1 = _mm_add_ps(fix1,tx);
1076 fiy1 = _mm_add_ps(fiy1,ty);
1077 fiz1 = _mm_add_ps(fiz1,tz);
1078
1079 fjx0 = _mm_add_ps(fjx0,tx);
1080 fjy0 = _mm_add_ps(fjy0,ty);
1081 fjz0 = _mm_add_ps(fjz0,tz);
1082
1083 /**************************
1084 * CALCULATE INTERACTIONS *
1085 **************************/
1086
1087 r20 = _mm_mul_ps(rsq20,rinv20);
1088
1089 /* Compute parameters for interactions between i and j atoms */
1090 qq20 = _mm_mul_ps(iq2,jq0);
1091
1092 /* Calculate table index by multiplying r with table scale and truncate to integer */
1093 rt = _mm_mul_ps(r20,vftabscale);
1094 vfitab = _mm_cvttps_epi32(rt);
1095 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1096 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1097
1098 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1099 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1100 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1101 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1102 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1103 _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)
;
1104 Heps = _mm_mul_ps(vfeps,H);
1105 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1106 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1107 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq20,FF),_mm_mul_ps(vftabscale,rinv20)));
1108
1109 fscal = felec;
1110
1111 /* Calculate temporary vectorial force */
1112 tx = _mm_mul_ps(fscal,dx20);
1113 ty = _mm_mul_ps(fscal,dy20);
1114 tz = _mm_mul_ps(fscal,dz20);
1115
1116 /* Update vectorial force */
1117 fix2 = _mm_add_ps(fix2,tx);
1118 fiy2 = _mm_add_ps(fiy2,ty);
1119 fiz2 = _mm_add_ps(fiz2,tz);
1120
1121 fjx0 = _mm_add_ps(fjx0,tx);
1122 fjy0 = _mm_add_ps(fjy0,ty);
1123 fjz0 = _mm_add_ps(fjz0,tz);
1124
1125 /**************************
1126 * CALCULATE INTERACTIONS *
1127 **************************/
1128
1129 r30 = _mm_mul_ps(rsq30,rinv30);
1130
1131 /* Compute parameters for interactions between i and j atoms */
1132 qq30 = _mm_mul_ps(iq3,jq0);
1133
1134 /* Calculate table index by multiplying r with table scale and truncate to integer */
1135 rt = _mm_mul_ps(r30,vftabscale);
1136 vfitab = _mm_cvttps_epi32(rt);
1137 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1138 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1139
1140 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1141 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1142 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1143 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1144 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1145 _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)
;
1146 Heps = _mm_mul_ps(vfeps,H);
1147 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1148 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1149 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq30,FF),_mm_mul_ps(vftabscale,rinv30)));
1150
1151 fscal = felec;
1152
1153 /* Calculate temporary vectorial force */
1154 tx = _mm_mul_ps(fscal,dx30);
1155 ty = _mm_mul_ps(fscal,dy30);
1156 tz = _mm_mul_ps(fscal,dz30);
1157
1158 /* Update vectorial force */
1159 fix3 = _mm_add_ps(fix3,tx);
1160 fiy3 = _mm_add_ps(fiy3,ty);
1161 fiz3 = _mm_add_ps(fiz3,tz);
1162
1163 fjx0 = _mm_add_ps(fjx0,tx);
1164 fjy0 = _mm_add_ps(fjy0,ty);
1165 fjz0 = _mm_add_ps(fjz0,tz);
1166
1167 fjptrA = f+j_coord_offsetA;
1168 fjptrB = f+j_coord_offsetB;
1169 fjptrC = f+j_coord_offsetC;
1170 fjptrD = f+j_coord_offsetD;
1171
1172 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1173
1174 /* Inner loop uses 165 flops */
1175 }
1176
1177 if(jidx<j_index_end)
1178 {
1179
1180 /* Get j neighbor index, and coordinate index */
1181 jnrlistA = jjnr[jidx];
1182 jnrlistB = jjnr[jidx+1];
1183 jnrlistC = jjnr[jidx+2];
1184 jnrlistD = jjnr[jidx+3];
1185 /* Sign of each element will be negative for non-real atoms.
1186 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
1187 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
1188 */
1189 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
1190 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
1191 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
1192 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
1193 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
1194 j_coord_offsetA = DIM3*jnrA;
1195 j_coord_offsetB = DIM3*jnrB;
1196 j_coord_offsetC = DIM3*jnrC;
1197 j_coord_offsetD = DIM3*jnrD;
1198
1199 /* load j atom coordinates */
1200 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
1201 x+j_coord_offsetC,x+j_coord_offsetD,
1202 &jx0,&jy0,&jz0);
1203
1204 /* Calculate displacement vector */
1205 dx00 = _mm_sub_ps(ix0,jx0);
1206 dy00 = _mm_sub_ps(iy0,jy0);
1207 dz00 = _mm_sub_ps(iz0,jz0);
1208 dx10 = _mm_sub_ps(ix1,jx0);
1209 dy10 = _mm_sub_ps(iy1,jy0);
1210 dz10 = _mm_sub_ps(iz1,jz0);
1211 dx20 = _mm_sub_ps(ix2,jx0);
1212 dy20 = _mm_sub_ps(iy2,jy0);
1213 dz20 = _mm_sub_ps(iz2,jz0);
1214 dx30 = _mm_sub_ps(ix3,jx0);
1215 dy30 = _mm_sub_ps(iy3,jy0);
1216 dz30 = _mm_sub_ps(iz3,jz0);
1217
1218 /* Calculate squared distance and things based on it */
1219 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
1220 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
1221 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
1222 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
1223
1224 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
1225 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
1226 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
1227 rinv30 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq30);
1228
1229 /* Load parameters for j particles */
1230 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
1231 charge+jnrC+0,charge+jnrD+0);
1232 vdwjidx0A = 2*vdwtype[jnrA+0];
1233 vdwjidx0B = 2*vdwtype[jnrB+0];
1234 vdwjidx0C = 2*vdwtype[jnrC+0];
1235 vdwjidx0D = 2*vdwtype[jnrD+0];
1236
1237 fjx0 = _mm_setzero_ps();
1238 fjy0 = _mm_setzero_ps();
1239 fjz0 = _mm_setzero_ps();
1240
1241 /**************************
1242 * CALCULATE INTERACTIONS *
1243 **************************/
1244
1245 r00 = _mm_mul_ps(rsq00,rinv00);
1246 r00 = _mm_andnot_ps(dummy_mask,r00);
1247
1248 /* Compute parameters for interactions between i and j atoms */
1249 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
1250 vdwparam+vdwioffset0+vdwjidx0B,
1251 vdwparam+vdwioffset0+vdwjidx0C,
1252 vdwparam+vdwioffset0+vdwjidx0D,
1253 &c6_00,&c12_00);
1254
1255 /* Calculate table index by multiplying r with table scale and truncate to integer */
1256 rt = _mm_mul_ps(r00,vftabscale);
1257 vfitab = _mm_cvttps_epi32(rt);
1258 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1259 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1260
1261 /* CUBIC SPLINE TABLE DISPERSION */
1262 vfitab = _mm_add_epi32(vfitab,ifour);
1263 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1264 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1265 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1266 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1267 _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)
;
1268 Heps = _mm_mul_ps(vfeps,H);
1269 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1270 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1271 fvdw6 = _mm_mul_ps(c6_00,FF);
1272
1273 /* CUBIC SPLINE TABLE REPULSION */
1274 vfitab = _mm_add_epi32(vfitab,ifour);
1275 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1276 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1277 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1278 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1279 _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)
;
1280 Heps = _mm_mul_ps(vfeps,H);
1281 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1282 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1283 fvdw12 = _mm_mul_ps(c12_00,FF);
1284 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1285
1286 fscal = fvdw;
1287
1288 fscal = _mm_andnot_ps(dummy_mask,fscal);
1289
1290 /* Calculate temporary vectorial force */
1291 tx = _mm_mul_ps(fscal,dx00);
1292 ty = _mm_mul_ps(fscal,dy00);
1293 tz = _mm_mul_ps(fscal,dz00);
1294
1295 /* Update vectorial force */
1296 fix0 = _mm_add_ps(fix0,tx);
1297 fiy0 = _mm_add_ps(fiy0,ty);
1298 fiz0 = _mm_add_ps(fiz0,tz);
1299
1300 fjx0 = _mm_add_ps(fjx0,tx);
1301 fjy0 = _mm_add_ps(fjy0,ty);
1302 fjz0 = _mm_add_ps(fjz0,tz);
1303
1304 /**************************
1305 * CALCULATE INTERACTIONS *
1306 **************************/
1307
1308 r10 = _mm_mul_ps(rsq10,rinv10);
1309 r10 = _mm_andnot_ps(dummy_mask,r10);
1310
1311 /* Compute parameters for interactions between i and j atoms */
1312 qq10 = _mm_mul_ps(iq1,jq0);
1313
1314 /* Calculate table index by multiplying r with table scale and truncate to integer */
1315 rt = _mm_mul_ps(r10,vftabscale);
1316 vfitab = _mm_cvttps_epi32(rt);
1317 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1318 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1319
1320 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1321 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1322 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1323 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1324 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1325 _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)
;
1326 Heps = _mm_mul_ps(vfeps,H);
1327 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1328 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1329 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq10,FF),_mm_mul_ps(vftabscale,rinv10)));
1330
1331 fscal = felec;
1332
1333 fscal = _mm_andnot_ps(dummy_mask,fscal);
1334
1335 /* Calculate temporary vectorial force */
1336 tx = _mm_mul_ps(fscal,dx10);
1337 ty = _mm_mul_ps(fscal,dy10);
1338 tz = _mm_mul_ps(fscal,dz10);
1339
1340 /* Update vectorial force */
1341 fix1 = _mm_add_ps(fix1,tx);
1342 fiy1 = _mm_add_ps(fiy1,ty);
1343 fiz1 = _mm_add_ps(fiz1,tz);
1344
1345 fjx0 = _mm_add_ps(fjx0,tx);
1346 fjy0 = _mm_add_ps(fjy0,ty);
1347 fjz0 = _mm_add_ps(fjz0,tz);
1348
1349 /**************************
1350 * CALCULATE INTERACTIONS *
1351 **************************/
1352
1353 r20 = _mm_mul_ps(rsq20,rinv20);
1354 r20 = _mm_andnot_ps(dummy_mask,r20);
1355
1356 /* Compute parameters for interactions between i and j atoms */
1357 qq20 = _mm_mul_ps(iq2,jq0);
1358
1359 /* Calculate table index by multiplying r with table scale and truncate to integer */
1360 rt = _mm_mul_ps(r20,vftabscale);
1361 vfitab = _mm_cvttps_epi32(rt);
1362 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1363 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1364
1365 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1366 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1367 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1368 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1369 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1370 _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)
;
1371 Heps = _mm_mul_ps(vfeps,H);
1372 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1373 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1374 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq20,FF),_mm_mul_ps(vftabscale,rinv20)));
1375
1376 fscal = felec;
1377
1378 fscal = _mm_andnot_ps(dummy_mask,fscal);
1379
1380 /* Calculate temporary vectorial force */
1381 tx = _mm_mul_ps(fscal,dx20);
1382 ty = _mm_mul_ps(fscal,dy20);
1383 tz = _mm_mul_ps(fscal,dz20);
1384
1385 /* Update vectorial force */
1386 fix2 = _mm_add_ps(fix2,tx);
1387 fiy2 = _mm_add_ps(fiy2,ty);
1388 fiz2 = _mm_add_ps(fiz2,tz);
1389
1390 fjx0 = _mm_add_ps(fjx0,tx);
1391 fjy0 = _mm_add_ps(fjy0,ty);
1392 fjz0 = _mm_add_ps(fjz0,tz);
1393
1394 /**************************
1395 * CALCULATE INTERACTIONS *
1396 **************************/
1397
1398 r30 = _mm_mul_ps(rsq30,rinv30);
1399 r30 = _mm_andnot_ps(dummy_mask,r30);
1400
1401 /* Compute parameters for interactions between i and j atoms */
1402 qq30 = _mm_mul_ps(iq3,jq0);
1403
1404 /* Calculate table index by multiplying r with table scale and truncate to integer */
1405 rt = _mm_mul_ps(r30,vftabscale);
1406 vfitab = _mm_cvttps_epi32(rt);
1407 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1408 vfitab = _mm_slli_epi32(_mm_add_epi32(vfitab,_mm_slli_epi32(vfitab,1)),2);
1409
1410 /* CUBIC SPLINE TABLE ELECTROSTATICS */
1411 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1412 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1413 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1414 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1415 _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)
;
1416 Heps = _mm_mul_ps(vfeps,H);
1417 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1418 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1419 felec = _mm_xor_ps(signbit,_mm_mul_ps(_mm_mul_ps(qq30,FF),_mm_mul_ps(vftabscale,rinv30)));
1420
1421 fscal = felec;
1422
1423 fscal = _mm_andnot_ps(dummy_mask,fscal);
1424
1425 /* Calculate temporary vectorial force */
1426 tx = _mm_mul_ps(fscal,dx30);
1427 ty = _mm_mul_ps(fscal,dy30);
1428 tz = _mm_mul_ps(fscal,dz30);
1429
1430 /* Update vectorial force */
1431 fix3 = _mm_add_ps(fix3,tx);
1432 fiy3 = _mm_add_ps(fiy3,ty);
1433 fiz3 = _mm_add_ps(fiz3,tz);
1434
1435 fjx0 = _mm_add_ps(fjx0,tx);
1436 fjy0 = _mm_add_ps(fjy0,ty);
1437 fjz0 = _mm_add_ps(fjz0,tz);
1438
1439 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1440 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1441 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1442 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1443
1444 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1445
1446 /* Inner loop uses 169 flops */
1447 }
1448
1449 /* End of innermost loop */
1450
1451 gmx_mm_update_iforce_4atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1452 f+i_coord_offset,fshift+i_shift_offset);
1453
1454 /* Increment number of inner iterations */
1455 inneriter += j_index_end - j_index_start;
1456
1457 /* Outer loop uses 24 flops */
1458 }
1459
1460 /* Increment number of outer iterations */
1461 outeriter += nri;
1462
1463 /* Update outer/inner flops */
1464
1465 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W4_F,outeriter*24 + inneriter*169)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W4_F] += outeriter*24 + inneriter
*169
;
1466}