Incorrect translation of LDR pseudo instruction
I've discovered that the LDR pseudo instruction doesn't work as expected. My understanding is that the instruction:
LDR R0,=constant // where "constant" is a number
Should be replaced by one of the following, depending on the value of the constant:
MOVW R0,constant // may also be written MOV.W R0,constant
LDR R0,memref // where the constant has been stored separately in memory
None of these translations should modify the flags. Yet, for small positive constants as in:
It gets translated into:
which modifies the flags.
In the ARM documentation at http://
"The LDR pseudo-instruction never generates a 16-bit flag-setting MOV instruction. "
Can you help with this problem?
Provide an answer of your own, or ask Dan Lewis for more information if necessary.