From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 99E86396D826; Fri, 8 May 2020 07:36:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99E86396D826 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1588923391; bh=9uu5FK355jm0Q9XZYeAu1/ntfzeehQfsESUYIeHsMbU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GnZxl5rLYXjN64n/Nkja7ae43VZOwMbtt+4M88Uz0a3reoKyzpB4Qm0bJjfHJ8G+u 5ToTbtCkCZUEf5dFfS7N9Ws1EsbJ31xihYaz+pLttnRbd3112DqhrJelqVNp5f8sCy UvRj9kATfDZiUW5EzulKMIEplBY9ExZ8CBYJTemw= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/94783] Abs-equivalent pattern is not recognized as abs Date: Fri, 08 May 2020 07:36:31 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 10.0 X-Bugzilla-Keywords: easyhack, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub 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: Fri, 08 May 2020 07:36:31 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94783 --- Comment #4 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:a0d732eea2e152fc51f7c5249abaa9ef56fc5121 commit r11-195-ga0d732eea2e152fc51f7c5249abaa9ef56fc5121 Author: Jakub Jelinek Date: Fri May 8 09:35:41 2020 +0200 match.pd: Canonicalize (X + (X >> (prec - 1))) ^ (X >> (prec - 1)) to a= bs (X) [PR94783] The following patch canonicalizes M =3D X >> (prec - 1); (X + M) ^ M for signed integral types into ABS_EXPR (X). For X =3D=3D min it is al= ready UB because M is -1 and min + -1 is UB, so we can use ABS_EXPR rather th= an say ABSU_EXPR + cast. The backend might then emit the abs code back using the shift and addit= ion and xor if it is the best sequence for the target, but could do somethi= ng different that is better. 2020-05-08 Jakub Jelinek PR tree-optimization/94783 * match.pd ((X + (X >> (prec - 1))) ^ (X >> (prec - 1)) to abs (X)): New simplification. * gcc.dg/tree-ssa/pr94783.c: New test.=