From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 69BB83858403; Mon, 15 Nov 2021 09:14:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 69BB83858403 From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/103228] [9/10/11/12 Regression] missed optimization with |^ at the gimple level Date: Mon, 15 Nov 2021 09:14:52 +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, TREE X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 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: Mon, 15 Nov 2021 09:14:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D103228 --- Comment #4 from Andrew Pinski --- (In reply to Richard Biener from comment #3) > Possibly some STRIP_NOPS gone "missing" during fold-const.c -> match.pd m= ove > of some patterns. Well match.pd has: /* Try to fold (type) X op CST -> (type) (X op ((type-x) CST)) when profitable. For bitwise binary operations apply operand conversions to the binary operation result instead of to the operands. This allows to combine successive conversions and bitwise binary operations. We combine the above two cases by using a conditional convert. */ Just the check for precision was < and not <=3D : && (/* That's a good idea if the conversion widens the operand, thus after hoisting the conversion the operation will be narrower.= */ TYPE_PRECISION (TREE_TYPE (@0)) < TYPE_PRECISION (type) I am going to test changing < to <=3D. Note the atomic changed (PR 103194) might have some conflict with this.=