Bug Summary

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