112
11100B–ATARM–31-Jul-12
SAM4S Series [Preliminary]
11.6.5.3
ASR, LSL, LSR, ROR, and RRX
Arithmetic Shift Right, Logical Shift Left, Logical Shift Right, Rotate Right, and Rotate Right with
Extend.
Syntax
op{S}{cond} Rd, Rm, Rs
op{S}{cond} Rd, Rm, #n
RRX{S}{cond} Rd, Rm
where:
MOVS Rd, Rm
is the preferred syntax for
LSLS Rd, Rm, #0
.
Operation
ASR
,
LSL
,
LSR
, and
ROR
move the bits in the register
Rm
to the left or right by the number of places
specified by constant
n
or register
Rs
.
RRX
moves the bits in register
Rm
to the right by 1.
In all these instructions, the result is written to
Rd
, but the value in register
Rm
remains
unchanged. For details on what result is generated by the different instructions, see
Restrictions
Do not use SP and do not use PC.
Condition Flags
If
S
is specified:
• these instructions update the N and Z flags according to the result
• the C flag is updated to the last bit shifted out, except when the shift length is 0, see
op
is one of:
ASR
Arithmetic Shift Right.
LSL
Logical Shift Left.
LSR
Logical Shift Right.
ROR
Rotate Right.
S
is an optional suffix. If
S
is specified, the condition code flags are updated on the result
of the operation, see
Rd
is the destination register.
Rm
is the register holding the value to be shifted.
Rs
is the register holding the shift length to apply to the value in
Rm
. Only the least
significant byte is used and can be in the range 0 to 255.
n
is the shift length. The range of shift length depends on the instruction:
ASR
shift length from 1 to 32
LSL
shift length from 0 to 31
LSR
shift length from 1 to 32
ROR
shift length from 1 to 31.
Summary of Contents for SAM4S Series
Page 44: ...44 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 412: ...412 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1105: ...1105 11100B ATARM 31 Jul 12 SAM4S Series Preliminary ...
Page 1143: ...1143 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 4 64 lead LQFP Package Drawing ...
Page 1145: ...1145 11100B ATARM 31 Jul 12 SAM4S Series Preliminary Figure 43 5 64 lead QFN Package Drawing ...