From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7A2CE398304E; Tue, 27 Jul 2021 12:35:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7A2CE398304E From: "segher at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/78103] Failure to optimize with __builtin_clzl Date: Tue, 27 Jul 2021 12:35:39 +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: 6.2.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: segher 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: 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: Tue, 27 Jul 2021 12:35:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D78103 --- Comment #17 from Segher Boessenkool --- (In reply to Jakub Jelinek from comment #16) > Created attachment 51209 [details] > gcc12-pr78103.patch >=20 > Updated patch. This one fixes the reuse of a pseudo you've mentioned abo= ve, > and fixes gcc.target/i386/pr101175.c regression the patch reintroduced by > adding !TARGET_LZCNT conditions to the two new define_insns. Great :-) > Nothing changes for combine though, I think it really would be nice if it > could either change newly added pseudos from combine_split_insns by i2dest > if possible, Is that ever safe to do? > or better handle new pseudos from both combine_split_insns and > when > for find_split_point i2dest can't be resued with creating LOG_LINKS. You cannot safely attempt to combine the two insns split to again, neither alone nor in combination with other insns. Since pretty much by definition that new reg will be set in the new i2 and used in (only) in the new i3, no combination with that new reg is valid ever? > I guess I can work around this by using define_insn_and_split instead of a > combiner splitter, but combine splitters are cleaner... Sometimes it helps to pretend you have an instruction you do not. Both pure splitters and define_insn_and_split have their place :-)=