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