public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "b.grayson at samsung dot com" <gcc-bugzilla@gcc.gnu.org>
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	[thread overview]
Message-ID: <bug-58623-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2013-10-04 19:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-04 19:19 b.grayson at samsung dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-58623-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).