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/58622] New: With -fomit-frame-pointer, A64 does not generate post-decrement stores
Date: Fri, 04 Oct 2013 18:24:00 -0000	[thread overview]
Message-ID: <bug-58622-4@http.gcc.gnu.org/bugzilla/> (raw)

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58622

            Bug ID: 58622
           Summary: With -fomit-frame-pointer, A64 does not generate
                    post-decrement stores
           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: 4.9.0 20130602

In A64, if one compiles a simple program under -O3, one gets code like this:

int bar(int i);
int foo() { return bar(5)+4; }

A64 -O3 assembly:

foo:
        stp     x29, x30, [sp, -16]!
        add     x29, sp, 0
        mov     w0, 5
        bl      bar
        add     w0, w0, 4
        ldp     x29, x30, [sp], 16
        ret

Note the use of update-form loads and stores for the SP.

But if one uses -O3 -fomit-frame-pointer, the following is obtained:

foo:
        sub     sp, sp, #16
        mov     w0, 5
        str     x30, [sp]
        bl      bar
        add     w0, w0, 4
        ldr     x30, [sp]
        add     sp, sp, 16
        ret

The sub and str could be merged into str x30, [sp, #-16]!, and the ldr/add
could be merged into ldr x30, [sp], #16 (if I have my assembly correct), as
they were in the with-frame-pointer case.  On some ARM implementations, the
updates are "for free", so one would get better performance with the merged
load/store instructions, not to mention better instruction-cache density.

Note that under A32, identical code (using update/post-decrement stores) is
generated regardless of omit-frame-pointer settings.


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

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-04 18:24 b.grayson at samsung dot com [this message]
2014-01-28 15:23 ` [Bug target/58622] " rearnsha at gcc dot gnu.org
2014-03-13  3:24 ` kuganv at linaro dot org
2014-03-20 19:18 ` ramana at gcc dot gnu.org
2014-07-24 14:54 ` mshawcroft at gcc dot gnu.org
2014-07-24 14:54 ` mshawcroft 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-58622-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).