Reputation: 43
Say I have the following hex values stored in registers;
r1 = #0x1
r2 = #0x2
r3 = #0x3
r4 = #0xA
And I want to store #0x123A in r0.
Is there a way of shifting byte values similar to shifting bits with LSL/LSR so that I could AND each register (r1-r4) with a mask and then shift the bytes into correct position in r0?
Upvotes: 0
Views: 764
Reputation: 126203
ARM shifts are done as part of the second operand in other operations. So you would do something like:
OR r0, r4, r3, LSL #4
OR r0, r0, r2, LSL #8
OR r0, r0, r1, LSL #12
though this does not do the 'mask' part if the other bits of your source registers are non-zero.
Upvotes: 2