This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/34737] Scheduling of post-modified function arguments is not good



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]