ARM INstruction Set
ARM INstruction Set
Key to Tables {cond} <Operand2> <fields> <PSR> {S} C*, V* Q GE x,y <immed_8r> {X} <prefix> <p_mode> R13m Refer to Table Condition Field. Omit for unconditional execution. Refer to Table Flexible Operand 2. Shift and rotate are only available as part of Operand2. Refer to Table PSR fields. Either CPSR (Current Processor Status Register) or SPSR (Saved Processor Status Register) Updates condition flags if S present. Flag is unpredictable in Architecture v4 and earlier, unchanged in Architecture v5 and later. Sticky flag. Always updates on overflow (no S option). Read and reset using MRS and MSR. Four Greater than or Equal flags. Always updated by parallel adds and subtracts. B meaning half-register [15:0], or T meaning [31:16]. A 32-bit constant, formed by right-rotating an 8-bit value by an even number of bits. RsX is Rs rotated 16 bits if X present. Otherwise, RsX is Rs. Refer to Table Prefixes for Parallel instructions Refer to Table Processor Modes R13 for the processor mode specified by <p_mode> {endianness} <a_mode2> <a_mode2P> <a_mode3> <a_mode4L> <a_mode4S> <a_mode5> <reglist> <reglist-PC> <reglist+PC> {!} +/ <iflags> {R} Q V V Q Q V V V V Q Q Can be BE (Big Endian) or LE (Little Endian). Refer to Table Addressing Mode 2. Refer to Table Addressing Mode 2 (Post-indexed only). Refer to Table Addressing Mode 3. Refer to Table Addressing Mode 4 (Block load or Stack pop). Refer to Table Addressing Mode 4 (Block store or Stack push). Refer to Table Addressing Mode 5. A comma-separated list of registers, enclosed in braces { and }. As <reglist>, must not include the PC. As <reglist>, including the PC. Updates base register after data transfer if ! present. + or . (+ may be omitted.) Refer to Table ARM architecture versions. Interrupt flags. One or more of a, i, f (abort, interrupt, fast interrupt). Rounds result to nearest if R present, otherwise truncates result.
Operation Arithmetic Add with carry saturating double saturating Subtract with carry reverse subtract reverse subtract with carry saturating double saturating Multiply and accumulate unsigned long unsigned accumulate long unsigned double accumulate long Signed multiply long and accumulate long 16 * 16 bit 32 * 16 bit 16 * 16 bit and accumulate 32 * 16 bit and accumulate 16 * 16 bit and accumulate long Dual signed multiply, add and accumulate and accumulate long Dual signed multiply, subtract and accumulate and accumulate long Signed most significant word multiply and accumulate and subtract Multiply with internal 40-bit accumulate packed halfword halfword Count leading zeroes
5E 5E
5E 5E 2 2 M M 6 M M 5E 5E 5E 5E 5E 6 6 6 6 6 6 6 6 6 XS XS XS 5
Assembler S updates ADD{cond}{S} Rd, Rn, <Operand2> N Z C ADC{cond}{S} Rd, Rn, <Operand2> N Z C QADD{cond} Rd, Rm, Rn QDADD{cond} Rd, Rm, Rn SUB{cond}{S} Rd, Rn, <Operand2> N Z C SBC{cond}{S} Rd, Rn, <Operand2> N Z C RSB{cond}{S} Rd, Rn, <Operand2> N Z C RSC{cond}{S} Rd, Rn, <Operand2> N Z C QSUB{cond} Rd, Rm, Rn QDSUB{cond} Rd, Rm, Rn MUL{cond}{S} Rd, Rm, Rs N Z C* MLA{cond}{S} Rd, Rm, Rs, Rn N Z C* UMULL{cond}{S} RdLo, RdHi, Rm, Rs N Z C* UMLAL{cond}{S} RdLo, RdHi, Rm, Rs N Z C* UMAAL{cond} RdLo, RdHi, Rm, Rs SMULL{cond}{S} RdLo, RdHi, Rm, Rs N Z C* SMLAL{cond}{S} RdLo, RdHi, Rm, Rs N Z C* SMULxy{cond} Rd, Rm, Rs SMULWy{cond} Rd, Rm, Rs SMLAxy{cond} Rd, Rm, Rs, Rn SMLAWy{cond} Rd, Rm, Rs, Rn SMLALxy{cond} RdLo, RdHi, Rm, Rs SMUAD{X}{cond} Rd, Rm, Rs SMLAD{X}{cond} Rd, Rm, Rs, Rn SMLALD{X}{cond} RdHi, RdLo, Rm, Rs SMUSD{X}{cond} Rd, Rm, Rs SMLSD{X}{cond} Rd, Rm, Rs, Rn SMLSLD{X}{cond} RdHi, RdLo, Rm, Rs SMMUL{R}{cond} Rd, Rm, Rs SMMLA{R}{cond} Rd, Rm, Rs, Rn SMMLS{R}{cond} Rd, Rm, Rs, Rn MIA{cond} Ac, Rm, Rs MIAPH{cond} Ac, Rm, Rs MIAxy{cond} Ac, Rm, Rs CLZ{cond} Rd, Rm
V* V* V* V*
Q Q Q Q Q Q Q Q
Action Rd := Rn + Operand2 Rd := Rn + Operand2 + Carry Rd := SAT(Rm + Rn) Rd := SAT(Rm + SAT(Rn * 2)) Rd := Rn Operand2 Rd := Rn Operand2 NOT(Carry) Rd := Operand2 Rn Rd := Operand2 Rn NOT(Carry) Rd := SAT(Rm Rn) Rd := SAT(Rm SAT(Rn * 2)) Rd := (Rm * Rs)[31:0] Rd := ((Rm * Rs) + Rn)[31:0] RdHi,RdLo := unsigned(Rm * Rs) RdHi,RdLo := unsigned(RdHi,RdLo + Rm * Rs) RdHi,RdLo := unsigned(RdHi + RdLo + Rm * Rs) RdHi,RdLo := signed(Rm * Rs) RdHi,RdLo := signed(RdHi,RdLo + Rm * Rs) Rd := Rm[x] * Rs[y] Rd := (Rm * Rs[y])[47:16] Rd := Rn + Rm[x] * Rs[y] Rd := Rn + (Rm * Rs[y])[47:16] RdHi,RdLo := RdHi,RdLo + Rm[x] * Rs[y] Rd := Rm[15:0] * RsX[15:0] + Rm[31:16] * RsX[31:16] Rd := Rn + Rm[15:0] * RsX[15:0] + Rm[31:16] * RsX[31:16] RdHi,RdLo := RdHi,RdLo + Rm[15:0] * RsX[15:0] + Rm[31:16] * RsX[31:16] Rd := Rm[15:0] * RsX[15:0] Rm[31:16] * RsX[31:16] Rd := Rn + Rm[15:0] * RsX[15:0] Rm[31:16] * RsX[31:16] RdHi,RdLo := RdHi,RdLo + Rm[15:0] * RsX[15:0] Rm[31:16] * RsX[31:16] Rd := (Rm * Rs)[63:32] Rd := Rn + (Rm * Rs)[63:32] Rd := Rn (Rm * Rs)[63:32] Ac := Ac + Rm * Rs Ac := Ac + Rm[15:0] * Rs[15:0] + Rm[31:16] * Rs[31:16] Ac := Ac + Rm[x] * Rs[y] Rd := number of leading zeroes in Rm
6 <prefix>SUB8{cond} Rd, Rn, Rm 6 <prefix>ADDSUBX{cond} Rd, Rn, Rm 6 <prefix>SUBADDX{cond} Rd, Rn, Rm 6 USAD8{cond} Rd, Rm, Rs 6 USADA8{cond} Rd, Rm, Rs, Rn MOV{cond}{S} Rd, <Operand2> MVN{cond}{S} Rd, <Operand2> MRS{cond} Rd, <PSR> MSR{cond} <PSR>_<fields>, Rm MSR{cond} <PSR>_<fields>, #<immed_8r> MRA{cond} RdLo, RdHi, Ac MAR{cond} Ac, RdLo, RdHi CPY{cond} Rd, <Operand2> TST{cond} Rn, <Operand2> TEQ{cond} Rn, <Operand2> AND{cond}{S} Rd, Rn, <Operand2> EOR{cond}{S} Rd, Rn, <Operand2> ORR{cond}{S} Rd, Rn, <Operand2> BIC{cond}{S} Rd, Rn, <Operand2> CMP{cond} Rn, <Operand2> CMN{cond} Rn, <Operand2> SSAT{cond} Rd, #<sat>, Rm{, ASR <sh>} SSAT{cond} Rd, #<sat>, Rm{, LSL <sh>} SSAT16{cond} Rd, #<sat>, Rm N Z N Z
3 3 3 XS XS 6
Logical
Compare Saturate
N N N N N N N N
Z Z Z Z Z Z Z Z
6 6
6 USAT{cond} Rd, #<sat>, Rm{, ASR <sh>} USAT{cond} Rd, #<sat>, Rm{, LSL <sh>} 6 USAT16{cond} Rd, #<sat>, Rm
Unsigned extend
Signed extend with add Unsigned extend with add Reverse bytes
label must be within 32Mb of current instruction. label must be within 32Mb of current instruction. Cannot be conditional. label must be within 32Mb of current instruction.
with link and exchange (2) and change to Java state Processor Change processor state state change Change processor mode Set endianness Store return state Return from exception Breakpoint Software interrupt No operation
5 5J, 6 6 6 6 6 6 6 5
BLX{cond} Rm BXJ{cond} Rm CPSID <iflags> {, #<p_mode>} CPSIE <iflags> {, #<p_mode>} CPS #<p_mode> SETEND <endianness> SRS<a_mode4S> #<p_mode>{!} RFE<a_mode4L> Rn{!} BKPT <immed_16> SWI{cond} <immed_24> NOP
R14 := address of next instruction, R15 := Rm[31:1] Change to Thumb if Rm[0] is 1 Change to Java state Disable specified interrups, optional change mode. Enable specified interrups, optional change mode. Sets endianness for loads and saves. <endianness> can be BE (Big Endian) or LE (Little Endian). [R13m] := R14, [R13m + 4] := CPSR PC := [Rn], CPSR := [Rn + 4] Prefetch abort or enter debug state. Software interrupt processor exception. None
Cannot be conditional. Cannot be conditional. Cannot be conditional. Cannot be conditional. Cannot be conditional. Cannot be conditional. Cannot be conditional. 24-bit value encoded in instruction.
Software interrupt No Op
Load multiple
and restore CPSR User mode registers Soft preload Memory system hint Load exclusive Semaphore operation Word User mode privilege Byte User mode privilege Halfword Doubleword Store multiple Push, or Block data store User mode registers Store exclusive Semaphore operation Swap Word Byte Store
Rd := SignExtend[byte from address] Rd := ZeroExtent[halfword from address] Rd := SignExtend[halfword from address] Rd := [address], R(d+1) := [address + 4] Load list of registers from [Rn] Load registers, R15 := [address][31:1] ( 5T: Change to Thumb if [address][0] is 1) LDM{cond}<a_mode4L> Rn{!}, <reglist+PC>^ Load registers, branch ( 5T: and exchange), CPSR := SPSR LDM{cond}<a_mode4L> Rn, <reglist-PC>^ Load list of User mode registers from [Rn] 5E* PLD <a_mode2> Memory may prepare to load from address 6 LDREX{cond} Rd, [Rn] Rd := [Rn], tag address as exclusive access Outstanding tag set if not shared address STR{cond} Rd, <a_mode2> [address] := Rd STR{cond}T Rd, <a_mode2P> [address] := Rd STR{cond}B Rd, <a_mode2> [address][7:0] := Rd[7:0] STR{cond}BT Rd, <a_mode2P> [address][7:0] := Rd[7:0] 4 STR{cond}H Rd, <a_mode3> [address][15:0] := Rd[15:0] 5E* STR{cond}D Rd, <a_mode3> [address] := Rd, [address + 4] := R(d+1) STM{cond}<a_mode4S> Rn{!}, <reglist> Store list of registers to [Rn] STM{cond}<a_mode4S> Rn{!}, <reglist>^ Store list of User mode registers to [Rn] 6 STREX{cond} Rd, Rm, [Rn] [Rn] := Rm if allowed, Rd := 0 if successful, else 1 3 SWP{cond} Rd, Rm, [Rn] temp := [Rn], [Rn] := Rm, Rd := temp 3 SWP{cond}B Rd, Rm, [Rn] temp := ZeroExtend([Rn][7:0]), [Rn][7:0] := Rm[7:0], Rd := temp
LDR{cond}B Rd, <a_mode2> LDR{cond}BT Rd, <a_mode2P> 4 LDR{cond}SB Rd, <a_mode3> 4 LDR{cond}H Rd, <a_mode3> 4 LDR{cond}SH Rd, <a_mode3> 5E* LDR{cond}D Rd, <a_mode3> LDM{cond}<a_mode4L> Rn{!}, <reglist-PC> LDM{cond}<a_mode4L> Rn{!}, <reglist+PC>
Rd must not be R15. Rd must not be R15. Rd must not be R15. Rd must not be R15. Rd must not be R15. Rd must be even, and not R14.
Use from exception modes only. Use from privileged modes only. Cannot be conditional. Rd, Rn must not be R15.
Rd must be even, and not R14. Use from privileged modes only. Rd, Rm, Rn must not be R15.
Equivalent to [Rn,#0] Allowed shifts 0-31 Allowed shifts 1-32 Allowed shifts 1-32 Allowed shifts 1-31
Allowed shifts 0-31 Allowed shifts 1-32 Allowed shifts 1-32 Allowed shifts 1-31
#+/-<immed_12> Equivalent to [Rn],#0 +/-Rm +/-Rm, +/-Rm, +/-Rm, +/-Rm, +/-Rm, LSL LSR ASR ROR RRX #<shift> #<shift> #<shift> #<shift> Allowed shifts 0-31 Allowed shifts 1-32 Allowed shifts 1-32 Allowed shifts 1-31
#<immed_8r> Rm, LSL #<shift> Rm, LSR #<shift> Rm, ASR #<shift> Rm, ROR #<shift> Rm Rm, RRX Rm, LSL Rs Rm, LSR Rs Rm, ASR Rs Rm, ROR Rs
Allowed shifts 0-31 Allowed shifts 1-32 Allowed shifts 1-32 Allowed shifts 1-31
(use at least one suffix) Meaning Control field mask byte Flags field mask byte Status field mask byte Extension field mask byte
Addressing Mode 3 - Halfword, Signed Byte, and Doubleword Data Transfer Pre-indexed Immediate offset [Rn, #+/-<immed_8>]{!} Zero offset [Rn] Equivalent to [Rn,#0] Register [Rn, +/-Rm]{!} Post-indexed Immediate offset [Rn], #+/-<immed_8> Register [Rn], +/-Rm Addressing Mode 4 - Multiple Data Transfer Block load Stack pop IA Increment After FD IB Increment Before ED DA Decrement After FA DB Decrement Before EA Block store Stack push IA Increment After EA IB Increment Before FA DA Decrement After ED DB Decrement Before FD
Full Descending Empty Descending Full Ascending Empty Ascending Empty Ascending Full Ascending Empty Descending Full Descending
Condition Field Mnemonic Description EQ Equal NE Not equal CS / HS Carry Set / Unsigned higher or same CC / LO Carry Clear / Unsigned lower MI Negative PL Positive or zero VS Overflow VC No overflow HI Unsigned higher LS Unsigned lower or same GE Signed greater than or equal LT Signed less than GT Signed greater than LE Signed less than or equal AL Always (normally omitted) Processor Modes 16 User 17 FIQ Fast Interrupt 18 IRQ Interrupt 19 Supervisor 23 Abort 27 Undefined 31 System
Description (VFP) Equal Not equal, or unordered Greater than or equal, or unordered Less than Less than Greater than or equal, or unordered Unordered (at least one NaN operand) Not unordered Greater than, or unordered Less than or equal Greater than or equal Less than, or unordered Greater than Less than or equal, or unordered Always (normally omitted)
Addressing Mode 5 - Coprocessor Data Transfer Pre-indexed Immediate offset [Rn, #+/-<immed_8*4>]{!} Zero offset [Rn] Post-indexed Immediate offset [Rn], #+/-<immed_8*4> Unindexed No offset [Rn], {8-bit copro. option}
Equivalent to [Rn,#0]
Prefixes for Parallel Instructions S Signed arithmetic modulo 28 or 216, sets CPSR GE bits Q Signed saturating arithmetic SH Signed arithmetic, halving results U Unsigned arithmetic modulo 28 or 216, sets CPSR GE bits UQ Unsigned saturating arithmetic UH Unsigned arithmetic, halving results
Proprietary Notice
Words and logos marked with or are registered trademarks or trademarks owned by ARM Limited. Other brands and names mentioned herein may be the trademarks of their respective owners. Neither the whole nor any part of the information contained in, or the product described in, this document may be adapted or reproduced in any material form except with the prior written permission of the copyright holder. The product described in this document is subject to continuous developments and improvements. All particulars of the product and its use contained in this document are given by ARM in good faith. However, all warranties implied or expressed, including but not limited to implied warranties of merchantability, or fitness for purpose, are excluded. This reference card is intended only to assist the reader in the use of the product. ARM Ltd shall not be liable for any loss or damage arising from the use of any information in this reference card, or any error or omission in such information, or any incorrect use of the product.
Document Number
ARM QRC 0001H
Change Log
Issue A B C D E F G H Date June 1995 Sept 1996 Nov 1998 Oct 1999 Oct 2000 Sept 2001 Jan 2003 Oct 2003 By BJH BJH BJH CKS CKS CKS CKS CKS Change First Release Second Release Third Release Fourth Release Fifth Release Sixth Release Seventh Release Eighth Release