From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5A2083846456; Wed, 26 Jun 2024 07:10:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5A2083846456 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1719385855; bh=9FjijCzNHtK2toZK/3/7mASrX9cC01YvhKBuC7WHkZc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=udxFZIdgzzTKmrgyFLMGuukAQZxojX52h0su/PADW5TFDoIv/1xEZiqgIhRAn7pqK LbzdfjHCuYYfzlPrFD3bL35bVO3dqub6zZUqhh6FR4CjBxw1EaF+hFTj+WFEPWawK/ kUCX8o8sfEkhyv/w+zwoF2nGuj8n/cSxIqFRcQ7I= From: "user202729 at protonmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/115576] [14/15 regression] Worse code generated for simple struct conversion since r14-2386-gbdf2737cda53a8 Date: Wed, 26 Jun 2024 07:10:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 14.1.1 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: user202729 at protonmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.2 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=3D115576 --- Comment #5 from user202729 --- I think this can be resolved by implementing some code in combine.cc to replace: (set:TI (reg:TI 101) (zero_extend:TI (...:DI ...))) (set:DI (reg:DI ...) (subreg:DI (reg:TI 101) 8)) with (set:TI (reg:TI 101) (zero_extend:TI (...:DI ...))) (set:DI (reg:DI ...) (const_int 0)) This certainly is always an improvement, because 0 is simpler than extracti= ng the subregister. After that, a few other passes of combine rescanning should be able to cons= tant fold the 0 forward. Unfortunately, I don't know how to modify combine.cc or some other files to handle this pattern. Can anyone give a suggestion? (maybe add a define_peephole2 in common.md ? )=