From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E8BFF3858D32; Sat, 3 Jun 2023 16:09:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E8BFF3858D32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1685808541; bh=MCBx05nK+fcOefsRfIEPbGny2LrYHXODHn27aOBA7js=; h=From:To:Subject:Date:In-Reply-To:References:From; b=r5xGowkKRHwjotwdguxh5zwcw2pmqmWn7nv/yK+XL6GIVzgUxZfST/g7M+1tKt4MW W+hF4tTsswlIK29jT0zQUUsIeBE2gFoG9pI3qFYKXQyG6nl1C9oZ575bq6JdmTTuKe L2uFqXxi5GCk1hVg2eaHsOrSUCdR8HPTzJnuxpuM= From: "olegendo at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54089] [SH] Refactor shift patterns Date: Sat, 03 Jun 2023 16:09:01 +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: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: olegendo at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: olegendo 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=3D54089 --- Comment #57 from Oleg Endo --- (In reply to Alexander Klepikov from comment #56) >=20 > > In that test you can see the unnecessary push/pop of PR. This is becau= se > > initially it wanted to expand as a library call, but then your patterns > > decided to change the insns. This can or can't be avoided, depending on= the > > case. >=20 > That's an valuable observation, thank you! I found why. Sometimes 'collap= sed > libcall' instruction is emitted in combine pass and 'clobber PR' is set > then. I commented this out and checked that file and it seems to be OK. I > will rerun testsuite again to be sure. Another thing ... the reason why it's desirable to expand into the libcall earlier is to allow hoisting the function call address outside of loops and things like that. That happens only once at the RTL level during compilati= on and that's before the combine pass. Since there are no loops around optimization passes in the compiler, it's always going to be a compromise. = But it might be OK to repeat a particular optimization pass only for SH, if it helps anything. >=20 > Now regarding tests that fail on vanilla GCC and pass with patch. It looks > like something was changed in the middle of GCC and it started to produce > other instruction patterns that cannot be catched by existing isns and th= us > expanded to library calls. The patch simply fixed it. Yes, that happens every now and then, as folks work on target independent optimizations in the middle-end. SH backend hasn't been keeping up for a w= hile in this regard.=