Thumb Instruction Reference
ARM DUI 0068B Copyright © 2000, 2001 ARM Limited. All r ights reserved. 5-25
Register-controlled shift
These instructions take the value from
Rd
, apply the shift to it, and place the result back
into
Rd
.
Only the least significa nt byte of
Rs
is used for the shift value.
For all these instructions exc ept
ROR
:
if the shift is 32,
Rd
is cleared, and the last bit shifted out remains in the C flag
if the shift is greater tha n 32,
Rd
and the C flag are cleared.
Immediate shift
These instructions take the value from
Rm
, apply the shift to it, and place the result into
Rd
.
Condition flags
These instructions upd ate the N and Z fl ags according to the result. The V flag is not
affected.
The C flag:
is unaffected if the shift value is zero
otherwise, contains the last bit shifted out of the source register.
Architectures
These instructions are available in all T variants of the ARM architecture.
Examples
ASR r3,r5
LSR r0,r2,#6
LSR r5,r5,av ; av must evaluate, at assembly time, to an
; integer in the range 1-32.
LSL r0,r4,#0 ; same as MOV r0,r4 except that C and V
; flags are not affected
Incorrect examples
ROR r2,r7,#3 ; ROR cannot use immediate shift value
LSL r9,r1 ; high registers not allowed
LSL r0,r7,#32 ; immediate shift out of range
ASR r0,r7,#0 ; immediate shift out of range