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