From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 04F40383D82D; Tue, 17 Aug 2021 11:24:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 04F40383D82D From: "linkw at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101944] suboptimal SLP for reduced case from namd_r Date: Tue, 17 Aug 2021 11:24:11 +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: 12.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: linkw at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 Aug 2021 11:24:12 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101944 --- Comment #5 from Kewen Lin --- (In reply to Richard Biener from comment #3) > On x86 we even have >=20 > Vector cost: 136 > Scalar cost: 196 >=20 > note that we seem to vectorize the reduction but that only happens with > -ffast-math, not -O2 -ftree-slp-vectorize? >=20 I don't quite follow this question, may misunderstand it. Yes, -ffast-math = is required, now -O2 doesn't implicitly enable vectorization, it needs the explicit slp option. > One issue is the association of >=20 > (diffa * vdw_d * (1 / 6.) + vdw_c * (1 / 4.)) * diffa + vdw_b * (1 / 2.))= * > diffa + vdw_a >=20 > which we fail to reduce as >=20 > diffa*diffa*diffa*(1/6.)*vdw_d + diffa*diffa*(1/4.)*vdw_c + > diffa*(1/2.)*vdw_b + 1.0*vdw_a Good point!=