File: | gromacs/gmxlib/nonbonded/nb_kernel_sse4_1_single/nb_kernel_ElecRFCut_VdwCSTab_GeomP1P1_sse4_1_single.c |
Location: | line 136, column 5 |
Description: | Value stored to 'j_coord_offsetA' 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_ElecRFCut_VdwCSTab_GeomP1P1_VF_sse4_1_single |
54 | * Electrostatics interaction: ReactionField |
55 | * VdW interaction: CubicSplineTable |
56 | * Geometry: Particle-Particle |
57 | * Calculate force/pot: PotentialAndForce |
58 | */ |
59 | void |
60 | nb_kernel_ElecRFCut_VdwCSTab_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 | int nvdwtype; |
93 | __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6; |
94 | int *vdwtype; |
95 | real *vdwparam; |
96 | __m128 one_sixth = _mm_set1_ps(1.0/6.0); |
97 | __m128 one_twelfth = _mm_set1_ps(1.0/12.0); |
98 | __m128i vfitab; |
99 | __m128i ifour = _mm_set1_epi32(4); |
100 | __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF; |
101 | real *vftab; |
102 | __m128 dummy_mask,cutoff_mask; |
103 | __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) ); |
104 | __m128 one = _mm_set1_ps(1.0); |
105 | __m128 two = _mm_set1_ps(2.0); |
106 | x = xx[0]; |
107 | f = ff[0]; |
108 | |
109 | nri = nlist->nri; |
110 | iinr = nlist->iinr; |
111 | jindex = nlist->jindex; |
112 | jjnr = nlist->jjnr; |
113 | shiftidx = nlist->shift; |
114 | gid = nlist->gid; |
115 | shiftvec = fr->shift_vec[0]; |
116 | fshift = fr->fshift[0]; |
117 | facel = _mm_set1_ps(fr->epsfac); |
118 | charge = mdatoms->chargeA; |
119 | krf = _mm_set1_ps(fr->ic->k_rf); |
120 | krf2 = _mm_set1_ps(fr->ic->k_rf*2.0); |
121 | crf = _mm_set1_ps(fr->ic->c_rf); |
122 | nvdwtype = fr->ntype; |
123 | vdwparam = fr->nbfp; |
124 | vdwtype = mdatoms->typeA; |
125 | |
126 | vftab = kernel_data->table_vdw->data; |
127 | vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale); |
128 | |
129 | /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */ |
130 | rcutoff_scalar = fr->rcoulomb; |
131 | rcutoff = _mm_set1_ps(rcutoff_scalar); |
132 | rcutoff2 = _mm_mul_ps(rcutoff,rcutoff); |
133 | |
134 | /* Avoid stupid compiler warnings */ |
135 | jnrA = jnrB = jnrC = jnrD = 0; |
136 | j_coord_offsetA = 0; |
Value stored to 'j_coord_offsetA' is never read | |
137 | j_coord_offsetB = 0; |
138 | j_coord_offsetC = 0; |
139 | j_coord_offsetD = 0; |
140 | |
141 | outeriter = 0; |
142 | inneriter = 0; |
143 | |
144 | for(iidx=0;iidx<4*DIM3;iidx++) |
145 | { |
146 | scratch[iidx] = 0.0; |
147 | } |
148 | |
149 | /* Start outer loop over neighborlists */ |
150 | for(iidx=0; iidx<nri; iidx++) |
151 | { |
152 | /* Load shift vector for this list */ |
153 | i_shift_offset = DIM3*shiftidx[iidx]; |
154 | |
155 | /* Load limits for loop over neighbors */ |
156 | j_index_start = jindex[iidx]; |
157 | j_index_end = jindex[iidx+1]; |
158 | |
159 | /* Get outer coordinate index */ |
160 | inr = iinr[iidx]; |
161 | i_coord_offset = DIM3*inr; |
162 | |
163 | /* Load i particle coords and add shift vector */ |
164 | gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0); |
165 | |
166 | fix0 = _mm_setzero_ps(); |
167 | fiy0 = _mm_setzero_ps(); |
168 | fiz0 = _mm_setzero_ps(); |
169 | |
170 | /* Load parameters for i particles */ |
171 | iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0)); |
172 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
173 | |
174 | /* Reset potential sums */ |
175 | velecsum = _mm_setzero_ps(); |
176 | vvdwsum = _mm_setzero_ps(); |
177 | |
178 | /* Start inner kernel loop */ |
179 | for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4) |
180 | { |
181 | |
182 | /* Get j neighbor index, and coordinate index */ |
183 | jnrA = jjnr[jidx]; |
184 | jnrB = jjnr[jidx+1]; |
185 | jnrC = jjnr[jidx+2]; |
186 | jnrD = jjnr[jidx+3]; |
187 | j_coord_offsetA = DIM3*jnrA; |
188 | j_coord_offsetB = DIM3*jnrB; |
189 | j_coord_offsetC = DIM3*jnrC; |
190 | j_coord_offsetD = DIM3*jnrD; |
191 | |
192 | /* load j atom coordinates */ |
193 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
194 | x+j_coord_offsetC,x+j_coord_offsetD, |
195 | &jx0,&jy0,&jz0); |
196 | |
197 | /* Calculate displacement vector */ |
198 | dx00 = _mm_sub_ps(ix0,jx0); |
199 | dy00 = _mm_sub_ps(iy0,jy0); |
200 | dz00 = _mm_sub_ps(iz0,jz0); |
201 | |
202 | /* Calculate squared distance and things based on it */ |
203 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
204 | |
205 | rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00); |
206 | |
207 | rinvsq00 = _mm_mul_ps(rinv00,rinv00); |
208 | |
209 | /* Load parameters for j particles */ |
210 | jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0, |
211 | charge+jnrC+0,charge+jnrD+0); |
212 | vdwjidx0A = 2*vdwtype[jnrA+0]; |
213 | vdwjidx0B = 2*vdwtype[jnrB+0]; |
214 | vdwjidx0C = 2*vdwtype[jnrC+0]; |
215 | vdwjidx0D = 2*vdwtype[jnrD+0]; |
216 | |
217 | /************************** |
218 | * CALCULATE INTERACTIONS * |
219 | **************************/ |
220 | |
221 | if (gmx_mm_any_lt(rsq00,rcutoff2)) |
222 | { |
223 | |
224 | r00 = _mm_mul_ps(rsq00,rinv00); |
225 | |
226 | /* Compute parameters for interactions between i and j atoms */ |
227 | qq00 = _mm_mul_ps(iq0,jq0); |
228 | gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A, |
229 | vdwparam+vdwioffset0+vdwjidx0B, |
230 | vdwparam+vdwioffset0+vdwjidx0C, |
231 | vdwparam+vdwioffset0+vdwjidx0D, |
232 | &c6_00,&c12_00); |
233 | |
234 | /* Calculate table index by multiplying r with table scale and truncate to integer */ |
235 | rt = _mm_mul_ps(r00,vftabscale); |
236 | vfitab = _mm_cvttps_epi32(rt); |
237 | vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps ((__v4sf)__X, ((0x00 | 0x01))); })); |
238 | vfitab = _mm_slli_epi32(vfitab,3); |
239 | |
240 | /* REACTION-FIELD ELECTROSTATICS */ |
241 | velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_add_ps(rinv00,_mm_mul_ps(krf,rsq00)),crf)); |
242 | felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2)); |
243 | |
244 | /* CUBIC SPLINE TABLE DISPERSION */ |
245 | Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) & 3];})) ); |
246 | F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) & 3];})) ); |
247 | G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) & 3];})) ); |
248 | H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) & 3];})) ); |
249 | _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); |
250 | Heps = _mm_mul_ps(vfeps,H); |
251 | Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps))); |
252 | VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp)); |
253 | vvdw6 = _mm_mul_ps(c6_00,VV); |
254 | FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps)))); |
255 | fvdw6 = _mm_mul_ps(c6_00,FF); |
256 | |
257 | /* CUBIC SPLINE TABLE REPULSION */ |
258 | vfitab = _mm_add_epi32(vfitab,ifour); |
259 | Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) & 3];})) ); |
260 | F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) & 3];})) ); |
261 | G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) & 3];})) ); |
262 | H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) & 3];})) ); |
263 | _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); |
264 | Heps = _mm_mul_ps(vfeps,H); |
265 | Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps))); |
266 | VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp)); |
267 | vvdw12 = _mm_mul_ps(c12_00,VV); |
268 | FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps)))); |
269 | fvdw12 = _mm_mul_ps(c12_00,FF); |
270 | vvdw = _mm_add_ps(vvdw12,vvdw6); |
271 | fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00))); |
272 | |
273 | cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2); |
274 | |
275 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
276 | velec = _mm_and_ps(velec,cutoff_mask); |
277 | velecsum = _mm_add_ps(velecsum,velec); |
278 | vvdw = _mm_and_ps(vvdw,cutoff_mask); |
279 | vvdwsum = _mm_add_ps(vvdwsum,vvdw); |
280 | |
281 | fscal = _mm_add_ps(felec,fvdw); |
282 | |
283 | fscal = _mm_and_ps(fscal,cutoff_mask); |
284 | |
285 | /* Calculate temporary vectorial force */ |
286 | tx = _mm_mul_ps(fscal,dx00); |
287 | ty = _mm_mul_ps(fscal,dy00); |
288 | tz = _mm_mul_ps(fscal,dz00); |
289 | |
290 | /* Update vectorial force */ |
291 | fix0 = _mm_add_ps(fix0,tx); |
292 | fiy0 = _mm_add_ps(fiy0,ty); |
293 | fiz0 = _mm_add_ps(fiz0,tz); |
294 | |
295 | fjptrA = f+j_coord_offsetA; |
296 | fjptrB = f+j_coord_offsetB; |
297 | fjptrC = f+j_coord_offsetC; |
298 | fjptrD = f+j_coord_offsetD; |
299 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
300 | |
301 | } |
302 | |
303 | /* Inner loop uses 72 flops */ |
304 | } |
305 | |
306 | if(jidx<j_index_end) |
307 | { |
308 | |
309 | /* Get j neighbor index, and coordinate index */ |
310 | jnrlistA = jjnr[jidx]; |
311 | jnrlistB = jjnr[jidx+1]; |
312 | jnrlistC = jjnr[jidx+2]; |
313 | jnrlistD = jjnr[jidx+3]; |
314 | /* Sign of each element will be negative for non-real atoms. |
315 | * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones, |
316 | * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries. |
317 | */ |
318 | dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128())); |
319 | jnrA = (jnrlistA>=0) ? jnrlistA : 0; |
320 | jnrB = (jnrlistB>=0) ? jnrlistB : 0; |
321 | jnrC = (jnrlistC>=0) ? jnrlistC : 0; |
322 | jnrD = (jnrlistD>=0) ? jnrlistD : 0; |
323 | j_coord_offsetA = DIM3*jnrA; |
324 | j_coord_offsetB = DIM3*jnrB; |
325 | j_coord_offsetC = DIM3*jnrC; |
326 | j_coord_offsetD = DIM3*jnrD; |
327 | |
328 | /* load j atom coordinates */ |
329 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
330 | x+j_coord_offsetC,x+j_coord_offsetD, |
331 | &jx0,&jy0,&jz0); |
332 | |
333 | /* Calculate displacement vector */ |
334 | dx00 = _mm_sub_ps(ix0,jx0); |
335 | dy00 = _mm_sub_ps(iy0,jy0); |
336 | dz00 = _mm_sub_ps(iz0,jz0); |
337 | |
338 | /* Calculate squared distance and things based on it */ |
339 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
340 | |
341 | rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00); |
342 | |
343 | rinvsq00 = _mm_mul_ps(rinv00,rinv00); |
344 | |
345 | /* Load parameters for j particles */ |
346 | jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0, |
347 | charge+jnrC+0,charge+jnrD+0); |
348 | vdwjidx0A = 2*vdwtype[jnrA+0]; |
349 | vdwjidx0B = 2*vdwtype[jnrB+0]; |
350 | vdwjidx0C = 2*vdwtype[jnrC+0]; |
351 | vdwjidx0D = 2*vdwtype[jnrD+0]; |
352 | |
353 | /************************** |
354 | * CALCULATE INTERACTIONS * |
355 | **************************/ |
356 | |
357 | if (gmx_mm_any_lt(rsq00,rcutoff2)) |
358 | { |
359 | |
360 | r00 = _mm_mul_ps(rsq00,rinv00); |
361 | r00 = _mm_andnot_ps(dummy_mask,r00); |
362 | |
363 | /* Compute parameters for interactions between i and j atoms */ |
364 | qq00 = _mm_mul_ps(iq0,jq0); |
365 | gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A, |
366 | vdwparam+vdwioffset0+vdwjidx0B, |
367 | vdwparam+vdwioffset0+vdwjidx0C, |
368 | vdwparam+vdwioffset0+vdwjidx0D, |
369 | &c6_00,&c12_00); |
370 | |
371 | /* Calculate table index by multiplying r with table scale and truncate to integer */ |
372 | rt = _mm_mul_ps(r00,vftabscale); |
373 | vfitab = _mm_cvttps_epi32(rt); |
374 | vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps ((__v4sf)__X, ((0x00 | 0x01))); })); |
375 | vfitab = _mm_slli_epi32(vfitab,3); |
376 | |
377 | /* REACTION-FIELD ELECTROSTATICS */ |
378 | velec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_add_ps(rinv00,_mm_mul_ps(krf,rsq00)),crf)); |
379 | felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2)); |
380 | |
381 | /* CUBIC SPLINE TABLE DISPERSION */ |
382 | Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) & 3];})) ); |
383 | F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) & 3];})) ); |
384 | G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) & 3];})) ); |
385 | H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) & 3];})) ); |
386 | _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); |
387 | Heps = _mm_mul_ps(vfeps,H); |
388 | Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps))); |
389 | VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp)); |
390 | vvdw6 = _mm_mul_ps(c6_00,VV); |
391 | FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps)))); |
392 | fvdw6 = _mm_mul_ps(c6_00,FF); |
393 | |
394 | /* CUBIC SPLINE TABLE REPULSION */ |
395 | vfitab = _mm_add_epi32(vfitab,ifour); |
396 | Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) & 3];})) ); |
397 | F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) & 3];})) ); |
398 | G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) & 3];})) ); |
399 | H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) & 3];})) ); |
400 | _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); |
401 | Heps = _mm_mul_ps(vfeps,H); |
402 | Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps))); |
403 | VV = _mm_add_ps(Y,_mm_mul_ps(vfeps,Fp)); |
404 | vvdw12 = _mm_mul_ps(c12_00,VV); |
405 | FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps)))); |
406 | fvdw12 = _mm_mul_ps(c12_00,FF); |
407 | vvdw = _mm_add_ps(vvdw12,vvdw6); |
408 | fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00))); |
409 | |
410 | cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2); |
411 | |
412 | /* Update potential sum for this i atom from the interaction with this j atom. */ |
413 | velec = _mm_and_ps(velec,cutoff_mask); |
414 | velec = _mm_andnot_ps(dummy_mask,velec); |
415 | velecsum = _mm_add_ps(velecsum,velec); |
416 | vvdw = _mm_and_ps(vvdw,cutoff_mask); |
417 | vvdw = _mm_andnot_ps(dummy_mask,vvdw); |
418 | vvdwsum = _mm_add_ps(vvdwsum,vvdw); |
419 | |
420 | fscal = _mm_add_ps(felec,fvdw); |
421 | |
422 | fscal = _mm_and_ps(fscal,cutoff_mask); |
423 | |
424 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
425 | |
426 | /* Calculate temporary vectorial force */ |
427 | tx = _mm_mul_ps(fscal,dx00); |
428 | ty = _mm_mul_ps(fscal,dy00); |
429 | tz = _mm_mul_ps(fscal,dz00); |
430 | |
431 | /* Update vectorial force */ |
432 | fix0 = _mm_add_ps(fix0,tx); |
433 | fiy0 = _mm_add_ps(fiy0,ty); |
434 | fiz0 = _mm_add_ps(fiz0,tz); |
435 | |
436 | fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch; |
437 | fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch; |
438 | fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch; |
439 | fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch; |
440 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
441 | |
442 | } |
443 | |
444 | /* Inner loop uses 73 flops */ |
445 | } |
446 | |
447 | /* End of innermost loop */ |
448 | |
449 | gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0, |
450 | f+i_coord_offset,fshift+i_shift_offset); |
451 | |
452 | ggid = gid[iidx]; |
453 | /* Update potential energies */ |
454 | gmx_mm_update_1pot_ps(velecsum,kernel_data->energygrp_elec+ggid); |
455 | gmx_mm_update_1pot_ps(vvdwsum,kernel_data->energygrp_vdw+ggid); |
456 | |
457 | /* Increment number of inner iterations */ |
458 | inneriter += j_index_end - j_index_start; |
459 | |
460 | /* Outer loop uses 9 flops */ |
461 | } |
462 | |
463 | /* Increment number of outer iterations */ |
464 | outeriter += nri; |
465 | |
466 | /* Update outer/inner flops */ |
467 | |
468 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_VF,outeriter*9 + inneriter*73)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_VF] += outeriter*9 + inneriter *73; |
469 | } |
470 | /* |
471 | * Gromacs nonbonded kernel: nb_kernel_ElecRFCut_VdwCSTab_GeomP1P1_F_sse4_1_single |
472 | * Electrostatics interaction: ReactionField |
473 | * VdW interaction: CubicSplineTable |
474 | * Geometry: Particle-Particle |
475 | * Calculate force/pot: Force |
476 | */ |
477 | void |
478 | nb_kernel_ElecRFCut_VdwCSTab_GeomP1P1_F_sse4_1_single |
479 | (t_nblist * gmx_restrict nlist, |
480 | rvec * gmx_restrict xx, |
481 | rvec * gmx_restrict ff, |
482 | t_forcerec * gmx_restrict fr, |
483 | t_mdatoms * gmx_restrict mdatoms, |
484 | nb_kernel_data_t gmx_unused__attribute__ ((unused)) * gmx_restrict kernel_data, |
485 | t_nrnb * gmx_restrict nrnb) |
486 | { |
487 | /* Suffixes 0,1,2,3 refer to particle indices for waters in the inner or outer loop, or |
488 | * just 0 for non-waters. |
489 | * Suffixes A,B,C,D refer to j loop unrolling done with SSE, e.g. for the four different |
490 | * jnr indices corresponding to data put in the four positions in the SIMD register. |
491 | */ |
492 | int i_shift_offset,i_coord_offset,outeriter,inneriter; |
493 | int j_index_start,j_index_end,jidx,nri,inr,ggid,iidx; |
494 | int jnrA,jnrB,jnrC,jnrD; |
495 | int jnrlistA,jnrlistB,jnrlistC,jnrlistD; |
496 | int j_coord_offsetA,j_coord_offsetB,j_coord_offsetC,j_coord_offsetD; |
497 | int *iinr,*jindex,*jjnr,*shiftidx,*gid; |
498 | real rcutoff_scalar; |
499 | real *shiftvec,*fshift,*x,*f; |
500 | real *fjptrA,*fjptrB,*fjptrC,*fjptrD; |
501 | real scratch[4*DIM3]; |
502 | __m128 tx,ty,tz,fscal,rcutoff,rcutoff2,jidxall; |
503 | int vdwioffset0; |
504 | __m128 ix0,iy0,iz0,fix0,fiy0,fiz0,iq0,isai0; |
505 | int vdwjidx0A,vdwjidx0B,vdwjidx0C,vdwjidx0D; |
506 | __m128 jx0,jy0,jz0,fjx0,fjy0,fjz0,jq0,isaj0; |
507 | __m128 dx00,dy00,dz00,rsq00,rinv00,rinvsq00,r00,qq00,c6_00,c12_00; |
508 | __m128 velec,felec,velecsum,facel,crf,krf,krf2; |
509 | real *charge; |
510 | int nvdwtype; |
511 | __m128 rinvsix,rvdw,vvdw,vvdw6,vvdw12,fvdw,fvdw6,fvdw12,vvdwsum,sh_vdw_invrcut6; |
512 | int *vdwtype; |
513 | real *vdwparam; |
514 | __m128 one_sixth = _mm_set1_ps(1.0/6.0); |
515 | __m128 one_twelfth = _mm_set1_ps(1.0/12.0); |
516 | __m128i vfitab; |
517 | __m128i ifour = _mm_set1_epi32(4); |
518 | __m128 rt,vfeps,vftabscale,Y,F,G,H,Heps,Fp,VV,FF; |
519 | real *vftab; |
520 | __m128 dummy_mask,cutoff_mask; |
521 | __m128 signbit = _mm_castsi128_ps( _mm_set1_epi32(0x80000000) ); |
522 | __m128 one = _mm_set1_ps(1.0); |
523 | __m128 two = _mm_set1_ps(2.0); |
524 | x = xx[0]; |
525 | f = ff[0]; |
526 | |
527 | nri = nlist->nri; |
528 | iinr = nlist->iinr; |
529 | jindex = nlist->jindex; |
530 | jjnr = nlist->jjnr; |
531 | shiftidx = nlist->shift; |
532 | gid = nlist->gid; |
533 | shiftvec = fr->shift_vec[0]; |
534 | fshift = fr->fshift[0]; |
535 | facel = _mm_set1_ps(fr->epsfac); |
536 | charge = mdatoms->chargeA; |
537 | krf = _mm_set1_ps(fr->ic->k_rf); |
538 | krf2 = _mm_set1_ps(fr->ic->k_rf*2.0); |
539 | crf = _mm_set1_ps(fr->ic->c_rf); |
540 | nvdwtype = fr->ntype; |
541 | vdwparam = fr->nbfp; |
542 | vdwtype = mdatoms->typeA; |
543 | |
544 | vftab = kernel_data->table_vdw->data; |
545 | vftabscale = _mm_set1_ps(kernel_data->table_vdw->scale); |
546 | |
547 | /* When we use explicit cutoffs the value must be identical for elec and VdW, so use elec as an arbitrary choice */ |
548 | rcutoff_scalar = fr->rcoulomb; |
549 | rcutoff = _mm_set1_ps(rcutoff_scalar); |
550 | rcutoff2 = _mm_mul_ps(rcutoff,rcutoff); |
551 | |
552 | /* Avoid stupid compiler warnings */ |
553 | jnrA = jnrB = jnrC = jnrD = 0; |
554 | j_coord_offsetA = 0; |
555 | j_coord_offsetB = 0; |
556 | j_coord_offsetC = 0; |
557 | j_coord_offsetD = 0; |
558 | |
559 | outeriter = 0; |
560 | inneriter = 0; |
561 | |
562 | for(iidx=0;iidx<4*DIM3;iidx++) |
563 | { |
564 | scratch[iidx] = 0.0; |
565 | } |
566 | |
567 | /* Start outer loop over neighborlists */ |
568 | for(iidx=0; iidx<nri; iidx++) |
569 | { |
570 | /* Load shift vector for this list */ |
571 | i_shift_offset = DIM3*shiftidx[iidx]; |
572 | |
573 | /* Load limits for loop over neighbors */ |
574 | j_index_start = jindex[iidx]; |
575 | j_index_end = jindex[iidx+1]; |
576 | |
577 | /* Get outer coordinate index */ |
578 | inr = iinr[iidx]; |
579 | i_coord_offset = DIM3*inr; |
580 | |
581 | /* Load i particle coords and add shift vector */ |
582 | gmx_mm_load_shift_and_1rvec_broadcast_ps(shiftvec+i_shift_offset,x+i_coord_offset,&ix0,&iy0,&iz0); |
583 | |
584 | fix0 = _mm_setzero_ps(); |
585 | fiy0 = _mm_setzero_ps(); |
586 | fiz0 = _mm_setzero_ps(); |
587 | |
588 | /* Load parameters for i particles */ |
589 | iq0 = _mm_mul_ps(facel,_mm_load1_ps(charge+inr+0)); |
590 | vdwioffset0 = 2*nvdwtype*vdwtype[inr+0]; |
591 | |
592 | /* Start inner kernel loop */ |
593 | for(jidx=j_index_start; jidx<j_index_end && jjnr[jidx+3]>=0; jidx+=4) |
594 | { |
595 | |
596 | /* Get j neighbor index, and coordinate index */ |
597 | jnrA = jjnr[jidx]; |
598 | jnrB = jjnr[jidx+1]; |
599 | jnrC = jjnr[jidx+2]; |
600 | jnrD = jjnr[jidx+3]; |
601 | j_coord_offsetA = DIM3*jnrA; |
602 | j_coord_offsetB = DIM3*jnrB; |
603 | j_coord_offsetC = DIM3*jnrC; |
604 | j_coord_offsetD = DIM3*jnrD; |
605 | |
606 | /* load j atom coordinates */ |
607 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
608 | x+j_coord_offsetC,x+j_coord_offsetD, |
609 | &jx0,&jy0,&jz0); |
610 | |
611 | /* Calculate displacement vector */ |
612 | dx00 = _mm_sub_ps(ix0,jx0); |
613 | dy00 = _mm_sub_ps(iy0,jy0); |
614 | dz00 = _mm_sub_ps(iz0,jz0); |
615 | |
616 | /* Calculate squared distance and things based on it */ |
617 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
618 | |
619 | rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00); |
620 | |
621 | rinvsq00 = _mm_mul_ps(rinv00,rinv00); |
622 | |
623 | /* Load parameters for j particles */ |
624 | jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0, |
625 | charge+jnrC+0,charge+jnrD+0); |
626 | vdwjidx0A = 2*vdwtype[jnrA+0]; |
627 | vdwjidx0B = 2*vdwtype[jnrB+0]; |
628 | vdwjidx0C = 2*vdwtype[jnrC+0]; |
629 | vdwjidx0D = 2*vdwtype[jnrD+0]; |
630 | |
631 | /************************** |
632 | * CALCULATE INTERACTIONS * |
633 | **************************/ |
634 | |
635 | if (gmx_mm_any_lt(rsq00,rcutoff2)) |
636 | { |
637 | |
638 | r00 = _mm_mul_ps(rsq00,rinv00); |
639 | |
640 | /* Compute parameters for interactions between i and j atoms */ |
641 | qq00 = _mm_mul_ps(iq0,jq0); |
642 | gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A, |
643 | vdwparam+vdwioffset0+vdwjidx0B, |
644 | vdwparam+vdwioffset0+vdwjidx0C, |
645 | vdwparam+vdwioffset0+vdwjidx0D, |
646 | &c6_00,&c12_00); |
647 | |
648 | /* Calculate table index by multiplying r with table scale and truncate to integer */ |
649 | rt = _mm_mul_ps(r00,vftabscale); |
650 | vfitab = _mm_cvttps_epi32(rt); |
651 | vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps ((__v4sf)__X, ((0x00 | 0x01))); })); |
652 | vfitab = _mm_slli_epi32(vfitab,3); |
653 | |
654 | /* REACTION-FIELD ELECTROSTATICS */ |
655 | felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2)); |
656 | |
657 | /* CUBIC SPLINE TABLE DISPERSION */ |
658 | Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) & 3];})) ); |
659 | F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) & 3];})) ); |
660 | G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) & 3];})) ); |
661 | H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) & 3];})) ); |
662 | _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); |
663 | Heps = _mm_mul_ps(vfeps,H); |
664 | Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps))); |
665 | FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps)))); |
666 | fvdw6 = _mm_mul_ps(c6_00,FF); |
667 | |
668 | /* CUBIC SPLINE TABLE REPULSION */ |
669 | vfitab = _mm_add_epi32(vfitab,ifour); |
670 | Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) & 3];})) ); |
671 | F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) & 3];})) ); |
672 | G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) & 3];})) ); |
673 | H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) & 3];})) ); |
674 | _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); |
675 | Heps = _mm_mul_ps(vfeps,H); |
676 | Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps))); |
677 | FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps)))); |
678 | fvdw12 = _mm_mul_ps(c12_00,FF); |
679 | fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00))); |
680 | |
681 | cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2); |
682 | |
683 | fscal = _mm_add_ps(felec,fvdw); |
684 | |
685 | fscal = _mm_and_ps(fscal,cutoff_mask); |
686 | |
687 | /* Calculate temporary vectorial force */ |
688 | tx = _mm_mul_ps(fscal,dx00); |
689 | ty = _mm_mul_ps(fscal,dy00); |
690 | tz = _mm_mul_ps(fscal,dz00); |
691 | |
692 | /* Update vectorial force */ |
693 | fix0 = _mm_add_ps(fix0,tx); |
694 | fiy0 = _mm_add_ps(fiy0,ty); |
695 | fiz0 = _mm_add_ps(fiz0,tz); |
696 | |
697 | fjptrA = f+j_coord_offsetA; |
698 | fjptrB = f+j_coord_offsetB; |
699 | fjptrC = f+j_coord_offsetC; |
700 | fjptrD = f+j_coord_offsetD; |
701 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
702 | |
703 | } |
704 | |
705 | /* Inner loop uses 57 flops */ |
706 | } |
707 | |
708 | if(jidx<j_index_end) |
709 | { |
710 | |
711 | /* Get j neighbor index, and coordinate index */ |
712 | jnrlistA = jjnr[jidx]; |
713 | jnrlistB = jjnr[jidx+1]; |
714 | jnrlistC = jjnr[jidx+2]; |
715 | jnrlistD = jjnr[jidx+3]; |
716 | /* Sign of each element will be negative for non-real atoms. |
717 | * This mask will be 0xFFFFFFFF for dummy entries and 0x0 for real ones, |
718 | * so use it as val = _mm_andnot_ps(mask,val) to clear dummy entries. |
719 | */ |
720 | dummy_mask = gmx_mm_castsi128_ps_mm_castsi128_ps(_mm_cmplt_epi32(_mm_loadu_si128((const __m128i *)(jjnr+jidx)),_mm_setzero_si128())); |
721 | jnrA = (jnrlistA>=0) ? jnrlistA : 0; |
722 | jnrB = (jnrlistB>=0) ? jnrlistB : 0; |
723 | jnrC = (jnrlistC>=0) ? jnrlistC : 0; |
724 | jnrD = (jnrlistD>=0) ? jnrlistD : 0; |
725 | j_coord_offsetA = DIM3*jnrA; |
726 | j_coord_offsetB = DIM3*jnrB; |
727 | j_coord_offsetC = DIM3*jnrC; |
728 | j_coord_offsetD = DIM3*jnrD; |
729 | |
730 | /* load j atom coordinates */ |
731 | gmx_mm_load_1rvec_4ptr_swizzle_ps(x+j_coord_offsetA,x+j_coord_offsetB, |
732 | x+j_coord_offsetC,x+j_coord_offsetD, |
733 | &jx0,&jy0,&jz0); |
734 | |
735 | /* Calculate displacement vector */ |
736 | dx00 = _mm_sub_ps(ix0,jx0); |
737 | dy00 = _mm_sub_ps(iy0,jy0); |
738 | dz00 = _mm_sub_ps(iz0,jz0); |
739 | |
740 | /* Calculate squared distance and things based on it */ |
741 | rsq00 = gmx_mm_calc_rsq_ps(dx00,dy00,dz00); |
742 | |
743 | rinv00 = gmx_mm_invsqrt_psgmx_simd_invsqrt_f(rsq00); |
744 | |
745 | rinvsq00 = _mm_mul_ps(rinv00,rinv00); |
746 | |
747 | /* Load parameters for j particles */ |
748 | jq0 = gmx_mm_load_4real_swizzle_ps(charge+jnrA+0,charge+jnrB+0, |
749 | charge+jnrC+0,charge+jnrD+0); |
750 | vdwjidx0A = 2*vdwtype[jnrA+0]; |
751 | vdwjidx0B = 2*vdwtype[jnrB+0]; |
752 | vdwjidx0C = 2*vdwtype[jnrC+0]; |
753 | vdwjidx0D = 2*vdwtype[jnrD+0]; |
754 | |
755 | /************************** |
756 | * CALCULATE INTERACTIONS * |
757 | **************************/ |
758 | |
759 | if (gmx_mm_any_lt(rsq00,rcutoff2)) |
760 | { |
761 | |
762 | r00 = _mm_mul_ps(rsq00,rinv00); |
763 | r00 = _mm_andnot_ps(dummy_mask,r00); |
764 | |
765 | /* Compute parameters for interactions between i and j atoms */ |
766 | qq00 = _mm_mul_ps(iq0,jq0); |
767 | gmx_mm_load_4pair_swizzle_ps(vdwparam+vdwioffset0+vdwjidx0A, |
768 | vdwparam+vdwioffset0+vdwjidx0B, |
769 | vdwparam+vdwioffset0+vdwjidx0C, |
770 | vdwparam+vdwioffset0+vdwjidx0D, |
771 | &c6_00,&c12_00); |
772 | |
773 | /* Calculate table index by multiplying r with table scale and truncate to integer */ |
774 | rt = _mm_mul_ps(r00,vftabscale); |
775 | vfitab = _mm_cvttps_epi32(rt); |
776 | vfeps = _mm_sub_ps(rt,_mm_round_ps(rt, _MM_FROUND_FLOOR)__extension__ ({ __m128 __X = (rt); (__m128) __builtin_ia32_roundps ((__v4sf)__X, ((0x00 | 0x01))); })); |
777 | vfitab = _mm_slli_epi32(vfitab,3); |
778 | |
779 | /* REACTION-FIELD ELECTROSTATICS */ |
780 | felec = _mm_mul_ps(qq00,_mm_sub_ps(_mm_mul_ps(rinv00,rinvsq00),krf2)); |
781 | |
782 | /* CUBIC SPLINE TABLE DISPERSION */ |
783 | Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) & 3];})) ); |
784 | F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) & 3];})) ); |
785 | G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) & 3];})) ); |
786 | H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) & 3];})) ); |
787 | _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); |
788 | Heps = _mm_mul_ps(vfeps,H); |
789 | Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps))); |
790 | FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps)))); |
791 | fvdw6 = _mm_mul_ps(c6_00,FF); |
792 | |
793 | /* CUBIC SPLINE TABLE REPULSION */ |
794 | vfitab = _mm_add_epi32(vfitab,ifour); |
795 | Y = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,0)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(0) & 3];})) ); |
796 | F = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,1)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(1) & 3];})) ); |
797 | G = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,2)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(2) & 3];})) ); |
798 | H = _mm_load_ps( vftab + gmx_mm_extract_epi32(vfitab,3)(__extension__ ({ __v4si __a = (__v4si)(vfitab); __a[(3) & 3];})) ); |
799 | _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); |
800 | Heps = _mm_mul_ps(vfeps,H); |
801 | Fp = _mm_add_ps(F,_mm_mul_ps(vfeps,_mm_add_ps(G,Heps))); |
802 | FF = _mm_add_ps(Fp,_mm_mul_ps(vfeps,_mm_add_ps(G,_mm_add_ps(Heps,Heps)))); |
803 | fvdw12 = _mm_mul_ps(c12_00,FF); |
804 | fvdw = _mm_xor_ps(signbit,_mm_mul_ps(_mm_add_ps(fvdw6,fvdw12),_mm_mul_ps(vftabscale,rinv00))); |
805 | |
806 | cutoff_mask = _mm_cmplt_ps(rsq00,rcutoff2); |
807 | |
808 | fscal = _mm_add_ps(felec,fvdw); |
809 | |
810 | fscal = _mm_and_ps(fscal,cutoff_mask); |
811 | |
812 | fscal = _mm_andnot_ps(dummy_mask,fscal); |
813 | |
814 | /* Calculate temporary vectorial force */ |
815 | tx = _mm_mul_ps(fscal,dx00); |
816 | ty = _mm_mul_ps(fscal,dy00); |
817 | tz = _mm_mul_ps(fscal,dz00); |
818 | |
819 | /* Update vectorial force */ |
820 | fix0 = _mm_add_ps(fix0,tx); |
821 | fiy0 = _mm_add_ps(fiy0,ty); |
822 | fiz0 = _mm_add_ps(fiz0,tz); |
823 | |
824 | fjptrA = (jnrlistA>=0) ? f+j_coord_offsetA : scratch; |
825 | fjptrB = (jnrlistB>=0) ? f+j_coord_offsetB : scratch; |
826 | fjptrC = (jnrlistC>=0) ? f+j_coord_offsetC : scratch; |
827 | fjptrD = (jnrlistD>=0) ? f+j_coord_offsetD : scratch; |
828 | gmx_mm_decrement_1rvec_4ptr_swizzle_ps(fjptrA,fjptrB,fjptrC,fjptrD,tx,ty,tz); |
829 | |
830 | } |
831 | |
832 | /* Inner loop uses 58 flops */ |
833 | } |
834 | |
835 | /* End of innermost loop */ |
836 | |
837 | gmx_mm_update_iforce_1atom_swizzle_ps(fix0,fiy0,fiz0, |
838 | f+i_coord_offset,fshift+i_shift_offset); |
839 | |
840 | /* Increment number of inner iterations */ |
841 | inneriter += j_index_end - j_index_start; |
842 | |
843 | /* Outer loop uses 7 flops */ |
844 | } |
845 | |
846 | /* Increment number of outer iterations */ |
847 | outeriter += nri; |
848 | |
849 | /* Update outer/inner flops */ |
850 | |
851 | inc_nrnb(nrnb,eNR_NBKERNEL_ELEC_VDW_F,outeriter*7 + inneriter*58)(nrnb)->n[eNR_NBKERNEL_ELEC_VDW_F] += outeriter*7 + inneriter *58; |
852 | } |