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:
MOV R0,constant
MOVW R0,constant // may also be written MOV.W R0,constant
MVN 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:
LDR R0,=1
It gets translated into:
MOVS R0,1
which modifies the flags.
In the ARM documentation at http://
"The LDR pseudo-instruction never generates a 16-bit flag-setting MOV instruction. "
Dan
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Dan Lewis for more information if necessary.