From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1917A3858D39; Tue, 11 Apr 2023 09:36:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1917A3858D39 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681205814; bh=r5hbNJ0bbJnQd/SEiFLDBGdkQLN0Oc1fjp+LWKsM0TQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Sjz86yGFDnj4wuAWP76ikIeSiOo9pzOAryMIYCg24/qEWaHmbrht4M4dQp8fdIDhY wAWrj8P19ThET1SOVkeG5cGX2VbI/YsWMFrsCyWApFcUzoYC4B570+cKHACAEGw8k+ tTRE3sqi6BSMneZntmsaUVJ0mpvZxPjUdqi7UUjg= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109154] [13 regression] jump threading de-optimizes nested floating point comparisons Date: Tue, 11 Apr 2023 09:36:50 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109154 --- Comment #44 from Richard Biener --- 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 natpr= o, const Atom *protein, const Atom *ligand, const FFParams *forcefield, float *energies) { float etot[64]; float lpos_x[64]; for (int l =3D 0; l < 64; l++) { etot[l] =3D 0.f; lpos_x[l] =3D 0.f; } for (int il =3D 0; il < natlig; il++) { const Atom l_atom =3D ligand[il]; const FFParams l_params =3D forcefield[l_atom.type]; for (int ip =3D 0; ip < natpro; ip++) { const Atom p_atom =3D protein[ip]; const FFParams p_params =3D forcefield[p_atom.type]; const float radij =3D p_params.radius + l_params.radius; const float elcdst =3D (p_params.hbtype =3D=3D 70 && l_params.hbtype = =3D=3D 70) ? 4.0f : 2.0f; const float elcdst1 =3D (p_params.hbtype =3D=3D 70 && l_params.hbtype= =3D=3D 70) ? 0.25f : 0.5f; const int type_E =3D ((p_params.hbtype =3D=3D 69 || l_params.hbtype = =3D=3D 69)); const float chrg_init =3D l_params.elsc * p_params.elsc; for (int l =3D 0; l < 64; l++) { const float x =3D lpos_x[l] - p_atom.x; const float distij =3D (x * x); const float distbb =3D distij - radij; const int zone1 =3D (distbb < 0.0f); float chrg_e =3D chrg_init * ((zone1 ? 1.0f : (1.0f - distbb * elcd= st1)) * (distbb < elcdst ? 1.0f : 0.0f)); float neg_chrg_e =3D -__builtin_fabsf(chrg_e); chrg_e =3D type_E ? neg_chrg_e : chrg_e; etot[l] +=3D chrg_e * 45.0f; } } } for (int l =3D 0; l < 64; l++) energies[group * 64 + l] =3D etot[l] * 0.5f; }=