From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 582983858012; Mon, 11 Dec 2023 15:56:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 582983858012 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702310204; bh=Fcpo/rAia3vsgh/IDuKm/mfBCzRPyTZBRqSt2eULEas=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uFBjNWzuMhw7plvOX8lrbxXnrp7blgf79cs/Ycz9zpqYEHcTewBONUHh1FHPUNR6e duiwOT636w0113c3hI3MZwXVYYpN3kRlNDZr7wLMnMaEfwJ76eoSKMdkry8PJWnRGN /l1yXvkQptAfFukqZY++5FW33PFbbZCp0Lt8b2/U= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111972] [14 regression] missed vectorzation for bool a = j != 1; j = (long int)a; Date: Mon, 11 Dec 2023 15:56:42 +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: 14.0 X-Bugzilla-Keywords: missed-optimization, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111972 --- Comment #18 from GCC Commits --- The trunk branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:85c5efcffed19ca6160eeecc2d4faebd9fee63aa commit r14-6420-g85c5efcffed19ca6160eeecc2d4faebd9fee63aa Author: Andrew Pinski Date: Sat Nov 11 15:54:10 2023 -0800 MATCH: (convert)(zero_one !=3D/=3D=3D 0/1) for outer type and zero_one = type are the same When I moved two_value to match.pd, I removed the check for the {0,+-1} as I had placed it after the {0,+-1} case for cond in match.pd. In the case of {0,+-1} and non boolean, before we would optmize those case to just `(convert)a` but after we would get `(convert)(a !=3D 0)` which was not handled anyways to just `(convert)a`. So this adds a pattern to match `(convert)(zeroone !=3D 0)` and simplify to `(convert)zeroone`. Also this optimizes (convert)(zeroone =3D=3D 0) into (zeroone^1) if the type match. Removing the opposite transformation from fold. The opposite transformation was added with https://gcc.gnu.org/pipermail/gcc-patches/2006-February/190514.html It is no longer considered the canonicalization either, even VRP will transform it back into `(~a) & 1` so removing it is a good idea. Note the testcase pr69270.c needed a slight update due to not matching exactly a scan pattern, this update makes it more robust and will match before and afterwards and if there are other changes in this area too. Note the testcase gcc.target/i386/pr110790-2.c needs a slight update for better code generation in LP64 bit mode. Bootstrapped and tested on x86_64-linux-gnu with no regressions. gcc/ChangeLog: PR tree-optimization/111972 PR tree-optimization/110637 * match.pd (`(convert)(zeroone !=3D/=3D=3D CST)`): Match and simplify to ((convert)zeroone){,^1}. * fold-const.cc (fold_binary_loc): Remove transformation of `(~a) & 1` and `(a ^ 1) & 1` into `(convert)(a =3D=3D 0)`. gcc/testsuite/ChangeLog: * gcc.dg/tree-ssa/pr110637-1.c: New test. * gcc.dg/tree-ssa/pr110637-2.c: New test. * gcc.dg/tree-ssa/pr110637-3.c: New test. * gcc.dg/tree-ssa/pr111972-1.c: New test. * gcc.dg/tree-ssa/pr69270.c: Update testcase. * gcc.target/i386/pr110790-2.c: Update testcase. * gcc.dg/fold-even-1.c: Removed. Signed-off-by: Andrew Pinski =