Bug Summary

File:gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecCSTab_VdwNone_GeomP1P1_sse4_1_single.c
Location:line 419, column 5
Description:Value stored to 'gid' is never read

Annotated Source Code

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