CW 6.3 ColdFire doesn't use post-increment

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

CW 6.3 ColdFire doesn't use post-increment

1,801 Views
bkatt
Contributor IV
If I do a structure assignment, CodeWarrior compiles a compact loop to copy the data using post-increment addressing (I can see it in the disassembly). The equivalent C code looks like:

do { *d++ = *s++; } while (--len);

But if I write this code in C, CW compiles a much bigger and slower loop that does not take advantage of the post-increment addressing mode. Except for structure assignment, I have not seen any use of post-increment by the CW ColdFire compiler.

I remember using a non-optimizing C compiler over 20 years ago, and for architectures with post-increment (and pre-decrement), if you wrote it in the C code you got it in the machine language.

You may say I should use library memcpy, etc. to do these type of things. But FreeScale has given me software for the eval board (52233) which does not use the library.
Labels (1)
0 Kudos
2 Replies

390 Views
Nouchi
Senior Contributor II
Hi,

Have a look to this thread and you will probably get an answer:
http://forums.freescale.com/freescale/board/message?board.id=CWCOMM&message.id=2798&query.id=34435#M...

Emmanuel
0 Kudos

390 Views
bkatt
Contributor IV
Yes, it turns out that you get post-increment machine code if you write:

do { *d = *s; ++d; ++s; } while (--len);
0 Kudos