From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3492F3858CDA; Wed, 26 Apr 2023 10:07:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3492F3858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682503648; bh=f5JEnT+LYZs+TmdpdI7Qf1w/ffOsj65I0OvVS1D0uq8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=iUu3owIj2glXnY12Rtnm76qmhZF3ddzvZ10M1TwlJl32ZPQMPuU/ChdzkaDYDzrKH QB3fIQMplnv6zzpO68HebdENoKIsM8FBOY2T4BMl2/Kx4IxiwtYzj7h8rcSJams9Mf qUSZa8E0CWlBijc8FCAcBhfjyT65kIJbsXUx8geM= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109154] [13/14 regression] jump threading de-optimizes nested floating point comparisons Date: Wed, 26 Apr 2023 10:07:25 +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: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: tnfchris at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.2 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 #58 from Jakub Jelinek --- As a different testcase showing what still needs to be done is e.g. void foo (int *p, int *q, int *r, int *s, int *t, int *u) { #pragma omp simd for (int i =3D 0; i < 1024; i++) { int vp =3D p[i]; int vq =3D q[i]; int vr =3D r[i]; int vs =3D s[i]; int vt =3D t[i]; int vu =3D u[i]; int vw; if (vp !=3D 0) { if (vp > 100) { if (vq < 200) vw =3D 1; else if (vr) vw =3D 2; else vw =3D 3; } else if (vs > 100) { if (vq < 180) vw =3D 4; else if (vr > 20) vw =3D 5; else vw =3D 6; } else { if (vq < -100) vw =3D 7; else if (vr < -20) vw =3D 8; else vw =3D 9; } } else if (vt > 10) { if (vu > 100) vw =3D 10; else if (vu < -100) vw =3D 11; else vw =3D 12; } else vw =3D 13; u[i] =3D vw; } } with -O2 -fopenmp-simd. I think we still need 12 VEC_COND_EXPRs to merge it all together, but if we follow what the source is doing (or rediscover it), we can certainly avoid so many useless &s on the conditions by merging it together in the ri= ght order.=