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.

Assembler syntax<br />

where:<br />

Instruction Details<br />

SUB{S} {,} SP, # All encodings permitted<br />

SUBW {,} SP, # Only encoding T3 permitted<br />

S If S is present, the instruction updates the flags. Otherwise, the flags are not updated.<br />

See St<strong>and</strong>ard assembler syntax fields on page A8-7.<br />

The destination register. If omitted, is SP.<br />

The immediate value to be subtracted from the value obtained from SP. Values are multiples<br />

of 4 in the range 0-508 for encoding T1 <strong>and</strong> any value in the range 0-4095 for encoding T3.<br />

See Modified immediate constants in Thumb instructions on page A6-17 or Modified<br />

immediate constants in <strong>ARM</strong> instructions on page A5-9 for the range of values for<br />

encodings T2 <strong>and</strong> A1.<br />

When both 32-bit encodings are available for an instruction, encoding T2 is preferred to<br />

encoding T3 (if encoding T3 is required, use the SUBW syntax).<br />

The pre-UAL syntax SUBS is equivalent to SUBS.<br />

Operation<br />

if ConditionPassed() then<br />

EncodingSpecificOperations();<br />

(result, carry, overflow) = AddWithCarry(SP, NOT(imm32), ‘1’);<br />

if d == 15 then // Can only occur for <strong>ARM</strong> encoding<br />

ALUWritePC(result); // setflags is always FALSE here<br />

else<br />

R[d] = result;<br />

if setflags then<br />

APSR.N = result;<br />

APSR.Z = IsZeroBit(result);<br />

APSR.C = carry;<br />

APSR.V = overflow;<br />

Exceptions<br />

None.<br />

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

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

Saved successfully!

Ooh no, something went wrong!