File: | gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecCoul_VdwNone_GeomP1P1_sse4_1_single.c |
Location: | line 111, column 5 |
Description: | Value stored to 'jnrA' is never read |
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_ElecCoul_VdwNone_GeomP1P1_VF_sse4_1_single |
54 | * Electrostatics interaction: Coulomb |
55 | * VdW interaction: None |
56 | * Geometry: Particle-Particle |
57 | * Calculate force/pot: PotentialAndForce |
58 | */ |
59 | void |
60 | nb_kernel_ElecCoul_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 | __m128 dummy_mask,cutoff_mask; |
93 | __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) ); |
94 | __m128 one = _mm_set1_ps(1.0); |
95 | __m128 two = _mm_set1_ps(2.0); |
96 | x = xx[0]; |
97 | f = ff[0]; |
98 | |
99 | nri = nlist->nri; |
100 | iinr = nlist->iinr; |
101 | jindex = nlist->jindex; |
102 | jjnr = nlist->jjnr; |
103 | shiftidx = nlist->shift; |
104 | gid = nlist->gid; |
105 | shiftvec = fr->shift_vec[0]; |
106 | fshift = fr->fshift[0]; |
107 | facel = _mm_set1_ps(fr->epsfac); |
108 | charge = mdatoms->chargeA; |
109 | |
110 | /* Avoid stupid compiler warnings */ |
111 | jnrA = jnrB = jnrC = jnrD = 0; |
Value stored to 'jnrA' is never read | |
112 | j_coord_offsetA = 0; |
113 | j_coord_offsetB = 0; |
114 | j_coord_offsetC = 0; |
115 | j_coord_offsetD = 0; |
116 | |
117 | outeriter = 0; |
118 | inneriter = 0; |
119 | |
120 | for(iidx=0;iidx<4*DIM3;iidx++) |
121 | { |
122 | scratch[iidx] = 0.0; |
123 | } |
124 | |
125 | /* Start outer loop over neighborlists */ |
126 | for(iidx=0; iidx<nri; iidx++) |
127 | { |
128 | /* Load shift vector for this list */ |
129 | i_shift_offset = DIM3*shiftidx[iidx]; |
130 | |
131 | /* Load limits for loop over neighbors */ |
132 | j_index_start = jindex[iidx]; |
133 | j_index_end = jindex[iidx+1]; |
134 | |
135 | /* Get outer coordinate index */ |
136 | inr = iinr[iidx]; |
137 | i_coord_offset = DIM3*inr; |
138 | |
139 | /* Load i particle coords and add shift vector */ |
140 | gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0); |
141 | |
142 | fix0 = _mm_setzero_ps(); |
143 | fiy0 = _mm_setzero_ps(); |
144 | fiz0 = _mm_setzero_ps(); |
145 | |
146 | /* Load parameters for i particles */ |
147 | iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0)); |
148 | |
149 | /* Reset potential sums */ |
150 | velecsum = _mm_setzero_ps(); |
151 | |
152 | /* Start inner kernel loop */ |
153 | for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4) |
154 | { |
155 | |
156 | /* Get j neighbor index, and coordinate index */ |
157 | jnrA = jjnr[jidx]; |
158 | jnrB = jjnr[jidx+1]; |
159 | jnrC = jjnr[jidx+2]; |
160 | jnrD = jjnr[jidx+3]; |
161 | j_coord_offsetA = DIM3*jnrA; |
162 | j_coord_offsetB = DIM3*jnrB; |
163 | j_coord_offsetC = DIM3*jnrC; |
164 | j_coord_offsetD = DIM3*jnrD; |
165 | |
166 | /* load j atom coordinates */ |
167 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
168 | x+j_coord_offsetC,x+j_coord_offsetD, |
169 | &jx0,&jy0,&jz0); |
170 | |
171 | /* Calculate displacement vector */ |
172 | dx00 = _mm_sub_ps(ix0,jx0); |
173 | dy00 = _mm_sub_ps(iy0,jy0); |
174 | dz00 = _mm_sub_ps(iz0,jz0); |
175 | |
176 | /* Calculate squared distance and things based on it */ |
177 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
178 | |
179 | rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00); |
180 | |
181 | rinvsq00 = _mm_mul_ps(rinv00,rinv00); |
182 | |
183 | /* Load parameters for j particles */ |
184 | jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0, |
185 | charge+jnrC+0,charge+jnrD+0); |
186 | |
187 | /************************** |
188 | * CALCULATE INTERACTIONS * |
189 | **************************/ |
190 | |
191 | /* Compute parameters for interactions between i and j atoms */ |
192 | qq00 = _mm_mul_ps(iq0,jq0); |
193 | |
194 | /* COULOMB ELECTROSTATICS */ |
195 | velec = _mm_mul_ps(qq00,rinv00); |
196 | felec = _mm_mul_ps(velec,rinvsq00); |
197 | |
198 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
199 | velecsum = _mm_add_ps(velecsum,velec); |
200 | |
201 | fscal = felec; |
202 | |
203 | /* Calculate temporary vectorial force */ |
204 | tx = _mm_mul_ps(fscal,dx00); |
205 | ty = _mm_mul_ps(fscal,dy00); |
206 | tz = _mm_mul_ps(fscal,dz00); |
207 | |
208 | /* Update vectorial force */ |
209 | fix0 = _mm_add_ps(fix0,tx); |
210 | fiy0 = _mm_add_ps(fiy0,ty); |
211 | fiz0 = _mm_add_ps(fiz0,tz); |
212 | |
213 | fjptrA = f+j_coord_offsetA; |
214 | fjptrB = f+j_coord_offsetB; |
215 | fjptrC = f+j_coord_offsetC; |
216 | fjptrD = f+j_coord_offsetD; |
217 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
218 | |
219 | /* Inner loop uses 28 flops */ |
220 | } |
221 | |
222 | if(jidx<j_index_end) |
223 | { |
224 | |
225 | /* Get j neighbor index, and coordinate index */ |
226 | jnrlistA = jjnr[jidx]; |
227 | jnrlistB = jjnr[jidx+1]; |
228 | jnrlistC = jjnr[jidx+2]; |
229 | jnrlistD = jjnr[jidx+3]; |
230 | /* Sign of each element will be negative for non-real atoms. |
231 | * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones, |
232 | * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries. |
233 | */ |
234 | dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128())); |
235 | jnrA = (jnrlistA>=0) ? jnrlistA : 0; |
236 | jnrB = (jnrlistB>=0) ? jnrlistB : 0; |
237 | jnrC = (jnrlistC>=0) ? jnrlistC : 0; |
238 | jnrD = (jnrlistD>=0) ? jnrlistD : 0; |
239 | j_coord_offsetA = DIM3*jnrA; |
240 | j_coord_offsetB = DIM3*jnrB; |
241 | j_coord_offsetC = DIM3*jnrC; |
242 | j_coord_offsetD = DIM3*jnrD; |
243 | |
244 | /* load j atom coordinates */ |
245 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
246 | x+j_coord_offsetC,x+j_coord_offsetD, |
247 | &jx0,&jy0,&jz0); |
248 | |
249 | /* Calculate displacement vector */ |
250 | dx00 = _mm_sub_ps(ix0,jx0); |
251 | dy00 = _mm_sub_ps(iy0,jy0); |
252 | dz00 = _mm_sub_ps(iz0,jz0); |
253 | |
254 | /* Calculate squared distance and things based on it */ |
255 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
256 | |
257 | rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00); |
258 | |
259 | rinvsq00 = _mm_mul_ps(rinv00,rinv00); |
260 | |
261 | /* Load parameters for j particles */ |
262 | jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0, |
263 | charge+jnrC+0,charge+jnrD+0); |
264 | |
265 | /************************** |
266 | * CALCULATE INTERACTIONS * |
267 | **************************/ |
268 | |
269 | /* Compute parameters for interactions between i and j atoms */ |
270 | qq00 = _mm_mul_ps(iq0,jq0); |
271 | |
272 | /* COULOMB ELECTROSTATICS */ |
273 | velec = _mm_mul_ps(qq00,rinv00); |
274 | felec = _mm_mul_ps(velec,rinvsq00); |
275 | |
276 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
277 | velec = _mm_andnot_ps(dummy_mask,velec); |
278 | velecsum = _mm_add_ps(velecsum,velec); |
279 | |
280 | fscal = felec; |
281 | |
282 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
283 | |
284 | /* Calculate temporary vectorial force */ |
285 | tx = _mm_mul_ps(fscal,dx00); |
286 | ty = _mm_mul_ps(fscal,dy00); |
287 | tz = _mm_mul_ps(fscal,dz00); |
288 | |
289 | /* Update vectorial force */ |
290 | fix0 = _mm_add_ps(fix0,tx); |
291 | fiy0 = _mm_add_ps(fiy0,ty); |
292 | fiz0 = _mm_add_ps(fiz0,tz); |
293 | |
294 | fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch; |
295 | fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch; |
296 | fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch; |
297 | fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch; |
298 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
299 | |
300 | /* Inner loop uses 28 flops */ |
301 | } |
302 | |
303 | /* End of innermost loop */ |
304 | |
305 | gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0, |
306 | f+i_coord_offset,fshift+i_shift_offset); |
307 | |
308 | ggid = gid[iidx]; |
309 | /* Update potential energies */ |
310 | gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid); |
311 | |
312 | /* Increment number of inner iterations */ |
313 | inneriter += j_index_end - j_index_start; |
314 | |
315 | /* Outer loop uses 8 flops */ |
316 | } |
317 | |
318 | /* Increment number of outer iterations */ |
319 | outeriter += nri; |
320 | |
321 | /* Update outer/inner flops */ |
322 | |
323 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VF,outeriter*8 + inneriter*28)(nrnb)->n[eNR_NBKERNEL_ELEC_VF] += outeriter*8 + inneriter *28; |
324 | } |
325 | /* |
326 | * Gromacs nonbonded kernel: nb_kernel_ElecCoul_VdwNone_GeomP1P1_F_sse4_1_single |
327 | * Electrostatics interaction: Coulomb |
328 | * VdW interaction: None |
329 | * Geometry: Particle-Particle |
330 | * Calculate force/pot: Force |
331 | */ |
332 | void |
333 | nb_kernel_ElecCoul_VdwNone_GeomP1P1_F_sse4_1_single |
334 | (t_nblist * gmx_restrict nlist, |
335 | rvec * gmx_restrict xx, |
336 | rvec * gmx_restrict ff, |
337 | t_forcerec * gmx_restrict fr, |
338 | t_mdatoms * gmx_restrict mdatoms, |
339 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data, |
340 | t_nrnb * gmx_restrict nrnb) |
341 | { |
342 | /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or |
343 | * just 0 for non-waters. |
344 | * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different |
345 | * jnr indices corresponding to data put in the four positions in the SIMD register. |
346 | */ |
347 | int i_shift_offset,i_coord_offset,outeriter,inneriter; |
348 | int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx; |
349 | int jnrA,jnrB,jnrC,jnrD; |
350 | int jnrlistA,jnrlistB,jnrlistC,jnrlistD; |
351 | int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD; |
352 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
353 | real rcutoff_scalar; |
354 | real *shiftvec,*fshift,*x,*f; |
355 | real *fjptrA,*fjptrB,*fjptrC,*fjptrD; |
356 | real scratch[4*DIM3]; |
357 | __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall; |
358 | int vdwioffset0; |
359 | __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
360 | int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D; |
361 | __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
362 | __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00; |
363 | __m128 velec,felec,velecsum,facel,crf,krf,krf2; |
364 | real *charge; |
365 | __m128 dummy_mask,cutoff_mask; |
366 | __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) ); |
367 | __m128 one = _mm_set1_ps(1.0); |
368 | __m128 two = _mm_set1_ps(2.0); |
369 | x = xx[0]; |
370 | f = ff[0]; |
371 | |
372 | nri = nlist->nri; |
373 | iinr = nlist->iinr; |
374 | jindex = nlist->jindex; |
375 | jjnr = nlist->jjnr; |
376 | shiftidx = nlist->shift; |
377 | gid = nlist->gid; |
378 | shiftvec = fr->shift_vec[0]; |
379 | fshift = fr->fshift[0]; |
380 | facel = _mm_set1_ps(fr->epsfac); |
381 | charge = mdatoms->chargeA; |
382 | |
383 | /* Avoid stupid compiler warnings */ |
384 | jnrA = jnrB = jnrC = jnrD = 0; |
385 | j_coord_offsetA = 0; |
386 | j_coord_offsetB = 0; |
387 | j_coord_offsetC = 0; |
388 | j_coord_offsetD = 0; |
389 | |
390 | outeriter = 0; |
391 | inneriter = 0; |
392 | |
393 | for(iidx=0;iidx<4*DIM3;iidx++) |
394 | { |
395 | scratch[iidx] = 0.0; |
396 | } |
397 | |
398 | /* Start outer loop over neighborlists */ |
399 | for(iidx=0; iidx<nri; iidx++) |
400 | { |
401 | /* Load shift vector for this list */ |
402 | i_shift_offset = DIM3*shiftidx[iidx]; |
403 | |
404 | /* Load limits for loop over neighbors */ |
405 | j_index_start = jindex[iidx]; |
406 | j_index_end = jindex[iidx+1]; |
407 | |
408 | /* Get outer coordinate index */ |
409 | inr = iinr[iidx]; |
410 | i_coord_offset = DIM3*inr; |
411 | |
412 | /* Load i particle coords and add shift vector */ |
413 | gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0); |
414 | |
415 | fix0 = _mm_setzero_ps(); |
416 | fiy0 = _mm_setzero_ps(); |
417 | fiz0 = _mm_setzero_ps(); |
418 | |
419 | /* Load parameters for i particles */ |
420 | iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0)); |
421 | |
422 | /* Start inner kernel loop */ |
423 | for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4) |
424 | { |
425 | |
426 | /* Get j neighbor index, and coordinate index */ |
427 | jnrA = jjnr[jidx]; |
428 | jnrB = jjnr[jidx+1]; |
429 | jnrC = jjnr[jidx+2]; |
430 | jnrD = jjnr[jidx+3]; |
431 | j_coord_offsetA = DIM3*jnrA; |
432 | j_coord_offsetB = DIM3*jnrB; |
433 | j_coord_offsetC = DIM3*jnrC; |
434 | j_coord_offsetD = DIM3*jnrD; |
435 | |
436 | /* load j atom coordinates */ |
437 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
438 | x+j_coord_offsetC,x+j_coord_offsetD, |
439 | &jx0,&jy0,&jz0); |
440 | |
441 | /* Calculate displacement vector */ |
442 | dx00 = _mm_sub_ps(ix0,jx0); |
443 | dy00 = _mm_sub_ps(iy0,jy0); |
444 | dz00 = _mm_sub_ps(iz0,jz0); |
445 | |
446 | /* Calculate squared distance and things based on it */ |
447 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
448 | |
449 | rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00); |
450 | |
451 | rinvsq00 = _mm_mul_ps(rinv00,rinv00); |
452 | |
453 | /* Load parameters for j particles */ |
454 | jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0, |
455 | charge+jnrC+0,charge+jnrD+0); |
456 | |
457 | /************************** |
458 | * CALCULATE INTERACTIONS * |
459 | **************************/ |
460 | |
461 | /* Compute parameters for interactions between i and j atoms */ |
462 | qq00 = _mm_mul_ps(iq0,jq0); |
463 | |
464 | /* COULOMB ELECTROSTATICS */ |
465 | velec = _mm_mul_ps(qq00,rinv00); |
466 | felec = _mm_mul_ps(velec,rinvsq00); |
467 | |
468 | fscal = felec; |
469 | |
470 | /* Calculate temporary vectorial force */ |
471 | tx = _mm_mul_ps(fscal,dx00); |
472 | ty = _mm_mul_ps(fscal,dy00); |
473 | tz = _mm_mul_ps(fscal,dz00); |
474 | |
475 | /* Update vectorial force */ |
476 | fix0 = _mm_add_ps(fix0,tx); |
477 | fiy0 = _mm_add_ps(fiy0,ty); |
478 | fiz0 = _mm_add_ps(fiz0,tz); |
479 | |
480 | fjptrA = f+j_coord_offsetA; |
481 | fjptrB = f+j_coord_offsetB; |
482 | fjptrC = f+j_coord_offsetC; |
483 | fjptrD = f+j_coord_offsetD; |
484 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
485 | |
486 | /* Inner loop uses 27 flops */ |
487 | } |
488 | |
489 | if(jidx<j_index_end) |
490 | { |
491 | |
492 | /* Get j neighbor index, and coordinate index */ |
493 | jnrlistA = jjnr[jidx]; |
494 | jnrlistB = jjnr[jidx+1]; |
495 | jnrlistC = jjnr[jidx+2]; |
496 | jnrlistD = jjnr[jidx+3]; |
497 | /* Sign of each element will be negative for non-real atoms. |
498 | * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones, |
499 | * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries. |
500 | */ |
501 | dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128())); |
502 | jnrA = (jnrlistA>=0) ? jnrlistA : 0; |
503 | jnrB = (jnrlistB>=0) ? jnrlistB : 0; |
504 | jnrC = (jnrlistC>=0) ? jnrlistC : 0; |
505 | jnrD = (jnrlistD>=0) ? jnrlistD : 0; |
506 | j_coord_offsetA = DIM3*jnrA; |
507 | j_coord_offsetB = DIM3*jnrB; |
508 | j_coord_offsetC = DIM3*jnrC; |
509 | j_coord_offsetD = DIM3*jnrD; |
510 | |
511 | /* load j atom coordinates */ |
512 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
513 | x+j_coord_offsetC,x+j_coord_offsetD, |
514 | &jx0,&jy0,&jz0); |
515 | |
516 | /* Calculate displacement vector */ |
517 | dx00 = _mm_sub_ps(ix0,jx0); |
518 | dy00 = _mm_sub_ps(iy0,jy0); |
519 | dz00 = _mm_sub_ps(iz0,jz0); |
520 | |
521 | /* Calculate squared distance and things based on it */ |
522 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
523 | |
524 | rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00); |
525 | |
526 | rinvsq00 = _mm_mul_ps(rinv00,rinv00); |
527 | |
528 | /* Load parameters for j particles */ |
529 | jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0, |
530 | charge+jnrC+0,charge+jnrD+0); |
531 | |
532 | /************************** |
533 | * CALCULATE INTERACTIONS * |
534 | **************************/ |
535 | |
536 | /* Compute parameters for interactions between i and j atoms */ |
537 | qq00 = _mm_mul_ps(iq0,jq0); |
538 | |
539 | /* COULOMB ELECTROSTATICS */ |
540 | velec = _mm_mul_ps(qq00,rinv00); |
541 | felec = _mm_mul_ps(velec,rinvsq00); |
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,dx00); |
549 | ty = _mm_mul_ps(fscal,dy00); |
550 | tz = _mm_mul_ps(fscal,dz00); |
551 | |
552 | /* Update vectorial force */ |
553 | fix0 = _mm_add_ps(fix0,tx); |
554 | fiy0 = _mm_add_ps(fiy0,ty); |
555 | fiz0 = _mm_add_ps(fiz0,tz); |
556 | |
557 | fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch; |
558 | fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch; |
559 | fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch; |
560 | fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch; |
561 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
562 | |
563 | /* Inner loop uses 27 flops */ |
564 | } |
565 | |
566 | /* End of innermost loop */ |
567 | |
568 | gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0, |
569 | f+i_coord_offset,fshift+i_shift_offset); |
570 | |
571 | /* Increment number of inner iterations */ |
572 | inneriter += j_index_end - j_index_start; |
573 | |
574 | /* Outer loop uses 7 flops */ |
575 | } |
576 | |
577 | /* Increment number of outer iterations */ |
578 | outeriter += nri; |
579 | |
580 | /* Update outer/inner flops */ |
581 | |
582 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_F,outeriter*7 + inneriter*27)(nrnb)->n[eNR_NBKERNEL_ELEC_F] += outeriter*7 + inneriter* 27; |
583 | } |