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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Thumb Instruction Set Encoding<br />

If the destination register specifier of an LDRB, LDRH, LDRSB, or LDRSH instruction is 0b1111, the<br />

instruction is a memory hint instead of a load operation.<br />

If the destination register specifier of an MRC instruction is 0b1111, bits [31:28] of the value<br />

transferred from the coprocessor are written to the N, Z, C, <strong>and</strong> V flags in the APSR, <strong>and</strong> bits [27:0]<br />

are discarded.<br />

A6.1.3 Use of 0b1101 as a register specifier<br />

R13 is defined in the Thumb instruction set so that its use is primarily as a stack pointer, <strong>and</strong> R13 is normally<br />

identified as SP in Thumb instructions. In 32-bit Thumb instructions, if you use R13 as a general-purpose<br />

register beyond the architecturally defined constraints described in this section, the results are<br />

UNPREDICTABLE.<br />

The restrictions applicable to R13 are described in:<br />

R13[1:0] definition<br />

32-bit Thumb instruction support for R13.<br />

See also 16-bit Thumb instruction support for R13 on page A6-5.<br />

R13[1:0] definition<br />

Bits [1:0] of R13 are SBZP. Writing a nonzero value to bits [1:0] causes UNPREDICTABLE behavior.<br />

32-bit Thumb instruction support for R13<br />

R13 instruction support is restricted to the following:<br />

R13 as the source or destination register of a MOV instruction. Only register to register transfers without<br />

shifts are supported, with no flag setting:<br />

MOV SP,<br />

MOV ,SP<br />

Using the following instructions to adjust R13 up or down by a multiple of 4:<br />

ADD{W} SP,SP,#<br />

SUB{W} SP,SP,#<br />

ADD SP,SP,<br />

ADD SP,SP,,LSL # ; For = 1,2,3<br />

SUB SP,SP,<br />

SUB SP,SP,,LSL # ; For = 1,2,3<br />

R13 as a base register of any load/store instruction. This supports SP-based addressing for load,<br />

store, or memory hint instructions, with positive or negative offsets, with <strong>and</strong> without writeback.<br />

R13 as the first oper<strong>and</strong> in any ADD{S}, CMN, CMP, or SUB{S} instruction. The add <strong>and</strong> subtract<br />

instructions support SP-based address generation, with the address going into a general-purpose<br />

register. CMN <strong>and</strong> CMP are useful for stack checking in some circumstances.<br />

R13 as the transferred register in any LDR or STR instruction.<br />

A6-4 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!