> Looking around at the few code snippetts I was able to find, I noticed > the use of instructions like: > > ldr rd,=0x12345678 > > I cannot find any form of this apparant 32 bit immediate adressing > mode in the assembly tables. How does it work? Are there limitations? > You are correct, you can not load a 32 bit immediate constant, regardless of what the code looks like. But, what you can do is load a 32 bit constant from a 'literal pool' using PC relative addressing. So, the compiler generates a block (pool) of constants as it goes along and actually generates a PC relative load from the pool. Ordinarily, the compiler would rather calculate the constant in 3 arithmetic operations than use the 'literal pool' so you will see a lot of address calculation just to get to the VIC. I imagine it is possible to specify an optimization that will cause more 'literal pool' operations and less address calculations - perhaps optimize for size. Richard
Message
Re: ldr rd,=value.....how does it work?
2006-05-18 by rtstofer
Attachments
- No local attachments were found for this message.