Bug Summary

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

Annotated Source Code

1/*
2 * This file is part of the GROMACS molecular simulation package.
3 *
4 * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
5 * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
6 * and including many others, as listed in the AUTHORS file in the
7 * top-level source directory and at http://www.gromacs.org.
8 *
9 * GROMACS is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public License
11 * as published by the Free Software Foundation; either version 2.1
12 * of the License, or (at your option) any later version.
13 *
14 * GROMACS is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with GROMACS; if not, see
21 * http://www.gnu.org/licenses, or write to the Free Software Foundation,
22 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 *
24 * If you want to redistribute modifications to GROMACS, please
25 * consider that scientific software is very special. Version
26 * control is crucial - bugs must be traceable. We will be happy to
27 * consider code for inclusion in the official distribution, but
28 * derived work must not be called official GROMACS. Details are found
29 * in the README & COPYING files - if they are missing, get the
30 * official version at http://www.gromacs.org.
31 *
32 * To help us fund GROMACS development, we humbly ask that you cite
33 * the research papers on the package. Check out http://www.gromacs.org.
34 */
35/*
36 * Note: this file was generated by the GROMACS sse4_1_single kernel generator.
37 */
38#ifdef HAVE_CONFIG_H1
39#include <config.h>
40#endif
41
42#include <math.h>
43
44#include "../nb_kernel.h"
45#include "types/simple.h"
46#include "gromacs/math/vec.h"
47#include "nrnb.h"
48
49#include "gromacs/simd/math_x86_sse4_1_single.h"
50#include "kernelutil_x86_sse4_1_single.h"
51
52/*
53 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomW3P1_VF_sse4_1_single
54 * Electrostatics interaction: ReactionField
55 * VdW interaction: CubicSplineTable
56 * Geometry: Water3-Particle
57 * Calculate force/pot: PotentialAndForce
58 */
59void
60nb_kernel_ElecRF_VdwCSTab_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 krf = _mm_set1_ps(fr->ic->k_rf);
126 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
127 crf = _mm_set1_ps(fr->ic->c_rf);
128 nvdwtype = fr->ntype;
129 vdwparam = fr->nbfp;
130 vdwtype = mdatoms->typeA;
131
132 vftab = kernel_data->table_vdw->data;
133 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
134
135 /* Setup water-specific parameters */
136 inr = nlist->iinr[0];
137 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
138 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
139 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
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_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
173 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
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
185 /* Reset potential sums */
186 velecsum = _mm_setzero_ps();
187 vvdwsum = _mm_setzero_ps();
188
189 /* Start inner kernel loop */
190 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
191 {
192
193 /* Get j neighbor index, and coordinate index */
194 jnrA = jjnr[jidx];
195 jnrB = jjnr[jidx+1];
196 jnrC = jjnr[jidx+2];
197 jnrD = jjnr[jidx+3];
198 j_coord_offsetA = DIM3*jnrA;
199 j_coord_offsetB = DIM3*jnrB;
200 j_coord_offsetC = DIM3*jnrC;
201 j_coord_offsetD = DIM3*jnrD;
202
203 /* load j atom coordinates */
204 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
205 x+j_coord_offsetC,x+j_coord_offsetD,
206 &jx0,&jy0,&jz0);
207
208 /* Calculate displacement vector */
209 dx00 = _mm_sub_ps(ix0,jx0);
210 dy00 = _mm_sub_ps(iy0,jy0);
211 dz00 = _mm_sub_ps(iz0,jz0);
212 dx10 = _mm_sub_ps(ix1,jx0);
213 dy10 = _mm_sub_ps(iy1,jy0);
214 dz10 = _mm_sub_ps(iz1,jz0);
215 dx20 = _mm_sub_ps(ix2,jx0);
216 dy20 = _mm_sub_ps(iy2,jy0);
217 dz20 = _mm_sub_ps(iz2,jz0);
218
219 /* Calculate squared distance and things based on it */
220 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
221 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
222 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
223
224 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
225 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
226 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
227
228 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
229 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
230 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
231
232 /* Load parameters for j particles */
233 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
234 charge+jnrC+0,charge+jnrD+0);
235 vdwjidx0A = 2*vdwtype[jnrA+0];
236 vdwjidx0B = 2*vdwtype[jnrB+0];
237 vdwjidx0C = 2*vdwtype[jnrC+0];
238 vdwjidx0D = 2*vdwtype[jnrD+0];
239
240 fjx0 = _mm_setzero_ps();
241 fjy0 = _mm_setzero_ps();
242 fjz0 = _mm_setzero_ps();
243
244 /**************************
245 * CALCULATE INTERACTIONS *
246 **************************/
247
248 r00 = _mm_mul_ps(rsq00,rinv00);
249
250 /* Compute parameters for interactions between i and j atoms */
251 qq00 = _mm_mul_ps(iq0,jq0);
252 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
253 vdwparam+vdwioffset0+vdwjidx0B,
254 vdwparam+vdwioffset0+vdwjidx0C,
255 vdwparam+vdwioffset0+vdwjidx0D,
256 &c6_00,&c12_00);
257
258 /* Calculate table index by multiplying r with table scale and truncate to integer */
259 rt = _mm_mul_ps(r00,vftabscale);
260 vfitab = _mm_cvttps_epi32(rt);
261 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
262 vfitab = _mm_slli_epi32(vfitab,3);
263
264 /* REACTION-FIELD ELECTROSTATICS */
265 velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_add_ps(rinv00,_mm_mul_ps(krf,rsq00)),crf));
266 felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2));
267
268 /* CUBIC SPLINE TABLE DISPERSION */
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 velecsum = _mm_add_ps(velecsum,velec);
299 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
300
301 fscal = _mm_add_ps(felec,fvdw);
302
303 /* Calculate temporary vectorial force */
304 tx = _mm_mul_ps(fscal,dx00);
305 ty = _mm_mul_ps(fscal,dy00);
306 tz = _mm_mul_ps(fscal,dz00);
307
308 /* Update vectorial force */
309 fix0 = _mm_add_ps(fix0,tx);
310 fiy0 = _mm_add_ps(fiy0,ty);
311 fiz0 = _mm_add_ps(fiz0,tz);
312
313 fjx0 = _mm_add_ps(fjx0,tx);
314 fjy0 = _mm_add_ps(fjy0,ty);
315 fjz0 = _mm_add_ps(fjz0,tz);
316
317 /**************************
318 * CALCULATE INTERACTIONS *
319 **************************/
320
321 /* Compute parameters for interactions between i and j atoms */
322 qq10 = _mm_mul_ps(iq1,jq0);
323
324 /* REACTION-FIELD ELECTROSTATICS */
325 velec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_add_ps(rinv10,_mm_mul_ps(krf,rsq10)),crf));
326 felec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_mul_ps(rinv10,rinvsq10),krf2));
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 /* Compute parameters for interactions between i and j atoms */
352 qq20 = _mm_mul_ps(iq2,jq0);
353
354 /* REACTION-FIELD ELECTROSTATICS */
355 velec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_add_ps(rinv20,_mm_mul_ps(krf,rsq20)),crf));
356 felec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_mul_ps(rinv20,rinvsq20),krf2));
357
358 /* Update potential sum for this i atom from the interaction with this j atom. */
359 velecsum = _mm_add_ps(velecsum,velec);
360
361 fscal = felec;
362
363 /* Calculate temporary vectorial force */
364 tx = _mm_mul_ps(fscal,dx20);
365 ty = _mm_mul_ps(fscal,dy20);
366 tz = _mm_mul_ps(fscal,dz20);
367
368 /* Update vectorial force */
369 fix2 = _mm_add_ps(fix2,tx);
370 fiy2 = _mm_add_ps(fiy2,ty);
371 fiz2 = _mm_add_ps(fiz2,tz);
372
373 fjx0 = _mm_add_ps(fjx0,tx);
374 fjy0 = _mm_add_ps(fjy0,ty);
375 fjz0 = _mm_add_ps(fjz0,tz);
376
377 fjptrA = f+j_coord_offsetA;
378 fjptrB = f+j_coord_offsetB;
379 fjptrC = f+j_coord_offsetC;
380 fjptrD = f+j_coord_offsetD;
381
382 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
383
384 /* Inner loop uses 131 flops */
385 }
386
387 if(jidx<j_index_end)
388 {
389
390 /* Get j neighbor index, and coordinate index */
391 jnrlistA = jjnr[jidx];
392 jnrlistB = jjnr[jidx+1];
393 jnrlistC = jjnr[jidx+2];
394 jnrlistD = jjnr[jidx+3];
395 /* Sign of each element will be negative for non-real atoms.
396 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
397 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
398 */
399 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
400 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
401 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
402 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
403 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
404 j_coord_offsetA = DIM3*jnrA;
405 j_coord_offsetB = DIM3*jnrB;
406 j_coord_offsetC = DIM3*jnrC;
407 j_coord_offsetD = DIM3*jnrD;
408
409 /* load j atom coordinates */
410 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
411 x+j_coord_offsetC,x+j_coord_offsetD,
412 &jx0,&jy0,&jz0);
413
414 /* Calculate displacement vector */
415 dx00 = _mm_sub_ps(ix0,jx0);
416 dy00 = _mm_sub_ps(iy0,jy0);
417 dz00 = _mm_sub_ps(iz0,jz0);
418 dx10 = _mm_sub_ps(ix1,jx0);
419 dy10 = _mm_sub_ps(iy1,jy0);
420 dz10 = _mm_sub_ps(iz1,jz0);
421 dx20 = _mm_sub_ps(ix2,jx0);
422 dy20 = _mm_sub_ps(iy2,jy0);
423 dz20 = _mm_sub_ps(iz2,jz0);
424
425 /* Calculate squared distance and things based on it */
426 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
427 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
428 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
429
430 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
431 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
432 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
433
434 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
435 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
436 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
437
438 /* Load parameters for j particles */
439 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
440 charge+jnrC+0,charge+jnrD+0);
441 vdwjidx0A = 2*vdwtype[jnrA+0];
442 vdwjidx0B = 2*vdwtype[jnrB+0];
443 vdwjidx0C = 2*vdwtype[jnrC+0];
444 vdwjidx0D = 2*vdwtype[jnrD+0];
445
446 fjx0 = _mm_setzero_ps();
447 fjy0 = _mm_setzero_ps();
448 fjz0 = _mm_setzero_ps();
449
450 /**************************
451 * CALCULATE INTERACTIONS *
452 **************************/
453
454 r00 = _mm_mul_ps(rsq00,rinv00);
455 r00 = _mm_andnot_ps(dummy_mask,r00);
456
457 /* Compute parameters for interactions between i and j atoms */
458 qq00 = _mm_mul_ps(iq0,jq0);
459 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
460 vdwparam+vdwioffset0+vdwjidx0B,
461 vdwparam+vdwioffset0+vdwjidx0C,
462 vdwparam+vdwioffset0+vdwjidx0D,
463 &c6_00,&c12_00);
464
465 /* Calculate table index by multiplying r with table scale and truncate to integer */
466 rt = _mm_mul_ps(r00,vftabscale);
467 vfitab = _mm_cvttps_epi32(rt);
468 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
469 vfitab = _mm_slli_epi32(vfitab,3);
470
471 /* REACTION-FIELD ELECTROSTATICS */
472 velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_add_ps(rinv00,_mm_mul_ps(krf,rsq00)),crf));
473 felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2));
474
475 /* CUBIC SPLINE TABLE DISPERSION */
476 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
477 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
478 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
479 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
480 _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)
;
481 Heps = _mm_mul_ps(vfeps,H);
482 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
483 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
484 vvdw6 = _mm_mul_ps(c6_00,VV);
485 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
486 fvdw6 = _mm_mul_ps(c6_00,FF);
487
488 /* CUBIC SPLINE TABLE REPULSION */
489 vfitab = _mm_add_epi32(vfitab,ifour);
490 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
491 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
492 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
493 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
494 _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)
;
495 Heps = _mm_mul_ps(vfeps,H);
496 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
497 VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp));
498 vvdw12 = _mm_mul_ps(c12_00,VV);
499 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
500 fvdw12 = _mm_mul_ps(c12_00,FF);
501 vvdw = _mm_add_ps(vvdw12,vvdw6);
502 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
503
504 /* Update potential sum for this i atom from the interaction with this j atom. */
505 velec = _mm_andnot_ps(dummy_mask,velec);
506 velecsum = _mm_add_ps(velecsum,velec);
507 vvdw = _mm_andnot_ps(dummy_mask,vvdw);
508 vvdwsum = _mm_add_ps(vvdwsum,vvdw);
509
510 fscal = _mm_add_ps(felec,fvdw);
511
512 fscal = _mm_andnot_ps(dummy_mask,fscal);
513
514 /* Calculate temporary vectorial force */
515 tx = _mm_mul_ps(fscal,dx00);
516 ty = _mm_mul_ps(fscal,dy00);
517 tz = _mm_mul_ps(fscal,dz00);
518
519 /* Update vectorial force */
520 fix0 = _mm_add_ps(fix0,tx);
521 fiy0 = _mm_add_ps(fiy0,ty);
522 fiz0 = _mm_add_ps(fiz0,tz);
523
524 fjx0 = _mm_add_ps(fjx0,tx);
525 fjy0 = _mm_add_ps(fjy0,ty);
526 fjz0 = _mm_add_ps(fjz0,tz);
527
528 /**************************
529 * CALCULATE INTERACTIONS *
530 **************************/
531
532 /* Compute parameters for interactions between i and j atoms */
533 qq10 = _mm_mul_ps(iq1,jq0);
534
535 /* REACTION-FIELD ELECTROSTATICS */
536 velec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_add_ps(rinv10,_mm_mul_ps(krf,rsq10)),crf));
537 felec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_mul_ps(rinv10,rinvsq10),krf2));
538
539 /* Update potential sum for this i atom from the interaction with this j atom. */
540 velec = _mm_andnot_ps(dummy_mask,velec);
541 velecsum = _mm_add_ps(velecsum,velec);
542
543 fscal = felec;
544
545 fscal = _mm_andnot_ps(dummy_mask,fscal);
546
547 /* Calculate temporary vectorial force */
548 tx = _mm_mul_ps(fscal,dx10);
549 ty = _mm_mul_ps(fscal,dy10);
550 tz = _mm_mul_ps(fscal,dz10);
551
552 /* Update vectorial force */
553 fix1 = _mm_add_ps(fix1,tx);
554 fiy1 = _mm_add_ps(fiy1,ty);
555 fiz1 = _mm_add_ps(fiz1,tz);
556
557 fjx0 = _mm_add_ps(fjx0,tx);
558 fjy0 = _mm_add_ps(fjy0,ty);
559 fjz0 = _mm_add_ps(fjz0,tz);
560
561 /**************************
562 * CALCULATE INTERACTIONS *
563 **************************/
564
565 /* Compute parameters for interactions between i and j atoms */
566 qq20 = _mm_mul_ps(iq2,jq0);
567
568 /* REACTION-FIELD ELECTROSTATICS */
569 velec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_add_ps(rinv20,_mm_mul_ps(krf,rsq20)),crf));
570 felec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_mul_ps(rinv20,rinvsq20),krf2));
571
572 /* Update potential sum for this i atom from the interaction with this j atom. */
573 velec = _mm_andnot_ps(dummy_mask,velec);
574 velecsum = _mm_add_ps(velecsum,velec);
575
576 fscal = felec;
577
578 fscal = _mm_andnot_ps(dummy_mask,fscal);
579
580 /* Calculate temporary vectorial force */
581 tx = _mm_mul_ps(fscal,dx20);
582 ty = _mm_mul_ps(fscal,dy20);
583 tz = _mm_mul_ps(fscal,dz20);
584
585 /* Update vectorial force */
586 fix2 = _mm_add_ps(fix2,tx);
587 fiy2 = _mm_add_ps(fiy2,ty);
588 fiz2 = _mm_add_ps(fiz2,tz);
589
590 fjx0 = _mm_add_ps(fjx0,tx);
591 fjy0 = _mm_add_ps(fjy0,ty);
592 fjz0 = _mm_add_ps(fjz0,tz);
593
594 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
595 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
596 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
597 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
598
599 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
600
601 /* Inner loop uses 132 flops */
602 }
603
604 /* End of innermost loop */
605
606 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
607 f+i_coord_offset,fshift+i_shift_offset);
608
609 ggid = gid[iidx];
610 /* Update potential energies */
611 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
612 gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid);
613
614 /* Increment number of inner iterations */
615 inneriter += j_index_end - j_index_start;
616
617 /* Outer loop uses 20 flops */
618 }
619
620 /* Increment number of outer iterations */
621 outeriter += nri;
622
623 /* Update outer/inner flops */
624
625 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_VF,outeriter*20 + inneriter*132)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3_VF] += outeriter*20 + inneriter
*132
;
626}
627/*
628 * Gromacs nonbonded kernel: nb_kernel_ElecRF_VdwCSTab_GeomW3P1_F_sse4_1_single
629 * Electrostatics interaction: ReactionField
630 * VdW interaction: CubicSplineTable
631 * Geometry: Water3-Particle
632 * Calculate force/pot: Force
633 */
634void
635nb_kernel_ElecRF_VdwCSTab_GeomW3P1_F_sse4_1_single
636 (t_nblist * gmx_restrict nlist,
637 rvec * gmx_restrict xx,
638 rvec * gmx_restrict ff,
639 t_forcerec * gmx_restrict fr,
640 t_mdatoms * gmx_restrict mdatoms,
641 nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data,
642 t_nrnb * gmx_restrict nrnb)
643{
644 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
645 * just 0 for non-waters.
646 * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different
647 * jnr indices corresponding to data put in the four positions in the SIMD register.
648 */
649 int i_shift_offset,i_coord_offset,outeriter,inneriter;
650 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
651 int jnrA,jnrB,jnrC,jnrD;
652 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
653 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
654 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
655 real rcutoff_scalar;
656 real *shiftvec,*fshift,*x,*f;
657 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
658 real scratch[4*DIM3];
659 __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall;
660 int vdwioffset0;
661 __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0;
662 int vdwioffset1;
663 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
664 int vdwioffset2;
665 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
666 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
667 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
668 __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00;
669 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
670 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
671 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
672 real *charge;
673 int nvdwtype;
674 __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6;
675 int *vdwtype;
676 real *vdwparam;
677 __m128 one_sixth = _mm_set1_ps(1.0/6.0);
678 __m128 one_twelfth = _mm_set1_ps(1.0/12.0);
Value stored to 'one_twelfth' during its initialization is never read
679 __m128i vfitab;
680 __m128i ifour = _mm_set1_epi32(4);
681 __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF;
682 real *vftab;
683 __m128 dummy_mask,cutoff_mask;
684 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
685 __m128 one = _mm_set1_ps(1.0);
686 __m128 two = _mm_set1_ps(2.0);
687 x = xx[0];
688 f = ff[0];
689
690 nri = nlist->nri;
691 iinr = nlist->iinr;
692 jindex = nlist->jindex;
693 jjnr = nlist->jjnr;
694 shiftidx = nlist->shift;
695 gid = nlist->gid;
696 shiftvec = fr->shift_vec[0];
697 fshift = fr->fshift[0];
698 facel = _mm_set1_ps(fr->epsfac);
699 charge = mdatoms->chargeA;
700 krf = _mm_set1_ps(fr->ic->k_rf);
701 krf2 = _mm_set1_ps(fr->ic->k_rf*2.0);
702 crf = _mm_set1_ps(fr->ic->c_rf);
703 nvdwtype = fr->ntype;
704 vdwparam = fr->nbfp;
705 vdwtype = mdatoms->typeA;
706
707 vftab = kernel_data->table_vdw->data;
708 vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale);
709
710 /* Setup water-specific parameters */
711 inr = nlist->iinr[0];
712 iq0 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+0]));
713 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
714 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
715 vdwioffset0 = 2*nvdwtype*vdwtype[inr+0];
716
717 /* Avoid stupid compiler warnings */
718 jnrA = jnrB = jnrC = jnrD = 0;
719 j_coord_offsetA = 0;
720 j_coord_offsetB = 0;
721 j_coord_offsetC = 0;
722 j_coord_offsetD = 0;
723
724 outeriter = 0;
725 inneriter = 0;
726
727 for(iidx=0;iidx<4*DIM3;iidx++)
728 {
729 scratch[iidx] = 0.0;
730 }
731
732 /* Start outer loop over neighborlists */
733 for(iidx=0; iidx<nri; iidx++)
734 {
735 /* Load shift vector for this list */
736 i_shift_offset = DIM3*shiftidx[iidx];
737
738 /* Load limits for loop over neighbors */
739 j_index_start = jindex[iidx];
740 j_index_end = jindex[iidx+1];
741
742 /* Get outer coordinate index */
743 inr = iinr[iidx];
744 i_coord_offset = DIM3*inr;
745
746 /* Load i particle coords and add shift vector */
747 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,
748 &ix0,&iy0,&iz0,&ix1,&iy1,&iz1,&ix2,&iy2,&iz2);
749
750 fix0 = _mm_setzero_ps();
751 fiy0 = _mm_setzero_ps();
752 fiz0 = _mm_setzero_ps();
753 fix1 = _mm_setzero_ps();
754 fiy1 = _mm_setzero_ps();
755 fiz1 = _mm_setzero_ps();
756 fix2 = _mm_setzero_ps();
757 fiy2 = _mm_setzero_ps();
758 fiz2 = _mm_setzero_ps();
759
760 /* Start inner kernel loop */
761 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
762 {
763
764 /* Get j neighbor index, and coordinate index */
765 jnrA = jjnr[jidx];
766 jnrB = jjnr[jidx+1];
767 jnrC = jjnr[jidx+2];
768 jnrD = jjnr[jidx+3];
769 j_coord_offsetA = DIM3*jnrA;
770 j_coord_offsetB = DIM3*jnrB;
771 j_coord_offsetC = DIM3*jnrC;
772 j_coord_offsetD = DIM3*jnrD;
773
774 /* load j atom coordinates */
775 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
776 x+j_coord_offsetC,x+j_coord_offsetD,
777 &jx0,&jy0,&jz0);
778
779 /* Calculate displacement vector */
780 dx00 = _mm_sub_ps(ix0,jx0);
781 dy00 = _mm_sub_ps(iy0,jy0);
782 dz00 = _mm_sub_ps(iz0,jz0);
783 dx10 = _mm_sub_ps(ix1,jx0);
784 dy10 = _mm_sub_ps(iy1,jy0);
785 dz10 = _mm_sub_ps(iz1,jz0);
786 dx20 = _mm_sub_ps(ix2,jx0);
787 dy20 = _mm_sub_ps(iy2,jy0);
788 dz20 = _mm_sub_ps(iz2,jz0);
789
790 /* Calculate squared distance and things based on it */
791 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
792 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
793 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
794
795 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
796 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
797 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
798
799 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
800 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
801 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
802
803 /* Load parameters for j particles */
804 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
805 charge+jnrC+0,charge+jnrD+0);
806 vdwjidx0A = 2*vdwtype[jnrA+0];
807 vdwjidx0B = 2*vdwtype[jnrB+0];
808 vdwjidx0C = 2*vdwtype[jnrC+0];
809 vdwjidx0D = 2*vdwtype[jnrD+0];
810
811 fjx0 = _mm_setzero_ps();
812 fjy0 = _mm_setzero_ps();
813 fjz0 = _mm_setzero_ps();
814
815 /**************************
816 * CALCULATE INTERACTIONS *
817 **************************/
818
819 r00 = _mm_mul_ps(rsq00,rinv00);
820
821 /* Compute parameters for interactions between i and j atoms */
822 qq00 = _mm_mul_ps(iq0,jq0);
823 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
824 vdwparam+vdwioffset0+vdwjidx0B,
825 vdwparam+vdwioffset0+vdwjidx0C,
826 vdwparam+vdwioffset0+vdwjidx0D,
827 &c6_00,&c12_00);
828
829 /* Calculate table index by multiplying r with table scale and truncate to integer */
830 rt = _mm_mul_ps(r00,vftabscale);
831 vfitab = _mm_cvttps_epi32(rt);
832 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
833 vfitab = _mm_slli_epi32(vfitab,3);
834
835 /* REACTION-FIELD ELECTROSTATICS */
836 felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2));
837
838 /* CUBIC SPLINE TABLE DISPERSION */
839 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
840 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
841 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
842 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
843 _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)
;
844 Heps = _mm_mul_ps(vfeps,H);
845 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
846 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
847 fvdw6 = _mm_mul_ps(c6_00,FF);
848
849 /* CUBIC SPLINE TABLE REPULSION */
850 vfitab = _mm_add_epi32(vfitab,ifour);
851 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
852 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
853 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
854 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
855 _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)
;
856 Heps = _mm_mul_ps(vfeps,H);
857 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
858 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
859 fvdw12 = _mm_mul_ps(c12_00,FF);
860 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
861
862 fscal = _mm_add_ps(felec,fvdw);
863
864 /* Calculate temporary vectorial force */
865 tx = _mm_mul_ps(fscal,dx00);
866 ty = _mm_mul_ps(fscal,dy00);
867 tz = _mm_mul_ps(fscal,dz00);
868
869 /* Update vectorial force */
870 fix0 = _mm_add_ps(fix0,tx);
871 fiy0 = _mm_add_ps(fiy0,ty);
872 fiz0 = _mm_add_ps(fiz0,tz);
873
874 fjx0 = _mm_add_ps(fjx0,tx);
875 fjy0 = _mm_add_ps(fjy0,ty);
876 fjz0 = _mm_add_ps(fjz0,tz);
877
878 /**************************
879 * CALCULATE INTERACTIONS *
880 **************************/
881
882 /* Compute parameters for interactions between i and j atoms */
883 qq10 = _mm_mul_ps(iq1,jq0);
884
885 /* REACTION-FIELD ELECTROSTATICS */
886 felec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_mul_ps(rinv10,rinvsq10),krf2));
887
888 fscal = felec;
889
890 /* Calculate temporary vectorial force */
891 tx = _mm_mul_ps(fscal,dx10);
892 ty = _mm_mul_ps(fscal,dy10);
893 tz = _mm_mul_ps(fscal,dz10);
894
895 /* Update vectorial force */
896 fix1 = _mm_add_ps(fix1,tx);
897 fiy1 = _mm_add_ps(fiy1,ty);
898 fiz1 = _mm_add_ps(fiz1,tz);
899
900 fjx0 = _mm_add_ps(fjx0,tx);
901 fjy0 = _mm_add_ps(fjy0,ty);
902 fjz0 = _mm_add_ps(fjz0,tz);
903
904 /**************************
905 * CALCULATE INTERACTIONS *
906 **************************/
907
908 /* Compute parameters for interactions between i and j atoms */
909 qq20 = _mm_mul_ps(iq2,jq0);
910
911 /* REACTION-FIELD ELECTROSTATICS */
912 felec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_mul_ps(rinv20,rinvsq20),krf2));
913
914 fscal = felec;
915
916 /* Calculate temporary vectorial force */
917 tx = _mm_mul_ps(fscal,dx20);
918 ty = _mm_mul_ps(fscal,dy20);
919 tz = _mm_mul_ps(fscal,dz20);
920
921 /* Update vectorial force */
922 fix2 = _mm_add_ps(fix2,tx);
923 fiy2 = _mm_add_ps(fiy2,ty);
924 fiz2 = _mm_add_ps(fiz2,tz);
925
926 fjx0 = _mm_add_ps(fjx0,tx);
927 fjy0 = _mm_add_ps(fjy0,ty);
928 fjz0 = _mm_add_ps(fjz0,tz);
929
930 fjptrA = f+j_coord_offsetA;
931 fjptrB = f+j_coord_offsetB;
932 fjptrC = f+j_coord_offsetC;
933 fjptrD = f+j_coord_offsetD;
934
935 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
936
937 /* Inner loop uses 108 flops */
938 }
939
940 if(jidx<j_index_end)
941 {
942
943 /* Get j neighbor index, and coordinate index */
944 jnrlistA = jjnr[jidx];
945 jnrlistB = jjnr[jidx+1];
946 jnrlistC = jjnr[jidx+2];
947 jnrlistD = jjnr[jidx+3];
948 /* Sign of each element will be negative for non-real atoms.
949 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
950 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
951 */
952 dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
953 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
954 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
955 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
956 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
957 j_coord_offsetA = DIM3*jnrA;
958 j_coord_offsetB = DIM3*jnrB;
959 j_coord_offsetC = DIM3*jnrC;
960 j_coord_offsetD = DIM3*jnrD;
961
962 /* load j atom coordinates */
963 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
964 x+j_coord_offsetC,x+j_coord_offsetD,
965 &jx0,&jy0,&jz0);
966
967 /* Calculate displacement vector */
968 dx00 = _mm_sub_ps(ix0,jx0);
969 dy00 = _mm_sub_ps(iy0,jy0);
970 dz00 = _mm_sub_ps(iz0,jz0);
971 dx10 = _mm_sub_ps(ix1,jx0);
972 dy10 = _mm_sub_ps(iy1,jy0);
973 dz10 = _mm_sub_ps(iz1,jz0);
974 dx20 = _mm_sub_ps(ix2,jx0);
975 dy20 = _mm_sub_ps(iy2,jy0);
976 dz20 = _mm_sub_ps(iz2,jz0);
977
978 /* Calculate squared distance and things based on it */
979 rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00);
980 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
981 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
982
983 rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00);
984 rinv10 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq10);
985 rinv20 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq20);
986
987 rinvsq00 = _mm_mul_ps(rinv00,rinv00);
988 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
989 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
990
991 /* Load parameters for j particles */
992 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
993 charge+jnrC+0,charge+jnrD+0);
994 vdwjidx0A = 2*vdwtype[jnrA+0];
995 vdwjidx0B = 2*vdwtype[jnrB+0];
996 vdwjidx0C = 2*vdwtype[jnrC+0];
997 vdwjidx0D = 2*vdwtype[jnrD+0];
998
999 fjx0 = _mm_setzero_ps();
1000 fjy0 = _mm_setzero_ps();
1001 fjz0 = _mm_setzero_ps();
1002
1003 /**************************
1004 * CALCULATE INTERACTIONS *
1005 **************************/
1006
1007 r00 = _mm_mul_ps(rsq00,rinv00);
1008 r00 = _mm_andnot_ps(dummy_mask,r00);
1009
1010 /* Compute parameters for interactions between i and j atoms */
1011 qq00 = _mm_mul_ps(iq0,jq0);
1012 gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A,
1013 vdwparam+vdwioffset0+vdwjidx0B,
1014 vdwparam+vdwioffset0+vdwjidx0C,
1015 vdwparam+vdwioffset0+vdwjidx0D,
1016 &c6_00,&c12_00);
1017
1018 /* Calculate table index by multiplying r with table scale and truncate to integer */
1019 rt = _mm_mul_ps(r00,vftabscale);
1020 vfitab = _mm_cvttps_epi32(rt);
1021 vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps
((__v4sf)__X, ((0x00 | 0x01))); })
);
1022 vfitab = _mm_slli_epi32(vfitab,3);
1023
1024 /* REACTION-FIELD ELECTROSTATICS */
1025 felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2));
1026
1027 /* CUBIC SPLINE TABLE DISPERSION */
1028 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1029 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1030 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1031 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1032 _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)
;
1033 Heps = _mm_mul_ps(vfeps,H);
1034 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1035 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1036 fvdw6 = _mm_mul_ps(c6_00,FF);
1037
1038 /* CUBIC SPLINE TABLE REPULSION */
1039 vfitab = _mm_add_epi32(vfitab,ifour);
1040 Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) &
3];}))
);
1041 F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) &
3];}))
);
1042 G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) &
3];}))
);
1043 H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) &
3];}))
);
1044 _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)
;
1045 Heps = _mm_mul_ps(vfeps,H);
1046 Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps)));
1047 FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps))));
1048 fvdw12 = _mm_mul_ps(c12_00,FF);
1049 fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00)));
1050
1051 fscal = _mm_add_ps(felec,fvdw);
1052
1053 fscal = _mm_andnot_ps(dummy_mask,fscal);
1054
1055 /* Calculate temporary vectorial force */
1056 tx = _mm_mul_ps(fscal,dx00);
1057 ty = _mm_mul_ps(fscal,dy00);
1058 tz = _mm_mul_ps(fscal,dz00);
1059
1060 /* Update vectorial force */
1061 fix0 = _mm_add_ps(fix0,tx);
1062 fiy0 = _mm_add_ps(fiy0,ty);
1063 fiz0 = _mm_add_ps(fiz0,tz);
1064
1065 fjx0 = _mm_add_ps(fjx0,tx);
1066 fjy0 = _mm_add_ps(fjy0,ty);
1067 fjz0 = _mm_add_ps(fjz0,tz);
1068
1069 /**************************
1070 * CALCULATE INTERACTIONS *
1071 **************************/
1072
1073 /* Compute parameters for interactions between i and j atoms */
1074 qq10 = _mm_mul_ps(iq1,jq0);
1075
1076 /* REACTION-FIELD ELECTROSTATICS */
1077 felec = _mm_mul_ps(qq10,_mm_sub_ps(_mm_mul_ps(rinv10,rinvsq10),krf2));
1078
1079 fscal = felec;
1080
1081 fscal = _mm_andnot_ps(dummy_mask,fscal);
1082
1083 /* Calculate temporary vectorial force */
1084 tx = _mm_mul_ps(fscal,dx10);
1085 ty = _mm_mul_ps(fscal,dy10);
1086 tz = _mm_mul_ps(fscal,dz10);
1087
1088 /* Update vectorial force */
1089 fix1 = _mm_add_ps(fix1,tx);
1090 fiy1 = _mm_add_ps(fiy1,ty);
1091 fiz1 = _mm_add_ps(fiz1,tz);
1092
1093 fjx0 = _mm_add_ps(fjx0,tx);
1094 fjy0 = _mm_add_ps(fjy0,ty);
1095 fjz0 = _mm_add_ps(fjz0,tz);
1096
1097 /**************************
1098 * CALCULATE INTERACTIONS *
1099 **************************/
1100
1101 /* Compute parameters for interactions between i and j atoms */
1102 qq20 = _mm_mul_ps(iq2,jq0);
1103
1104 /* REACTION-FIELD ELECTROSTATICS */
1105 felec = _mm_mul_ps(qq20,_mm_sub_ps(_mm_mul_ps(rinv20,rinvsq20),krf2));
1106
1107 fscal = felec;
1108
1109 fscal = _mm_andnot_ps(dummy_mask,fscal);
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 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1126 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1127 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1128 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1129
1130 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1131
1132 /* Inner loop uses 109 flops */
1133 }
1134
1135 /* End of innermost loop */
1136
1137 gmx_mm_update_iforce_3atom_swizzle_ps(fix0,fiy0,fiz0,fix1,fiy1,fiz1,fix2,fiy2,fiz2,
1138 f+i_coord_offset,fshift+i_shift_offset);
1139
1140 /* Increment number of inner iterations */
1141 inneriter += j_index_end - j_index_start;
1142
1143 /* Outer loop uses 18 flops */
1144 }
1145
1146 /* Increment number of outer iterations */
1147 outeriter += nri;
1148
1149 /* Update outer/inner flops */
1150
1151 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_W3_F,outeriter*18 + inneriter*109)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_W3_F] += outeriter*18 + inneriter
*109
;
1152}