From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9F5C73858C27; Wed, 13 Oct 2021 07:25:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9F5C73858C27 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/102543] -march=cascadelake performs odd alignment peeling Date: Wed, 13 Oct 2021 07:25:43 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de 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: Wed, 13 Oct 2021 07:25:43 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102543 --- Comment #10 from rguenther at suse dot de --- On Wed, 13 Oct 2021, crazylht at gmail dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102543 >=20 > --- Comment #9 from Hongtao.liu --- > I'm curious why we need peeling for unaligned access, because unaligned a= ccess > instructions should also be available for aligned addresses, can't we jus= t mark > mem_ref as unaligned (although this is fake, just to generate unaligned > instructions for the back end only) The costing is not for movaps vs movups but for movups on aligned vs.=20 unaligned storage. So to make the access fast the costing tells us that the access has to be actually unaligned. Anyhow, the vectorizer does not consider to actively misalign in case all accesses are known to be aligned - but what happens is that if there's at least one unaligned access it evaluates the costs of aligning that access vs. aligning the other accesses and the bug makes it appear that aligning a single access is cheaper than aligning multiple accesses (even if those are already aligned and thus would require no peeling at all).=