From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 60C103858038; Wed, 30 Dec 2020 18:23:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 60C103858038 From: "rsandifo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/98302] [11 Regression] Wrong code on aarch64 Date: Wed, 30 Dec 2020 18:23:33 +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: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rsandifo at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rsandifo at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_status assigned_to 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, 30 Dec 2020 18:23:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98302 rsandifo at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|unassigned at gcc dot gnu.org |rsandifo at gcc dot= gnu.org --- Comment #12 from rsandifo at gcc dot gnu.org --- This is caused by the overwidening pattern recognisers. They correctly realise that in: unsigned long long x =3D ...; char y =3D x << 37; only the low 8 bits of x << 37 are needed. But they then take it too far and try to do an 8-bit shift by 37, which is undefined in gimple. The optimal fix would be to get the vectoriser to replace the shift result with zero instead, but that's a bit awkward to do and should really happen before vectorisation. The simplest fix is to make sure that we don't narrow further than the shift amount allows. Testing a patch.=