Hacker News new | ask | show | jobs
by DanBC 4740 days ago
LDR is a pseudo instruction that uses MOVs to load a register.

(http://www.woodmann.com/fravia/The%20ARM%20Processor.htm)

> The ARM assembler also supports a similar pseudo operation. The construct LDR rd,=value is used to load value into register rd. The LDR pseudo instruction uses the MOV or MOV instructions, or it places the constant in memory and uses program counter relative addressing to load the constant.

(http://sourceware.org/binutils/docs/as/ARM-Opcodes.html)

> If expression evaluates to a numeric constant then a MOV or MVN instruction will be used in place of the LDR instruction, if the constant can be generated by either of these instructions. Otherwise the constant will be placed into the nearest literal pool (if it not already there) and a PC relative LDR instruction will be generated.

1 comments

Thanks! That makes sense, I'm only familiar with the old assembler from BBC Basic :) 0x202 wouldn't be a constant that you could use with MOV now I think about it, since it could only express integers generated with an 8 bit value and a shift.