https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109154
--- Comment #44 from Richard Biener <rguenth at gcc dot gnu.org> ---
The larger testcase:
typedef struct __attribute__((__packed__)) _Atom { float x, y, z; int type; }
Atom;
typedef struct __attribute__((__packed__)) _FFParams { int hbtype; float
radius; float hphb; float elsc; } FFParams;
void
fasten_main (unsigned long group, unsigned long natlig, unsigned long natpro,
const Atom *protein, const Atom *ligand,
const FFParams *forcefield, float *energies)
{
float etot[64];
float lpos_x[64];
for (int l = 0; l < 64; l++) {
etot[l] = 0.f;
lpos_x[l] = 0.f;
}
for (int il = 0; il < natlig; il++) {
const Atom l_atom = ligand[il];
const FFParams l_params = forcefield[l_atom.type];
for (int ip = 0; ip < natpro; ip++) {
const Atom p_atom = protein[ip];
const FFParams p_params = forcefield[p_atom.type];
const float radij = p_params.radius + l_params.radius;
const float elcdst = (p_params.hbtype == 70 && l_params.hbtype == 70) ?
4.0f : 2.0f;
const float elcdst1 = (p_params.hbtype == 70 && l_params.hbtype == 70) ?
0.25f : 0.5f;
const int type_E = ((p_params.hbtype == 69 || l_params.hbtype == 69));
const float chrg_init = l_params.elsc * p_params.elsc;
for (int l = 0; l < 64; l++) {
const float x = lpos_x[l] - p_atom.x;
const float distij = (x * x);
const float distbb = distij - radij;
const int zone1 = (distbb < 0.0f);
float chrg_e = chrg_init * ((zone1 ? 1.0f : (1.0f - distbb * elcdst1))
* (distbb < elcdst ? 1.0f : 0.0f));
float neg_chrg_e = -__builtin_fabsf(chrg_e);
chrg_e = type_E ? neg_chrg_e : chrg_e;
etot[l] += chrg_e * 45.0f;
}
}
}
for (int l = 0; l < 64; l++)
energies[group * 64 + l] = etot[l] * 0.5f;
}