Page 1 of 1

ARM optimization question

PostPosted: Feb 23, 2004 @ 8:15pm
by kornalius
I have to little piece of code, where I call an internal C routine and the address is stored into an memory location relative to my pc register.

ldr r11, [pc, #10]
mov lr, pc
mov pc, r11

I am trying to optimize it like this:

mov lr, pc
ldr pc, [pc, #10]

It calls the routine without problems, but doesn't return properly. Can anybody tell me what is wrong with the second code?

Regards,
Kornalius.

** Don't worry about the relative address location [pc, #10], it is a dummy location, it's just to get the idea! :) **

PS: If you can find a way to optimize it even more, please let me know.

PostPosted: Feb 24, 2004 @ 11:48am
by refractor

PostPosted: Feb 24, 2004 @ 4:46pm
by kornalius