05.02.2013 Views

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

ARM Architecture Reference Manual ARMv7-A and ARMv7-R edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The Instruction Sets<br />

A4.4 Data-processing instructions<br />

Core data-processing instructions belong to one of the following groups:<br />

St<strong>and</strong>ard data-processing instructions. These instructions perform basic data-processing operations,<br />

<strong>and</strong> share a common format with some variations.<br />

Shift instructions on page A4-10.<br />

Saturating instructions on page A4-13.<br />

Packing <strong>and</strong> unpacking instructions on page A4-14.<br />

Miscellaneous data-processing instructions on page A4-15.<br />

Parallel addition <strong>and</strong> subtraction instructions on page A4-16.<br />

Divide instructions on page A4-17.<br />

For extension data-processing instructions, see Advanced SIMD data-processing operations on page A4-30<br />

<strong>and</strong> VFP data-processing instructions on page A4-38.<br />

A4.4.1 St<strong>and</strong>ard data-processing instructions<br />

These instructions generally have a destination register Rd, a first oper<strong>and</strong> register Rn, <strong>and</strong> a second<br />

oper<strong>and</strong>. The second oper<strong>and</strong> can be another register Rm, or an immediate constant.<br />

If the second oper<strong>and</strong> is an immediate constant, it can be:<br />

Encoded directly in the instruction.<br />

A modified immediate constant that uses 12 bits of the instruction to encode a range of constants.<br />

Thumb <strong>and</strong> <strong>ARM</strong> instructions have slightly different ranges of modified immediate constants. For<br />

details see Modified immediate constants in Thumb instructions on page A6-17 <strong>and</strong> Modified<br />

immediate constants in <strong>ARM</strong> instructions on page A5-9.<br />

If the second oper<strong>and</strong> is another register, it can optionally be shifted in any of the following ways:<br />

LSL Logical Shift Left by 1-31 bits.<br />

LSR Logical Shift Right by 1-32 bits.<br />

ASR Arithmetic Shift Right by 1-32 bits.<br />

ROR Rotate Right by 1-31 bits.<br />

RRX Rotate Right with Extend. For details see Shift <strong>and</strong> rotate operations on page A2-5.<br />

In Thumb code, the amount to shift by is always a constant encoded in the instruction. In <strong>ARM</strong> code, the<br />

amount to shift by is either a constant encoded in the instruction, or the value of a register Rs.<br />

For instructions other than CMN, CMP, TEQ, <strong>and</strong> TST, the result of the data-processing operation is placed in the<br />

destination register. In the <strong>ARM</strong> instruction set, the destination register can be the PC, causing the result to<br />

be treated as an address to branch to. In the Thumb instruction set, this is only permitted for some 16-bit<br />

forms of the ADD <strong>and</strong> MOV instructions.<br />

A4-8 Copyright © 1996-1998, 2000, 2004-2008 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DDI 0406B

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!