#11679 - poslundc - Wed Oct 15, 2003 7:44 pm
When loading two sequential halfwords, the temptation is to instead of using two ldrh commands, to use a single ldr command and then split the contents of the loaded register. (In fact, sometimes this is the only choice as ldr has a much more versatile addressing mode than ldrh does.)
My question is whether this is worthwhile, and what the fastest way to do it is. My current strategy is pretty straightforward and uninventive:
But I'd imagine this could be improved upon. Any suggestions?
Dan.
My question is whether this is worthwhile, and what the fastest way to do it is. My current strategy is pretty straightforward and uninventive:
Code: |
ldr r1, [r0] @ r1 <- combined word mov r2, r1, asr #16 @ r2 <- second halfword mov r1, r1, lsl #16 @ shift off upper 16 bits mov r1, r1, asr #16 @ r1 <- first halfword |
But I'd imagine this could be improved upon. Any suggestions?
Dan.