public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/58623] New: lack of ldp/stp optimization
@ 2013-10-04 19:19 b.grayson at samsung dot com
  2013-10-28  0:28 ` [Bug target/58623] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: b.grayson at samsung dot com @ 2013-10-04 19:19 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-12-18  3:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-04 19:19 [Bug target/58623] New: lack of ldp/stp optimization b.grayson at samsung dot com
2013-10-28  0:28 ` [Bug target/58623] " pinskia at gcc dot gnu.org
2014-07-24 11:05 ` ramana at gcc dot gnu.org
2014-11-19  2:00 ` amker.cheng at gmail dot com
2014-12-11 12:10 ` ramana at gcc dot gnu.org
2014-12-12  3:32 ` amker at gcc dot gnu.org
2014-12-15 21:35 ` e.menezes at samsung dot com
2014-12-18  3:02 ` amker at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).