11.5 Syntax of Operand2 as a register with optional shift

When you use an Operand2 register in an instruction, you can optionally also specify a shift value.

Syntax

Rm {, shift}

where:

Rm

is the register holding the data for the second operand.

shift

is an optional constant or register-controlled shift to be applied to Rm. It can be one of:

ASR #n

arithmetic shift right n bits, 1 ≤ n ≤ 32.

LSL #n

logical shift left n bits, 1 ≤ n ≤ 31.

LSR #n

logical shift right n bits, 1 ≤ n ≤ 32.

ROR #n

rotate right n bits, 1 ≤ n ≤ 31.

RRX

rotate right one bit, with extend.

type Rs

register-controlled shift is available in ARM code only, where:

type

is one of ASR, LSL, LSR, ROR.

Rs

is a register supplying the shift amount, and only the least significant byte is used.

-

if omitted, no shift occurs, equivalent to LSL #0.

Usage

If you omit the shift, or specify LSL #0, the instruction uses the value in Rm.

If you specify a shift, the shift is applied to the value in Rm, and the resulting 32-bit value is used by the instruction. However, the contents of the register Rm remain unchanged. Specifying a register with shift also updates the carry flag when used with certain instructions.

Non-ConfidentialPDF file icon PDF versionARM DUI0473M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.