public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "abnikant dot singh at atmel dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/34737] Scheduling of post-modified function arguments is not good
Date: Mon, 13 Sep 2010 11:38:00 -0000	[thread overview]
Message-ID: <20100913113816.2297.qmail@sourceware.org> (raw)
In-Reply-To: <bug-34737-14966@http.gcc.gnu.org/bugzilla/>



------- Comment #6 from abnikant dot singh at atmel dot com  2010-09-13 11:38 -------
we get better code in the head. Both the cases [test1 and test2] produce the
same piece of code:
i.e for the following test case:

void foo(char *p);

void test1(char * p)
{
    foo(p++);
    foo(p++);
    foo(p++);
    foo(p++);
}

void test2(char * p)
{
    foo(p); p++;
    foo(p); p++;
    foo(p); p++;
    foo(p); p++;
}

we get:
test1:
        push r28
        push r29
/* prologue: function */
/* frame size = 0 */
/* stack size = 2 */
.L__stack_usage = 2
        mov r28,r24
        mov r29,r25
        rcall foo
        mov r24,r28
        mov r25,r29
        adiw r24,1
        rcall foo
        mov r24,r28
        mov r25,r29
        adiw r24,2
        rcall foo
        mov r24,r28
        mov r25,r29
        adiw r24,3
        rcall foo
/* epilogue start */
        pop r29
        pop r28
        ret
        .size   test1, .-test1
.global test2
        .type   test2, @function
test2:
        push r28
        push r29
/* prologue: function */
/* frame size = 0 */
/* stack size = 2 */
.L__stack_usage = 2
        mov r28,r24
        mov r29,r25
        rcall foo
        mov r24,r28
        mov r25,r29
        adiw r24,1
        rcall foo
        mov r24,r28
        mov r25,r29
        adiw r24,2
        rcall foo
        mov r24,r28
        mov r25,r29
        adiw r24,3
        rcall foo
/* epilogue start */
        pop r29
        pop r28
        ret
        .size   test2, .-test2


-- 

abnikant dot singh at atmel dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abnikant dot singh at atmel
                   |                            |dot com


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


      parent reply	other threads:[~2010-09-13 11:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-11  8:58 [Bug c/34737] New: missed optimization, foo(p); p++ is better then foo(p++) wvangulik at xs4all dot nl
2008-01-11  8:59 ` [Bug c/34737] " wvangulik at xs4all dot nl
2008-01-11 10:19 ` [Bug tree-optimization/34737] Inefficient gimplification of post-modified function arguments, TER doesn't do its work rguenth at gcc dot gnu dot org
2008-01-11 11:48 ` [Bug tree-optimization/34737] Scheduling of post-modified function arguments is not good pinskia at gcc dot gnu dot org
2009-06-24  7:42 ` steven at gcc dot gnu dot org
2009-06-24  9:08 ` rguenther at suse dot de
2010-09-13 11:38 ` abnikant dot singh at atmel dot com [this message]

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=20100913113816.2297.qmail@sourceware.org \
    --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).