PUSH and POP

Push registers onto, and pop registers off a full descending stack.

Show/hideSyntax

PUSH{cond} reglist
POP{cond} reglist

where:

cond

is an optional condition code.

reglist

is a non-empty list of registers, enclosed in braces.It can contain register ranges. It must be comma separated if it contains more than one register or register range.

Show/hideUsage

PUSH is a synonym for STMDB sp!, reglist and POP is a synonym for LDMIA sp! reglist. PUSH and POP are the preferred mnemonics in these cases.

Note

LDM and LDMFD are synonyms of LDMIA. STMFD is a synonym of STMDB.

Registers are stored on the stack in numerical order, with the lowest numbered register at the lowest address.

Show/hidePOP, with reglist including the PC

This instruction causes a branch to the address popped off the stack into the PC. This is usually a return from a subroutine, where the LR was pushed onto the stack at the start of the subroutine.

In ARMv5T and above:

  • bits[1:0] must not be 0b10

  • if bit[0] is 1, execution continues in Thumb state

  • if bit[0] is 0, execution continues in ARM state.

In ARMv4, bits[1:0] of the address loaded must be 0b00.

Show/hideThumb instructions

A subset of these instructions are available in the Thumb instruction set.

The following restrictions apply to the 16-bit instructions:

  • For PUSH, reglist can only include the Lo registers and the LR

  • For POP, reglist can only include the Lo registers and the PC.

The following restrictions apply to the 32-bit instructions:

  • reglist must not include the SP

  • For PUSH, reglist must not include the PC

  • For POP, reglist can include either the LR or the PC, but not both.

Show/hideRestrictions on reglist in ARM instructions

ARM PUSH instructions can have SP and PC in the reglist but these instructions that include SP or PC in the reglist are deprecated in ARMv6T2 and above.

ARM POP instructions cannot have SP but can have PC in the reglist. These instructions that include both PC and LR in the reglist are deprecated in ARMv6T2 and above.

Show/hideExamples

    PUSH    {r0,r4-r7}
    PUSH    {r2,lr}
    POP     {r0,r10,pc} ; no 16-bit version available

Show/hideSee also

Copyright © 2010-2011 ARM. All rights reserved.ARM DUI 0489E
Non-ConfidentialID071611