From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8722A3858C5E; Tue, 14 Mar 2023 09:24:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8722A3858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1678785845; bh=jraSADlQ67zL07B4g70pMPWwOu+4f3nGN+7F02UAIBY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TByC8Sy9uqcZdZ6+Rdta4VSyXpQlSNkz/yXjMQp+AbSB/FdjRIkX0k3G7Bqk6WKi4 v8gEY2Ek7O8t+l/SMjL8BmQwVH3jSaIn1y7NStVXQ4lyVOhD59N1YGQWQWpeRPBJUc 3wfE3Quxxsm/Xny9yV/8HlVqs4njG2cUlK6G1Lhg= From: "crazylht at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/109011] missed optimization in presence of __builtin_ctz Date: Tue, 14 Mar 2023 09:24:04 +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.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: crazylht at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109011 --- Comment #18 from Hongtao.liu --- (In reply to Jakub Jelinek from comment #16) > Created attachment 54590 [details] > gcc13-pr109011-2.patch >=20 > Here is what I have right now, totally untested and will need further work > so that the two pattern recognizers work together nicely (I think the one > modified by the earlier patch will for ctz/ffs need to trigger first and > allow > ctz/ffs and be done even if for these they don't have direct optab but ha= ve > ctz (for ffs), clz or popcount. And then let the new one rewrite it. For ffs/ctz generated by vect_recog_popcount_clz_ctz_ffs_pattern, we can ca= ll vect_recog_ctz_ffs_pattern again with a little adjustment so that call_stmt doesn't come from stmt_vinfo->stmt but from parameter.=