CW 6.3 ColdFire doesn't use post-increment

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

CW 6.3 ColdFire doesn't use post-increment

2,667件の閲覧回数
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,256件の閲覧回数
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,256件の閲覧回数
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 件の賞賛
返信