5.1.4. PUSH and POP

Push low registers, and optionally the lr, onto the stack.

Pop low registers, and optionally the pc, off the stack.

Syntax

PUSH {reglist}
POP {reglist}
PUSH {reglist, lr}
POP {reglist, pc}

where:

reglist

is a comma-separated list of low registers or low-registerranges.

Note

The braces in the syntax description are part of the instruction format. They do not indicate that the register list is optional.

There must be at least one register in the list.

Usage

Thumb stacks are full, descending stacks. The stack grows downwards, and the sp points to the last entry on the stack.

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

POP {reglist, 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 ARM architecture version 5T and above:

  • if bits[1:0] of the value loaded to the pc are b00, the processor changes to ARM state

  • bits[1:0] must not have the value b10.

In ARM architecture version 4T and earlier, bits[1:0] of the value loaded to the pc are ignored, so POP cannot be used to change state.

Condition flags

These instructions do not affect the flags.

Architectures

These instructions are available in all T variants of the ARM architecture.

Examples

    PUSH    {r0,r3,r5}
    PUSH    {r1,r4-r7}  ; pushes r1, r4, r5, r6, and r7
    PUSH    {r0,LR}
    POP     {r2,r5}
    POP     {r0-r7,pc}  ; pop and return from subroutine

Incorrect examples

    PUSH    {r3,r5-r8}  ; high registers not allowed
    PUSH    {}          ; must be at least one register in list
    PUSH    {r1-r4,pc}  ; cannot push the pc
    POP     {r1-r4,LR}  ; cannot pop the LR
Copyright © 2000, 2001 ARM Limited. All rights reserved.ARM DUI 0068B
Non-Confidential