/* Calculate exponentials through SIMD */ gmx_inline static void calc_exponentials_q(int gmx_unused start, int end, real f, real *d_aligned, real *r_aligned, real *e_aligned) { { const gmx_simd_real_t two = gmx_simd_set1_r(2.0); gmx_simd_real_t f_simd; gmx_simd_real_t lu; gmx_simd_real_t tmp_d1, d_inv, tmp_r, tmp_e; int kx; f_simd = gmx_simd_set1_r(f); /* We only need to calculate from start. But since start is 0 or 1 * and we want to use aligned loads/stores, we always start from 0. */ for (kx = 0; kx < end; kx += GMX_SIMD_REAL_WIDTH) { tmp_d1 = gmx_simd_load_r(d_aligned+kx); d_inv = gmx_simd_inv_r(tmp_d1); tmp_r = gmx_simd_load_r(r_aligned+kx); tmp_r = gmx_simd_exp_r(tmp_r); tmp_e = gmx_simd_mul_r(f_simd, d_inv); tmp_e = gmx_simd_mul_r(tmp_e, tmp_r); gmx_simd_store_r(e_aligned+kx, tmp_e); } } }
void set_pbc_simd(const t_pbc gmx_unused *pbc, pbc_simd_t gmx_unused *pbc_simd) { #ifdef GMX_SIMD_HAVE_REAL rvec inv_box_diag; int d; /* Setting inv_bdiag to 0 effectively turns off PBC */ clear_rvec(inv_box_diag); if (pbc != NULL) { for (d = 0; d < pbc->ndim_ePBC; d++) { inv_box_diag[d] = 1.0/pbc->box[d][d]; } } pbc_simd->inv_bzz = gmx_simd_set1_r(inv_box_diag[ZZ]); pbc_simd->inv_byy = gmx_simd_set1_r(inv_box_diag[YY]); pbc_simd->inv_bxx = gmx_simd_set1_r(inv_box_diag[XX]); if (pbc != NULL) { pbc_simd->bzx = gmx_simd_set1_r(pbc->box[ZZ][XX]); pbc_simd->bzy = gmx_simd_set1_r(pbc->box[ZZ][YY]); pbc_simd->bzz = gmx_simd_set1_r(pbc->box[ZZ][ZZ]); pbc_simd->byx = gmx_simd_set1_r(pbc->box[YY][XX]); pbc_simd->byy = gmx_simd_set1_r(pbc->box[YY][YY]); pbc_simd->bxx = gmx_simd_set1_r(pbc->box[XX][XX]); } else { pbc_simd->bzx = gmx_simd_setzero_r(); pbc_simd->bzy = gmx_simd_setzero_r(); pbc_simd->bzz = gmx_simd_setzero_r(); pbc_simd->byx = gmx_simd_setzero_r(); pbc_simd->byy = gmx_simd_setzero_r(); pbc_simd->bxx = gmx_simd_setzero_r(); } #endif }
/* Calculate exponentials through SIMD */ gmx_inline static void calc_exponentials_lj(int gmx_unused start, int end, real *r_aligned, real *factor_aligned, real *d_aligned) { gmx_simd_real_t tmp_r, tmp_d, tmp_fac, d_inv, tmp_mk; const gmx_simd_real_t sqr_PI = gmx_simd_sqrt_r(gmx_simd_set1_r(M_PI)); int kx; for (kx = 0; kx < end; kx += GMX_SIMD_REAL_WIDTH) { /* We only need to calculate from start. But since start is 0 or 1 * and we want to use aligned loads/stores, we always start from 0. */ tmp_d = gmx_simd_load_r(d_aligned+kx); d_inv = gmx_simd_inv_r(tmp_d); gmx_simd_store_r(d_aligned+kx, d_inv); tmp_r = gmx_simd_load_r(r_aligned+kx); tmp_r = gmx_simd_exp_r(tmp_r); gmx_simd_store_r(r_aligned+kx, tmp_r); tmp_mk = gmx_simd_load_r(factor_aligned+kx); tmp_fac = gmx_simd_mul_r(sqr_PI, gmx_simd_mul_r(tmp_mk, gmx_simd_erfc_r(tmp_mk))); gmx_simd_store_r(factor_aligned+kx, tmp_fac); } }