Remove nb-parameters from t_forcerec
[gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_kernel_avx_128_fma_single / nb_kernel_ElecEwSh_VdwNone_GeomW4P1_avx_128_fma_single.c
blob957d03c8ee9a6f146a20f2ed0347baf37f36e1c4
1 /*
2 * This file is part of the GROMACS molecular simulation package.
4 * Copyright (c) 2012,2013,2014,2015,2017, 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.
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.
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.
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.
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.
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.
36 * Note: this file was generated by the GROMACS avx_128_fma_single kernel generator.
38 #include "gmxpre.h"
40 #include "config.h"
42 #include <math.h>
44 #include "../nb_kernel.h"
45 #include "gromacs/gmxlib/nrnb.h"
47 #include "kernelutil_x86_avx_128_fma_single.h"
50 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwNone_GeomW4P1_VF_avx_128_fma_single
51 * Electrostatics interaction: Ewald
52 * VdW interaction: None
53 * Geometry: Water4-Particle
54 * Calculate force/pot: PotentialAndForce
56 void
57 nb_kernel_ElecEwSh_VdwNone_GeomW4P1_VF_avx_128_fma_single
58 (t_nblist * gmx_restrict nlist,
59 rvec * gmx_restrict xx,
60 rvec * gmx_restrict ff,
61 struct t_forcerec * gmx_restrict fr,
62 t_mdatoms * gmx_restrict mdatoms,
63 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
64 t_nrnb * gmx_restrict nrnb)
66 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
67 * just 0 for non-waters.
68 * Suffixes A,B,C,D refer to j loop unrolling done with AVX_128, e.g. for the four different
69 * jnr indices corresponding to data put in the four positions in the SIMD register.
71 int i_shift_offset,i_coord_offset,outeriter,inneriter;
72 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
73 int jnrA,jnrB,jnrC,jnrD;
74 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
75 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
76 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
77 real rcutoff_scalar;
78 real *shiftvec,*fshift,*x,*f;
79 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
80 real scratch[4*DIM];
81 __m128 fscal,rcutoff,rcutoff2,jidxall;
82 int vdwioffset1;
83 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
84 int vdwioffset2;
85 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
86 int vdwioffset3;
87 __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
88 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
89 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
90 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
91 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
92 __m128 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
93 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
94 real *charge;
95 __m128i ewitab;
96 __m128 ewtabscale,eweps,twoeweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
97 __m128 beta,beta2,beta3,zeta2,pmecorrF,pmecorrV,rinv3;
98 real *ewtab;
99 __m128 dummy_mask,cutoff_mask;
100 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
101 __m128 one = _mm_set1_ps(1.0);
102 __m128 two = _mm_set1_ps(2.0);
103 x = xx[0];
104 f = ff[0];
106 nri = nlist->nri;
107 iinr = nlist->iinr;
108 jindex = nlist->jindex;
109 jjnr = nlist->jjnr;
110 shiftidx = nlist->shift;
111 gid = nlist->gid;
112 shiftvec = fr->shift_vec[0];
113 fshift = fr->fshift[0];
114 facel = _mm_set1_ps(fr->ic->epsfac);
115 charge = mdatoms->chargeA;
117 sh_ewald = _mm_set1_ps(fr->ic->sh_ewald);
118 beta = _mm_set1_ps(fr->ic->ewaldcoeff_q);
119 beta2 = _mm_mul_ps(beta,beta);
120 beta3 = _mm_mul_ps(beta,beta2);
121 ewtab = fr->ic->tabq_coul_FDV0;
122 ewtabscale = _mm_set1_ps(fr->ic->tabq_scale);
123 ewtabhalfspace = _mm_set1_ps(0.5/fr->ic->tabq_scale);
125 /* Setup water-specific parameters */
126 inr = nlist->iinr[0];
127 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
128 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
129 iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3]));
131 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
132 rcutoff_scalar = fr->ic->rcoulomb;
133 rcutoff = _mm_set1_ps(rcutoff_scalar);
134 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
136 /* Avoid stupid compiler warnings */
137 jnrA = jnrB = jnrC = jnrD = 0;
138 j_coord_offsetA = 0;
139 j_coord_offsetB = 0;
140 j_coord_offsetC = 0;
141 j_coord_offsetD = 0;
143 outeriter = 0;
144 inneriter = 0;
146 for(iidx=0;iidx<4*DIM;iidx++)
148 scratch[iidx] = 0.0;
151 /* Start outer loop over neighborlists */
152 for(iidx=0; iidx<nri; iidx++)
154 /* Load shift vector for this list */
155 i_shift_offset = DIM*shiftidx[iidx];
157 /* Load limits for loop over neighbors */
158 j_index_start = jindex[iidx];
159 j_index_end = jindex[iidx+1];
161 /* Get outer coordinate index */
162 inr = iinr[iidx];
163 i_coord_offset = DIM*inr;
165 /* Load i particle coords and add shift vector */
166 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset+DIM,
167 &ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
169 fix1 = _mm_setzero_ps();
170 fiy1 = _mm_setzero_ps();
171 fiz1 = _mm_setzero_ps();
172 fix2 = _mm_setzero_ps();
173 fiy2 = _mm_setzero_ps();
174 fiz2 = _mm_setzero_ps();
175 fix3 = _mm_setzero_ps();
176 fiy3 = _mm_setzero_ps();
177 fiz3 = _mm_setzero_ps();
179 /* Reset potential sums */
180 velecsum = _mm_setzero_ps();
182 /* Start inner kernel loop */
183 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
186 /* Get j neighbor index, and coordinate index */
187 jnrA = jjnr[jidx];
188 jnrB = jjnr[jidx+1];
189 jnrC = jjnr[jidx+2];
190 jnrD = jjnr[jidx+3];
191 j_coord_offsetA = DIM*jnrA;
192 j_coord_offsetB = DIM*jnrB;
193 j_coord_offsetC = DIM*jnrC;
194 j_coord_offsetD = DIM*jnrD;
196 /* load j atom coordinates */
197 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
198 x+j_coord_offsetC,x+j_coord_offsetD,
199 &jx0,&jy0,&jz0);
201 /* Calculate displacement vector */
202 dx10 = _mm_sub_ps(ix1,jx0);
203 dy10 = _mm_sub_ps(iy1,jy0);
204 dz10 = _mm_sub_ps(iz1,jz0);
205 dx20 = _mm_sub_ps(ix2,jx0);
206 dy20 = _mm_sub_ps(iy2,jy0);
207 dz20 = _mm_sub_ps(iz2,jz0);
208 dx30 = _mm_sub_ps(ix3,jx0);
209 dy30 = _mm_sub_ps(iy3,jy0);
210 dz30 = _mm_sub_ps(iz3,jz0);
212 /* Calculate squared distance and things based on it */
213 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
214 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
215 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
217 rinv10 = avx128fma_invsqrt_f(rsq10);
218 rinv20 = avx128fma_invsqrt_f(rsq20);
219 rinv30 = avx128fma_invsqrt_f(rsq30);
221 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
222 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
223 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
225 /* Load parameters for j particles */
226 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
227 charge+jnrC+0,charge+jnrD+0);
229 fjx0 = _mm_setzero_ps();
230 fjy0 = _mm_setzero_ps();
231 fjz0 = _mm_setzero_ps();
233 /**************************
234 * CALCULATE INTERACTIONS *
235 **************************/
237 if (gmx_mm_any_lt(rsq10,rcutoff2))
240 r10 = _mm_mul_ps(rsq10,rinv10);
242 /* Compute parameters for interactions between i and j atoms */
243 qq10 = _mm_mul_ps(iq1,jq0);
245 /* EWALD ELECTROSTATICS */
247 /* Analytical PME correction */
248 zeta2 = _mm_mul_ps(beta2,rsq10);
249 rinv3 = _mm_mul_ps(rinvsq10,rinv10);
250 pmecorrF = avx128fma_pmecorrF_f(zeta2);
251 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
252 felec = _mm_mul_ps(qq10,felec);
253 pmecorrV = avx128fma_pmecorrV_f(zeta2);
254 velec = _mm_nmacc_ps(pmecorrV,beta,_mm_sub_ps(rinv10,sh_ewald));
255 velec = _mm_mul_ps(qq10,velec);
257 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
259 /* Update potential sum for this i atom from the interaction with this j atom. */
260 velec = _mm_and_ps(velec,cutoff_mask);
261 velecsum = _mm_add_ps(velecsum,velec);
263 fscal = felec;
265 fscal = _mm_and_ps(fscal,cutoff_mask);
267 /* Update vectorial force */
268 fix1 = _mm_macc_ps(dx10,fscal,fix1);
269 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
270 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
272 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
273 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
274 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
278 /**************************
279 * CALCULATE INTERACTIONS *
280 **************************/
282 if (gmx_mm_any_lt(rsq20,rcutoff2))
285 r20 = _mm_mul_ps(rsq20,rinv20);
287 /* Compute parameters for interactions between i and j atoms */
288 qq20 = _mm_mul_ps(iq2,jq0);
290 /* EWALD ELECTROSTATICS */
292 /* Analytical PME correction */
293 zeta2 = _mm_mul_ps(beta2,rsq20);
294 rinv3 = _mm_mul_ps(rinvsq20,rinv20);
295 pmecorrF = avx128fma_pmecorrF_f(zeta2);
296 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
297 felec = _mm_mul_ps(qq20,felec);
298 pmecorrV = avx128fma_pmecorrV_f(zeta2);
299 velec = _mm_nmacc_ps(pmecorrV,beta,_mm_sub_ps(rinv20,sh_ewald));
300 velec = _mm_mul_ps(qq20,velec);
302 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
304 /* Update potential sum for this i atom from the interaction with this j atom. */
305 velec = _mm_and_ps(velec,cutoff_mask);
306 velecsum = _mm_add_ps(velecsum,velec);
308 fscal = felec;
310 fscal = _mm_and_ps(fscal,cutoff_mask);
312 /* Update vectorial force */
313 fix2 = _mm_macc_ps(dx20,fscal,fix2);
314 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
315 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
317 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
318 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
319 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
323 /**************************
324 * CALCULATE INTERACTIONS *
325 **************************/
327 if (gmx_mm_any_lt(rsq30,rcutoff2))
330 r30 = _mm_mul_ps(rsq30,rinv30);
332 /* Compute parameters for interactions between i and j atoms */
333 qq30 = _mm_mul_ps(iq3,jq0);
335 /* EWALD ELECTROSTATICS */
337 /* Analytical PME correction */
338 zeta2 = _mm_mul_ps(beta2,rsq30);
339 rinv3 = _mm_mul_ps(rinvsq30,rinv30);
340 pmecorrF = avx128fma_pmecorrF_f(zeta2);
341 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
342 felec = _mm_mul_ps(qq30,felec);
343 pmecorrV = avx128fma_pmecorrV_f(zeta2);
344 velec = _mm_nmacc_ps(pmecorrV,beta,_mm_sub_ps(rinv30,sh_ewald));
345 velec = _mm_mul_ps(qq30,velec);
347 cutoff_mask = _mm_cmplt_ps(rsq30,rcutoff2);
349 /* Update potential sum for this i atom from the interaction with this j atom. */
350 velec = _mm_and_ps(velec,cutoff_mask);
351 velecsum = _mm_add_ps(velecsum,velec);
353 fscal = felec;
355 fscal = _mm_and_ps(fscal,cutoff_mask);
357 /* Update vectorial force */
358 fix3 = _mm_macc_ps(dx30,fscal,fix3);
359 fiy3 = _mm_macc_ps(dy30,fscal,fiy3);
360 fiz3 = _mm_macc_ps(dz30,fscal,fiz3);
362 fjx0 = _mm_macc_ps(dx30,fscal,fjx0);
363 fjy0 = _mm_macc_ps(dy30,fscal,fjy0);
364 fjz0 = _mm_macc_ps(dz30,fscal,fjz0);
368 fjptrA = f+j_coord_offsetA;
369 fjptrB = f+j_coord_offsetB;
370 fjptrC = f+j_coord_offsetC;
371 fjptrD = f+j_coord_offsetD;
373 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
375 /* Inner loop uses 99 flops */
378 if(jidx<j_index_end)
381 /* Get j neighbor index, and coordinate index */
382 jnrlistA = jjnr[jidx];
383 jnrlistB = jjnr[jidx+1];
384 jnrlistC = jjnr[jidx+2];
385 jnrlistD = jjnr[jidx+3];
386 /* Sign of each element will be negative for non-real atoms.
387 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
388 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
390 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
391 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
392 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
393 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
394 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
395 j_coord_offsetA = DIM*jnrA;
396 j_coord_offsetB = DIM*jnrB;
397 j_coord_offsetC = DIM*jnrC;
398 j_coord_offsetD = DIM*jnrD;
400 /* load j atom coordinates */
401 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
402 x+j_coord_offsetC,x+j_coord_offsetD,
403 &jx0,&jy0,&jz0);
405 /* Calculate displacement vector */
406 dx10 = _mm_sub_ps(ix1,jx0);
407 dy10 = _mm_sub_ps(iy1,jy0);
408 dz10 = _mm_sub_ps(iz1,jz0);
409 dx20 = _mm_sub_ps(ix2,jx0);
410 dy20 = _mm_sub_ps(iy2,jy0);
411 dz20 = _mm_sub_ps(iz2,jz0);
412 dx30 = _mm_sub_ps(ix3,jx0);
413 dy30 = _mm_sub_ps(iy3,jy0);
414 dz30 = _mm_sub_ps(iz3,jz0);
416 /* Calculate squared distance and things based on it */
417 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
418 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
419 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
421 rinv10 = avx128fma_invsqrt_f(rsq10);
422 rinv20 = avx128fma_invsqrt_f(rsq20);
423 rinv30 = avx128fma_invsqrt_f(rsq30);
425 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
426 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
427 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
429 /* Load parameters for j particles */
430 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
431 charge+jnrC+0,charge+jnrD+0);
433 fjx0 = _mm_setzero_ps();
434 fjy0 = _mm_setzero_ps();
435 fjz0 = _mm_setzero_ps();
437 /**************************
438 * CALCULATE INTERACTIONS *
439 **************************/
441 if (gmx_mm_any_lt(rsq10,rcutoff2))
444 r10 = _mm_mul_ps(rsq10,rinv10);
445 r10 = _mm_andnot_ps(dummy_mask,r10);
447 /* Compute parameters for interactions between i and j atoms */
448 qq10 = _mm_mul_ps(iq1,jq0);
450 /* EWALD ELECTROSTATICS */
452 /* Analytical PME correction */
453 zeta2 = _mm_mul_ps(beta2,rsq10);
454 rinv3 = _mm_mul_ps(rinvsq10,rinv10);
455 pmecorrF = avx128fma_pmecorrF_f(zeta2);
456 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
457 felec = _mm_mul_ps(qq10,felec);
458 pmecorrV = avx128fma_pmecorrV_f(zeta2);
459 velec = _mm_nmacc_ps(pmecorrV,beta,_mm_sub_ps(rinv10,sh_ewald));
460 velec = _mm_mul_ps(qq10,velec);
462 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
464 /* Update potential sum for this i atom from the interaction with this j atom. */
465 velec = _mm_and_ps(velec,cutoff_mask);
466 velec = _mm_andnot_ps(dummy_mask,velec);
467 velecsum = _mm_add_ps(velecsum,velec);
469 fscal = felec;
471 fscal = _mm_and_ps(fscal,cutoff_mask);
473 fscal = _mm_andnot_ps(dummy_mask,fscal);
475 /* Update vectorial force */
476 fix1 = _mm_macc_ps(dx10,fscal,fix1);
477 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
478 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
480 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
481 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
482 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
486 /**************************
487 * CALCULATE INTERACTIONS *
488 **************************/
490 if (gmx_mm_any_lt(rsq20,rcutoff2))
493 r20 = _mm_mul_ps(rsq20,rinv20);
494 r20 = _mm_andnot_ps(dummy_mask,r20);
496 /* Compute parameters for interactions between i and j atoms */
497 qq20 = _mm_mul_ps(iq2,jq0);
499 /* EWALD ELECTROSTATICS */
501 /* Analytical PME correction */
502 zeta2 = _mm_mul_ps(beta2,rsq20);
503 rinv3 = _mm_mul_ps(rinvsq20,rinv20);
504 pmecorrF = avx128fma_pmecorrF_f(zeta2);
505 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
506 felec = _mm_mul_ps(qq20,felec);
507 pmecorrV = avx128fma_pmecorrV_f(zeta2);
508 velec = _mm_nmacc_ps(pmecorrV,beta,_mm_sub_ps(rinv20,sh_ewald));
509 velec = _mm_mul_ps(qq20,velec);
511 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
513 /* Update potential sum for this i atom from the interaction with this j atom. */
514 velec = _mm_and_ps(velec,cutoff_mask);
515 velec = _mm_andnot_ps(dummy_mask,velec);
516 velecsum = _mm_add_ps(velecsum,velec);
518 fscal = felec;
520 fscal = _mm_and_ps(fscal,cutoff_mask);
522 fscal = _mm_andnot_ps(dummy_mask,fscal);
524 /* Update vectorial force */
525 fix2 = _mm_macc_ps(dx20,fscal,fix2);
526 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
527 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
529 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
530 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
531 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
535 /**************************
536 * CALCULATE INTERACTIONS *
537 **************************/
539 if (gmx_mm_any_lt(rsq30,rcutoff2))
542 r30 = _mm_mul_ps(rsq30,rinv30);
543 r30 = _mm_andnot_ps(dummy_mask,r30);
545 /* Compute parameters for interactions between i and j atoms */
546 qq30 = _mm_mul_ps(iq3,jq0);
548 /* EWALD ELECTROSTATICS */
550 /* Analytical PME correction */
551 zeta2 = _mm_mul_ps(beta2,rsq30);
552 rinv3 = _mm_mul_ps(rinvsq30,rinv30);
553 pmecorrF = avx128fma_pmecorrF_f(zeta2);
554 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
555 felec = _mm_mul_ps(qq30,felec);
556 pmecorrV = avx128fma_pmecorrV_f(zeta2);
557 velec = _mm_nmacc_ps(pmecorrV,beta,_mm_sub_ps(rinv30,sh_ewald));
558 velec = _mm_mul_ps(qq30,velec);
560 cutoff_mask = _mm_cmplt_ps(rsq30,rcutoff2);
562 /* Update potential sum for this i atom from the interaction with this j atom. */
563 velec = _mm_and_ps(velec,cutoff_mask);
564 velec = _mm_andnot_ps(dummy_mask,velec);
565 velecsum = _mm_add_ps(velecsum,velec);
567 fscal = felec;
569 fscal = _mm_and_ps(fscal,cutoff_mask);
571 fscal = _mm_andnot_ps(dummy_mask,fscal);
573 /* Update vectorial force */
574 fix3 = _mm_macc_ps(dx30,fscal,fix3);
575 fiy3 = _mm_macc_ps(dy30,fscal,fiy3);
576 fiz3 = _mm_macc_ps(dz30,fscal,fiz3);
578 fjx0 = _mm_macc_ps(dx30,fscal,fjx0);
579 fjy0 = _mm_macc_ps(dy30,fscal,fjy0);
580 fjz0 = _mm_macc_ps(dz30,fscal,fjz0);
584 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
585 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
586 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
587 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
589 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
591 /* Inner loop uses 102 flops */
594 /* End of innermost loop */
596 gmx_mm_update_iforce_3atom_swizzle_ps(fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
597 f+i_coord_offset+DIM,fshift+i_shift_offset);
599 ggid = gid[iidx];
600 /* Update potential energies */
601 gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid);
603 /* Increment number of inner iterations */
604 inneriter += j_index_end - j_index_start;
606 /* Outer loop uses 19 flops */
609 /* Increment number of outer iterations */
610 outeriter += nri;
612 /* Update outer/inner flops */
614 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4_VF,outeriter*19 + inneriter*102);
617 * Gromacs nonbonded kernel: nb_kernel_ElecEwSh_VdwNone_GeomW4P1_F_avx_128_fma_single
618 * Electrostatics interaction: Ewald
619 * VdW interaction: None
620 * Geometry: Water4-Particle
621 * Calculate force/pot: Force
623 void
624 nb_kernel_ElecEwSh_VdwNone_GeomW4P1_F_avx_128_fma_single
625 (t_nblist * gmx_restrict nlist,
626 rvec * gmx_restrict xx,
627 rvec * gmx_restrict ff,
628 struct t_forcerec * gmx_restrict fr,
629 t_mdatoms * gmx_restrict mdatoms,
630 nb_kernel_data_t gmx_unused * gmx_restrict kernel_data,
631 t_nrnb * gmx_restrict nrnb)
633 /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or
634 * just 0 for non-waters.
635 * Suffixes A,B,C,D refer to j loop unrolling done with AVX_128, e.g. for the four different
636 * jnr indices corresponding to data put in the four positions in the SIMD register.
638 int i_shift_offset,i_coord_offset,outeriter,inneriter;
639 int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx;
640 int jnrA,jnrB,jnrC,jnrD;
641 int jnrlistA,jnrlistB,jnrlistC,jnrlistD;
642 int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD;
643 int *iinr,*jindex,*jjnr,*shiftidx,*gid;
644 real rcutoff_scalar;
645 real *shiftvec,*fshift,*x,*f;
646 real *fjptrA,*fjptrB,*fjptrC,*fjptrD;
647 real scratch[4*DIM];
648 __m128 fscal,rcutoff,rcutoff2,jidxall;
649 int vdwioffset1;
650 __m128 ix1,iy1,iz1,fix1,fiy1,fiz1,iq1,isai1;
651 int vdwioffset2;
652 __m128 ix2,iy2,iz2,fix2,fiy2,fiz2,iq2,isai2;
653 int vdwioffset3;
654 __m128 ix3,iy3,iz3,fix3,fiy3,fiz3,iq3,isai3;
655 int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D;
656 __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0;
657 __m128 dx10,dy10,dz10,rsq10,rinv10,rinvsq10,r10,qq10,c6_10,c12_10;
658 __m128 dx20,dy20,dz20,rsq20,rinv20,rinvsq20,r20,qq20,c6_20,c12_20;
659 __m128 dx30,dy30,dz30,rsq30,rinv30,rinvsq30,r30,qq30,c6_30,c12_30;
660 __m128 velec,felec,velecsum,facel,crf,krf,krf2;
661 real *charge;
662 __m128i ewitab;
663 __m128 ewtabscale,eweps,twoeweps,sh_ewald,ewrt,ewtabhalfspace,ewtabF,ewtabFn,ewtabD,ewtabV;
664 __m128 beta,beta2,beta3,zeta2,pmecorrF,pmecorrV,rinv3;
665 real *ewtab;
666 __m128 dummy_mask,cutoff_mask;
667 __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) );
668 __m128 one = _mm_set1_ps(1.0);
669 __m128 two = _mm_set1_ps(2.0);
670 x = xx[0];
671 f = ff[0];
673 nri = nlist->nri;
674 iinr = nlist->iinr;
675 jindex = nlist->jindex;
676 jjnr = nlist->jjnr;
677 shiftidx = nlist->shift;
678 gid = nlist->gid;
679 shiftvec = fr->shift_vec[0];
680 fshift = fr->fshift[0];
681 facel = _mm_set1_ps(fr->ic->epsfac);
682 charge = mdatoms->chargeA;
684 sh_ewald = _mm_set1_ps(fr->ic->sh_ewald);
685 beta = _mm_set1_ps(fr->ic->ewaldcoeff_q);
686 beta2 = _mm_mul_ps(beta,beta);
687 beta3 = _mm_mul_ps(beta,beta2);
688 ewtab = fr->ic->tabq_coul_F;
689 ewtabscale = _mm_set1_ps(fr->ic->tabq_scale);
690 ewtabhalfspace = _mm_set1_ps(0.5/fr->ic->tabq_scale);
692 /* Setup water-specific parameters */
693 inr = nlist->iinr[0];
694 iq1 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+1]));
695 iq2 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+2]));
696 iq3 = _mm_mul_ps(facel,_mm_set1_ps(charge[inr+3]));
698 /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */
699 rcutoff_scalar = fr->ic->rcoulomb;
700 rcutoff = _mm_set1_ps(rcutoff_scalar);
701 rcutoff2 = _mm_mul_ps(rcutoff,rcutoff);
703 /* Avoid stupid compiler warnings */
704 jnrA = jnrB = jnrC = jnrD = 0;
705 j_coord_offsetA = 0;
706 j_coord_offsetB = 0;
707 j_coord_offsetC = 0;
708 j_coord_offsetD = 0;
710 outeriter = 0;
711 inneriter = 0;
713 for(iidx=0;iidx<4*DIM;iidx++)
715 scratch[iidx] = 0.0;
718 /* Start outer loop over neighborlists */
719 for(iidx=0; iidx<nri; iidx++)
721 /* Load shift vector for this list */
722 i_shift_offset = DIM*shiftidx[iidx];
724 /* Load limits for loop over neighbors */
725 j_index_start = jindex[iidx];
726 j_index_end = jindex[iidx+1];
728 /* Get outer coordinate index */
729 inr = iinr[iidx];
730 i_coord_offset = DIM*inr;
732 /* Load i particle coords and add shift vector */
733 gmx_mm_load_shift_and_3rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset+DIM,
734 &ix1,&iy1,&iz1,&ix2,&iy2,&iz2,&ix3,&iy3,&iz3);
736 fix1 = _mm_setzero_ps();
737 fiy1 = _mm_setzero_ps();
738 fiz1 = _mm_setzero_ps();
739 fix2 = _mm_setzero_ps();
740 fiy2 = _mm_setzero_ps();
741 fiz2 = _mm_setzero_ps();
742 fix3 = _mm_setzero_ps();
743 fiy3 = _mm_setzero_ps();
744 fiz3 = _mm_setzero_ps();
746 /* Start inner kernel loop */
747 for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4)
750 /* Get j neighbor index, and coordinate index */
751 jnrA = jjnr[jidx];
752 jnrB = jjnr[jidx+1];
753 jnrC = jjnr[jidx+2];
754 jnrD = jjnr[jidx+3];
755 j_coord_offsetA = DIM*jnrA;
756 j_coord_offsetB = DIM*jnrB;
757 j_coord_offsetC = DIM*jnrC;
758 j_coord_offsetD = DIM*jnrD;
760 /* load j atom coordinates */
761 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
762 x+j_coord_offsetC,x+j_coord_offsetD,
763 &jx0,&jy0,&jz0);
765 /* Calculate displacement vector */
766 dx10 = _mm_sub_ps(ix1,jx0);
767 dy10 = _mm_sub_ps(iy1,jy0);
768 dz10 = _mm_sub_ps(iz1,jz0);
769 dx20 = _mm_sub_ps(ix2,jx0);
770 dy20 = _mm_sub_ps(iy2,jy0);
771 dz20 = _mm_sub_ps(iz2,jz0);
772 dx30 = _mm_sub_ps(ix3,jx0);
773 dy30 = _mm_sub_ps(iy3,jy0);
774 dz30 = _mm_sub_ps(iz3,jz0);
776 /* Calculate squared distance and things based on it */
777 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
778 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
779 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
781 rinv10 = avx128fma_invsqrt_f(rsq10);
782 rinv20 = avx128fma_invsqrt_f(rsq20);
783 rinv30 = avx128fma_invsqrt_f(rsq30);
785 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
786 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
787 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
789 /* Load parameters for j particles */
790 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
791 charge+jnrC+0,charge+jnrD+0);
793 fjx0 = _mm_setzero_ps();
794 fjy0 = _mm_setzero_ps();
795 fjz0 = _mm_setzero_ps();
797 /**************************
798 * CALCULATE INTERACTIONS *
799 **************************/
801 if (gmx_mm_any_lt(rsq10,rcutoff2))
804 r10 = _mm_mul_ps(rsq10,rinv10);
806 /* Compute parameters for interactions between i and j atoms */
807 qq10 = _mm_mul_ps(iq1,jq0);
809 /* EWALD ELECTROSTATICS */
811 /* Analytical PME correction */
812 zeta2 = _mm_mul_ps(beta2,rsq10);
813 rinv3 = _mm_mul_ps(rinvsq10,rinv10);
814 pmecorrF = avx128fma_pmecorrF_f(zeta2);
815 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
816 felec = _mm_mul_ps(qq10,felec);
818 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
820 fscal = felec;
822 fscal = _mm_and_ps(fscal,cutoff_mask);
824 /* Update vectorial force */
825 fix1 = _mm_macc_ps(dx10,fscal,fix1);
826 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
827 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
829 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
830 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
831 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
835 /**************************
836 * CALCULATE INTERACTIONS *
837 **************************/
839 if (gmx_mm_any_lt(rsq20,rcutoff2))
842 r20 = _mm_mul_ps(rsq20,rinv20);
844 /* Compute parameters for interactions between i and j atoms */
845 qq20 = _mm_mul_ps(iq2,jq0);
847 /* EWALD ELECTROSTATICS */
849 /* Analytical PME correction */
850 zeta2 = _mm_mul_ps(beta2,rsq20);
851 rinv3 = _mm_mul_ps(rinvsq20,rinv20);
852 pmecorrF = avx128fma_pmecorrF_f(zeta2);
853 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
854 felec = _mm_mul_ps(qq20,felec);
856 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
858 fscal = felec;
860 fscal = _mm_and_ps(fscal,cutoff_mask);
862 /* Update vectorial force */
863 fix2 = _mm_macc_ps(dx20,fscal,fix2);
864 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
865 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
867 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
868 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
869 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
873 /**************************
874 * CALCULATE INTERACTIONS *
875 **************************/
877 if (gmx_mm_any_lt(rsq30,rcutoff2))
880 r30 = _mm_mul_ps(rsq30,rinv30);
882 /* Compute parameters for interactions between i and j atoms */
883 qq30 = _mm_mul_ps(iq3,jq0);
885 /* EWALD ELECTROSTATICS */
887 /* Analytical PME correction */
888 zeta2 = _mm_mul_ps(beta2,rsq30);
889 rinv3 = _mm_mul_ps(rinvsq30,rinv30);
890 pmecorrF = avx128fma_pmecorrF_f(zeta2);
891 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
892 felec = _mm_mul_ps(qq30,felec);
894 cutoff_mask = _mm_cmplt_ps(rsq30,rcutoff2);
896 fscal = felec;
898 fscal = _mm_and_ps(fscal,cutoff_mask);
900 /* Update vectorial force */
901 fix3 = _mm_macc_ps(dx30,fscal,fix3);
902 fiy3 = _mm_macc_ps(dy30,fscal,fiy3);
903 fiz3 = _mm_macc_ps(dz30,fscal,fiz3);
905 fjx0 = _mm_macc_ps(dx30,fscal,fjx0);
906 fjy0 = _mm_macc_ps(dy30,fscal,fjy0);
907 fjz0 = _mm_macc_ps(dz30,fscal,fjz0);
911 fjptrA = f+j_coord_offsetA;
912 fjptrB = f+j_coord_offsetB;
913 fjptrC = f+j_coord_offsetC;
914 fjptrD = f+j_coord_offsetD;
916 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
918 /* Inner loop uses 93 flops */
921 if(jidx<j_index_end)
924 /* Get j neighbor index, and coordinate index */
925 jnrlistA = jjnr[jidx];
926 jnrlistB = jjnr[jidx+1];
927 jnrlistC = jjnr[jidx+2];
928 jnrlistD = jjnr[jidx+3];
929 /* Sign of each element will be negative for non-real atoms.
930 * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones,
931 * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries.
933 dummy_mask = gmx_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128()));
934 jnrA = (jnrlistA>=0) ? jnrlistA : 0;
935 jnrB = (jnrlistB>=0) ? jnrlistB : 0;
936 jnrC = (jnrlistC>=0) ? jnrlistC : 0;
937 jnrD = (jnrlistD>=0) ? jnrlistD : 0;
938 j_coord_offsetA = DIM*jnrA;
939 j_coord_offsetB = DIM*jnrB;
940 j_coord_offsetC = DIM*jnrC;
941 j_coord_offsetD = DIM*jnrD;
943 /* load j atom coordinates */
944 gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB,
945 x+j_coord_offsetC,x+j_coord_offsetD,
946 &jx0,&jy0,&jz0);
948 /* Calculate displacement vector */
949 dx10 = _mm_sub_ps(ix1,jx0);
950 dy10 = _mm_sub_ps(iy1,jy0);
951 dz10 = _mm_sub_ps(iz1,jz0);
952 dx20 = _mm_sub_ps(ix2,jx0);
953 dy20 = _mm_sub_ps(iy2,jy0);
954 dz20 = _mm_sub_ps(iz2,jz0);
955 dx30 = _mm_sub_ps(ix3,jx0);
956 dy30 = _mm_sub_ps(iy3,jy0);
957 dz30 = _mm_sub_ps(iz3,jz0);
959 /* Calculate squared distance and things based on it */
960 rsq10 = gmx_mm_calc_rsq_ps(dx10,dy10,dz10);
961 rsq20 = gmx_mm_calc_rsq_ps(dx20,dy20,dz20);
962 rsq30 = gmx_mm_calc_rsq_ps(dx30,dy30,dz30);
964 rinv10 = avx128fma_invsqrt_f(rsq10);
965 rinv20 = avx128fma_invsqrt_f(rsq20);
966 rinv30 = avx128fma_invsqrt_f(rsq30);
968 rinvsq10 = _mm_mul_ps(rinv10,rinv10);
969 rinvsq20 = _mm_mul_ps(rinv20,rinv20);
970 rinvsq30 = _mm_mul_ps(rinv30,rinv30);
972 /* Load parameters for j particles */
973 jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0,
974 charge+jnrC+0,charge+jnrD+0);
976 fjx0 = _mm_setzero_ps();
977 fjy0 = _mm_setzero_ps();
978 fjz0 = _mm_setzero_ps();
980 /**************************
981 * CALCULATE INTERACTIONS *
982 **************************/
984 if (gmx_mm_any_lt(rsq10,rcutoff2))
987 r10 = _mm_mul_ps(rsq10,rinv10);
988 r10 = _mm_andnot_ps(dummy_mask,r10);
990 /* Compute parameters for interactions between i and j atoms */
991 qq10 = _mm_mul_ps(iq1,jq0);
993 /* EWALD ELECTROSTATICS */
995 /* Analytical PME correction */
996 zeta2 = _mm_mul_ps(beta2,rsq10);
997 rinv3 = _mm_mul_ps(rinvsq10,rinv10);
998 pmecorrF = avx128fma_pmecorrF_f(zeta2);
999 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
1000 felec = _mm_mul_ps(qq10,felec);
1002 cutoff_mask = _mm_cmplt_ps(rsq10,rcutoff2);
1004 fscal = felec;
1006 fscal = _mm_and_ps(fscal,cutoff_mask);
1008 fscal = _mm_andnot_ps(dummy_mask,fscal);
1010 /* Update vectorial force */
1011 fix1 = _mm_macc_ps(dx10,fscal,fix1);
1012 fiy1 = _mm_macc_ps(dy10,fscal,fiy1);
1013 fiz1 = _mm_macc_ps(dz10,fscal,fiz1);
1015 fjx0 = _mm_macc_ps(dx10,fscal,fjx0);
1016 fjy0 = _mm_macc_ps(dy10,fscal,fjy0);
1017 fjz0 = _mm_macc_ps(dz10,fscal,fjz0);
1021 /**************************
1022 * CALCULATE INTERACTIONS *
1023 **************************/
1025 if (gmx_mm_any_lt(rsq20,rcutoff2))
1028 r20 = _mm_mul_ps(rsq20,rinv20);
1029 r20 = _mm_andnot_ps(dummy_mask,r20);
1031 /* Compute parameters for interactions between i and j atoms */
1032 qq20 = _mm_mul_ps(iq2,jq0);
1034 /* EWALD ELECTROSTATICS */
1036 /* Analytical PME correction */
1037 zeta2 = _mm_mul_ps(beta2,rsq20);
1038 rinv3 = _mm_mul_ps(rinvsq20,rinv20);
1039 pmecorrF = avx128fma_pmecorrF_f(zeta2);
1040 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
1041 felec = _mm_mul_ps(qq20,felec);
1043 cutoff_mask = _mm_cmplt_ps(rsq20,rcutoff2);
1045 fscal = felec;
1047 fscal = _mm_and_ps(fscal,cutoff_mask);
1049 fscal = _mm_andnot_ps(dummy_mask,fscal);
1051 /* Update vectorial force */
1052 fix2 = _mm_macc_ps(dx20,fscal,fix2);
1053 fiy2 = _mm_macc_ps(dy20,fscal,fiy2);
1054 fiz2 = _mm_macc_ps(dz20,fscal,fiz2);
1056 fjx0 = _mm_macc_ps(dx20,fscal,fjx0);
1057 fjy0 = _mm_macc_ps(dy20,fscal,fjy0);
1058 fjz0 = _mm_macc_ps(dz20,fscal,fjz0);
1062 /**************************
1063 * CALCULATE INTERACTIONS *
1064 **************************/
1066 if (gmx_mm_any_lt(rsq30,rcutoff2))
1069 r30 = _mm_mul_ps(rsq30,rinv30);
1070 r30 = _mm_andnot_ps(dummy_mask,r30);
1072 /* Compute parameters for interactions between i and j atoms */
1073 qq30 = _mm_mul_ps(iq3,jq0);
1075 /* EWALD ELECTROSTATICS */
1077 /* Analytical PME correction */
1078 zeta2 = _mm_mul_ps(beta2,rsq30);
1079 rinv3 = _mm_mul_ps(rinvsq30,rinv30);
1080 pmecorrF = avx128fma_pmecorrF_f(zeta2);
1081 felec = _mm_macc_ps(pmecorrF,beta3,rinv3);
1082 felec = _mm_mul_ps(qq30,felec);
1084 cutoff_mask = _mm_cmplt_ps(rsq30,rcutoff2);
1086 fscal = felec;
1088 fscal = _mm_and_ps(fscal,cutoff_mask);
1090 fscal = _mm_andnot_ps(dummy_mask,fscal);
1092 /* Update vectorial force */
1093 fix3 = _mm_macc_ps(dx30,fscal,fix3);
1094 fiy3 = _mm_macc_ps(dy30,fscal,fiy3);
1095 fiz3 = _mm_macc_ps(dz30,fscal,fiz3);
1097 fjx0 = _mm_macc_ps(dx30,fscal,fjx0);
1098 fjy0 = _mm_macc_ps(dy30,fscal,fjy0);
1099 fjz0 = _mm_macc_ps(dz30,fscal,fjz0);
1103 fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch;
1104 fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch;
1105 fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch;
1106 fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch;
1108 gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,fjx0,fjy0,fjz0);
1110 /* Inner loop uses 96 flops */
1113 /* End of innermost loop */
1115 gmx_mm_update_iforce_3atom_swizzle_ps(fix1,fiy1,fiz1,fix2,fiy2,fiz2,fix3,fiy3,fiz3,
1116 f+i_coord_offset+DIM,fshift+i_shift_offset);
1118 /* Increment number of inner iterations */
1119 inneriter += j_index_end - j_index_start;
1121 /* Outer loop uses 18 flops */
1124 /* Increment number of outer iterations */
1125 outeriter += nri;
1127 /* Update outer/inner flops */
1129 inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_W4_F,outeriter*18 + inneriter*96);