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