I am looking to optimize sequential reads from a buffer and writes to GPIO registers: GPIO_A_DR = buf[0]; GPIO_B_DR = buf[1]; GPIO_A_DR = buf[2]; etc. The assembly looks like this: move.l #0x1ffe62,R0 move.w X: 0x000000,A move.w A1, X: (R0) move.l #0x1ffe6e,R0 move.w X: 0x000000,A move.w A1, X: (R0) move.l #0x1ffe62,R0 move.w X: 0x000000,A move.w A1, X: (R0) etc. It is suprising to me that the compiler cannot figure out to store the second register address to, say, R1. But my main question is how the instruction: move.w X: 0x000000,A is working. In fact, just a simple 'x = y' expression yields: move.w X:0x000000,X:0x000000 how can that possibly be right if the immediate addresses are the same? Something big is missing here. |
|
Codewarrior Compiler for 56858
Started by ●June 4, 2004
Reply by ●June 4, 20042004-06-04
If you use pointer instead of array, you will get much compact assembly code. Charlie --- actom_ng <> wrote: > I am looking to optimize sequential reads from a > buffer and writes > to GPIO registers: > > GPIO_A_DR = buf[0]; > GPIO_B_DR = buf[1]; > GPIO_A_DR = buf[2]; > > etc. > > The assembly looks like this: > > move.l #0x1ffe62,R0 > move.w X: 0x000000,A > move.w A1, X: (R0) > > move.l #0x1ffe6e,R0 > move.w X: 0x000000,A > move.w A1, X: (R0) > > move.l #0x1ffe62,R0 > move.w X: 0x000000,A > move.w A1, X: (R0) > > etc. > > It is suprising to me that the compiler cannot > figure out to store > the second register address to, say, R1. But my > main question is > how the instruction: > > move.w X: 0x000000,A > > is working. In fact, just a simple 'x = y' > expression yields: > > move.w X:0x000000,X:0x000000 > > how can that possibly be right if the immediate > addresses are the > same? Something big is missing here. > > __________________________________ |
Reply by ●June 5, 20042004-06-05
>In fact, just a simple 'x = y' > expression yields: > > move.w X:0x000000,X:0x000000 > > how can that possibly be right if the immediate > addresses are the > same? Something big is missing here. > You probably generated the expression move.w X:0x000000,X:0x000000 by the 'disassembly' command, right? At this stage the compiler does not have the information on where variables will be placed. That's the reason for having them referred as x:000000. It's the linker that will place variables to their correct address in memory. Best regards, Fabio Estevam --- actom_ng <> wrote: > I am looking to optimize sequential reads from a > buffer and writes > to GPIO registers: > > GPIO_A_DR = buf[0]; > GPIO_B_DR = buf[1]; > GPIO_A_DR = buf[2]; > > etc. > > The assembly looks like this: > > move.l #0x1ffe62,R0 > move.w X: 0x000000,A > move.w A1, X: (R0) > > move.l #0x1ffe6e,R0 > move.w X: 0x000000,A > move.w A1, X: (R0) > > move.l #0x1ffe62,R0 > move.w X: 0x000000,A > move.w A1, X: (R0) > > etc. > > It is suprising to me that the compiler cannot > figure out to store > the second register address to, say, R1. But my > main question is > how the instruction: > > move.w X: 0x000000,A > > is working. In fact, just a simple 'x = y' > expression yields: > > move.w X:0x000000,X:0x000000 > > how can that possibly be right if the immediate > addresses are the > same? Something big is missing here. > > __________________________________ _____________________________________ Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer. You need to do a "reply all" if you want your answer to be distributed to the entire group. _____________________________________ About this discussion group: To Join: To Post: To Leave: Archives: http://www.yahoogroups.com/group/motoroladsp More Groups: http://www.dsprelated.com/groups.php3 Yahoo! Groups Links |