From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 3F7FC3858022; Fri, 23 Sep 2022 06:11:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3F7FC3858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663913480; bh=j4MTji5fDckCvoNEFAH/AhY9Q4pGEbKnuS+rLS9+Sfs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GzkHcGpR2fBRH51VfFoKpiHFhiiNKny/Yy9OSwHO2IpuG/HUZpouIp1XzCbadSQJU cDggCkgkfsgU07Ye/91gDRsXFnPbKGCIXHnNa7aQkiJEZg/k3JZ4UzhFban5Xy601X BA49YdBA6gdaYH8MHvmwzrzW+hJFNisyay2qvqOs= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/107006] Missing optimization: common idiom for external data Date: Fri, 23 Sep 2022 06:11:16 +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: rguenth 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D107006 --- Comment #12 from Richard Biener --- (In reply to H. Peter Anvin from comment #11) > If you look at the output, you see that the loops are already fully unrol= led > (at considerable code size cost.) The unrolling is done too late for the bswap detection pass to trigger. > Unfortunately, since the issue at hand is dealing with code written to be > portable, adding gcc-specific hacks are not really a reasonable option. Well, #pragma GCC unroll n is "portable" in that #pragma is an ISO C feature and pragmas in the 'GCC' domain are supposed to be ignored by other compile= rs, so not sure what you are wanting to say here. You can also manually unroll of course. Alternatively somebody can try to implement loop pattern matching for bswap/load. It's a reduction so blueprints might be available by the strlen pattern matching in loop_distribution::transform_reduction_loop.=