bdmlpc wrote: >--- In lpc2000@yahoogroups.com, "rtstofer" <rstofer@p...> wrote: > > >>The thing I don't understand is the address calculation. I am >>using -O0 so I understand it won't do much optimizing but, to me, >>the 3 instructions used to load a register with a constant value >>seems excessive. It gets a little better with -O3 but still, the >>address is a constant, why calculate it? >> >> > >ARM instructions can only take 12bit of immediate operands with a bit >displacement. So it is not possible to load a full 32bit immediate >value into a core register directly, except that the value can >separated into a single 12bit value and a shift value. If you turn on >optimization GCC may use a trick to minimize cycles. Immediate values >are stored in memory in a location near (< 2^12) to this instruction. >Now GCC can load this "immediate" value out of memory relativ to its >program counter in one cycle for example. > > LDR R0, [PC, #+15] > > > Exactly, ARM instructions _always_ are 32bits long. That includes the operation code and operands. An X86 or 68K processor uses variable lenght instructions. Having said that, I will say that reading ARM assembler makes my head ache. It may be a simpler set of instructions but it is very rich in addressing modes. What will drive me crazy is attempting to debug fully opimized code: -Os >>Now, since the compiler writers are very bright folks and I am just >>a user who has never read the standard (how come I have to pay for >>it?), I assume they do this calculation for a reason. Does anyone >>know why? >> >> > >Compiler guys are totaly crazy! ;-) > > You can download all the information about ARM from their website: arm.com. However, you will pay for printed material (book form vs. PDF). Actually, do you really want to know? heh. TomW -- Tom Walsh - WN3L - Embedded Systems Consultant http://openhardware.net, http://cyberiansoftware.com "Windows? No thanks, I have work to do..." ----------------------------------------------------
Message
Re: [lpc2000] Re: Looking to buy compiler
2005-11-08 by Tom Walsh
Attachments
- No local attachments were found for this message.