CW 6.3 ColdFire doesn't use post-increment

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

CW 6.3 ColdFire doesn't use post-increment

2,769 次查看
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.
标签 (1)
标记 (1)
0 项奖励
回复
2 回复数

1,358 次查看
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 项奖励
回复

1,358 次查看
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 项奖励
回复