You are on page 1of 1

Data processing instructions

The ARM architecture provides a range of addition, subtraction, and bit-wise


logical operations that take two 32-bit operands and return a 32-bit result that can
be independently specified in the 3-address instruction format. The first operand
and the result should be stored in registers, while the second operand can be
either register or immediate. In the former case, the second operand can be
shifted or rotated before being sent to the ALU. Due to the limited space available
for operand specification inside the 32-bit instruction, an immediate operand
should be a 32-bit binary number where all the binary ones fall within a group of
eight adjacent bit positions on a 2-bit boundary.
ARM also supports several multiply and multiply-accumulate instructions that take
two 32-bit register operands and return a 32- or 64-bit result. Finally, ARM
supports binary comparison operations that do not return any values but only
modify condition flags in the CPSR register.
One interesting feature of the ARM architecture is that modification of condition
flags by arithmetic instructions is optional, which means that flags do not
necessarily have to be read right after the instruction that set them, but it can be
done later in the instruction stream provided that other intermediate instructions
do not change the flags.

Data transfer instructions


ARM supports two types of data transfer instructions: single-register transfers and
multiple-register transfers. Single-register transfer instructions provide a flexible
way to move 1, 2, or 4-byte blocks between registers and memory, while multipleregister transfer instructions provide an efficient but less flexible way to move
larger amounts of data. The main addressing mode is base-plus-offset addressing.
Value in the base register is added to the offset stored in a register or passed as
an immediate value to form the memory address for load or store.
As was mentioned above, in the original ARM pipeline loads and stores took two
cycles to execute. Therefore, auto-indexed addressing was introduced to keep the
pipeline busy while the processor is reading or writing memory. An auto-indexed
addressing mode writes the value of the base register incremented by the offset
back to the base register, so it is possible to access the value in the next memory
location in the following instruction, without wasting an additional instruction to
increment the register. Two auto-indexed addressing modes are supported: the
pre-indexed mode uses the computed address for the load or store operation, and
then updates the base register to the computed value, while the post-indexed
mode uses the unmodified base register for the transfer, and then updates the
base register to the computed address.
Multiple-register transfer instructions allow to load or store any subset of the
sixteen general-purpose registers from/to sequential memory addresses. Autoindexed addressing modes are also supported for multiple-register transfers.

Control flow instructions


In addition to usual conditional and unconditional branch instructions, the ARM
architecture provides support for conditional execution of arbitrary instructions:
any instruction can be predicated using values of CPSR condition flags. ARM
supports efficient procedure invocations using a branch-and-link instruction that
saves the address of the instruction following the branch to R14.

You might also like