From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6BF283858C62; Thu, 8 Jun 2023 12:07:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6BF283858C62 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686226022; bh=+4BT/D2YPGa9Iwvam4uRAR8LAKdO9p57MxwEtA/7bMQ=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mKkA3Gu6oHE/DFBuJTG91EA6GRQ+IQn4HeqBwGwGVUVvskH+5SRmOjNChnYTGec7+ y15IrKGZYntXg9yVPwxPiZXDbIIXH/4et5a/I961z3XyFu3gju65mm9IFluvos0kKo kEWqZy8e0lCHj8FR5eKoFbKvITgMXlh+P9Iv8aOE= From: "klepikov.alex+bugs at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/54089] [SH] Refactor shift patterns Date: Thu, 08 Jun 2023 12:07:00 +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: klepikov.alex+bugs at gmail dot com 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 #68 from Alexander Klepikov --- OK, I finished my patch. Let me remind you briefly, what it does. First, it does not emit library call for ashrsi3 during expand pass. Instea= d it emits intermediate 'collapsed' libcall insn which is expanded later at spli= t1 pass. Consecutive right arithmetic shifts can be catched at combine pass and converted to 'collapsed' libcall insn. Then 'collapsed' insn splits whether to short sequnce of individual right shifts or to __ashiftrt_r4_N library call during split1 pass. Finally, loop move invariants only pass executed right after split1 pass to hoist library addresses that potentially were emitted during split pass. I ran GCC testsuite and there were 1 new failed test that actually turned o= ut to be an optimization, and 3 tests that failed on clean GCC and passed on patched. I could not set up my environment to test all little endian exec tests, so for those I don't have results. Also I successfully compiled (but= not linked due to not fully set environment) Linux kenel 6.1. My homemade performance tests (I timed linux kernel build) showed a slowdown of less th= en 3%. To reduce slowdown it would be good to run loop move invariants pass only in functions that have expanded libcall, but to do so it is necessary to mark = such funcnion when emitting insn and I'm not so sure if insn knows about in what function it is located.=