From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5253 invoked by alias); 4 Oct 2013 19:19:16 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 5224 invoked by uid 48); 4 Oct 2013 19:19:13 -0000 From: "b.grayson at samsung dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/58623] New: lack of ldp/stp optimization Date: Fri, 04 Oct 2013 19:19:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: b.grayson at samsung dot com X-Bugzilla-Status: UNCONFIRMED 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_id short_desc product version bug_status bug_severity priority component assigned_to reporter cf_gcctarget cf_gccbuild Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg00241.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58623 Bug ID: 58623 Summary: lack of ldp/stp optimization Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: b.grayson at samsung dot com Target: AArch64 Build: 20130602 The following C code: long long a, b; int c, d; int foo() { return a+b; } int bar() { return c+d; } generates this assembly code under -O3 -fsection-anchors -fno-common: foo: adrp x1, .LANCHOR0 add x1, x1, :lo12:.LANCHOR0 ldr x2, [x1] ldr x0, [x1,8] add w0, w2, w0 ret bar: adrp x1, .LANCHOR0 add x1, x1, :lo12:.LANCHOR0 ldr w2, [x1,16] ldr w0, [x1,20] add w0, w2, w0 ret Note that the ldr x2 and ldr x0 could have been merged into an ldp, in foo(). Similarly, the ldr w2 and ldr w0 (32-bit loads) could have been merged into an ldp in bar(). The same optimization applies to stores as well. I am not sure if this would be handled by the proposed (but apparently not accepted) patch from March 2013: http://gcc.gnu.org/ml/gcc-patches/2013-03/msg01051.html