From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AF3493858D33; Tue, 6 Feb 2024 13:14:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AF3493858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1707225270; bh=GDV/nG9JUXp6m1sbP6qnXOdJfy0cysfjjrTFU8LW2gs=; h=From:To:Subject:Date:In-Reply-To:References:From; b=hIWr4xBXocLHLwdG6b1ykrngUbpadYoLQEFf3nMloCYHtZZL5WZDhPUooEMU3oxq5 SsXKsJSE+zyERGrwZRQT4ZdltZRK45SInrb9sx2QJa/7Ry86ZubOgwhquiFrjl29Fm zJvNKHz0FvxfIhPLz4m2znA5QaQRnzftb3N6NxpI= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/113779] Very inefficient m68k code generated for simple copy loop Date: Tue, 06 Feb 2024 13:14:29 +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: 13.2.0 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: bug_status cf_reconfirmed_on everconfirmed 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=3D113779 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2024-02-06 Ever confirmed|0 |1 --- Comment #6 from Richard Biener --- It's already visible with a simple void f(const long* src, long* dst) { *dst++ =3D *src++; *dst =3D *src; } where we expand to RTL from _1 =3D *src_3(D); *dst_4(D) =3D _1; _2 =3D MEM[(const long int *)src_3(D) + 4B]; MEM[(long int *)dst_4(D) + 4B] =3D _2; there's nothing on GIMPLE that would split the add and RTLs auto-inc-dec pass doesn't do anything either. We'd need a form of "strength-reduction" or maybe targets prefering auto-inc/dec should not legitimize constant offsets before reload ... Note with one more copy you then see _1 =3D *src_4(D); *dst_5(D) =3D _1; _2 =3D MEM[(const long int *)src_4(D) + 4B]; MEM[(long int *)dst_5(D) + 4B] =3D _2; _3 =3D MEM[(const long int *)src_4(D) + 8B]; MEM[(long int *)dst_5(D) + 8B] =3D _3; and naiively splitting gives you src_6 =3D src_4(D) + 4; src_7 =3D src_4(D) + 8; that said, it's really sth for RTL since it's going to be highly target dependent which form is more efficient. The auto-inc pass is well structured, so it should be possible to extend it.=