From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id F2BC639ACC28; Fri, 16 Jul 2021 22:51:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F2BC639ACC28 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/101226] Suboptimal codegen for >>/>>> Date: Fri, 16 Jul 2021 22:51:19 +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: 11.1.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW 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: bug_severity component bug_status everconfirmed cf_reconfirmed_on keywords cc 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: Fri, 16 Jul 2021 22:51:20 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101226 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|normal |enhancement Component|d |tree-optimization Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Last reconfirmed| |2021-07-16 Keywords| |missed-optimization CC| |pinskia at gcc dot gnu.org Assignee|ibuclaw at gdcproject dot org |unassigned at gcc d= ot gnu.org --- Comment #1 from Andrew Pinski --- _2 =3D (uint) value.1_1; _3 =3D _2 >> 5; _4 =3D (ubyte) _3; Right this could be optimized at the tree level to be : _4 =3D value.1_1 >> 5; Something like this for match.pd (note this is not fully correct just close enough for someone else to start): (simplify (convert (shift (convert@0 @1) INTEGER_CST@2)) (if (type =3D=3D TREE_TYPE (@0) && TYPE_SIGN (TREE_TYPE(@0) =3D=3D TYPE_SI= GN (type)) (if (@2 >=3D bitsintype(type)) ({build_zero_cst (type);}) (shift @1 @2))))=