| |||
| Home > ARM and Thumb Instructions > Memory access instructions > PUSH and POP | |||
Push registers onto, and pop registers off a full descending stack.
PUSH{cond}reglist
POP{cond}reglist
where:
condis an optional condition code.
reglistis 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.
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.
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.
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.
A subset of these instructions are available in the Thumb instruction set.
The following restrictions apply to the 16-bit instructions:
For PUSH, can
only include the Lo registers and the LRreglist
For POP, can
only include the Lo registers and the PC.reglist
The following restrictions apply to the 32-bit instructions:
must
not include the SPreglist
For PUSH, must
not include the PCreglist
For POP, can
include either the LR or the PC, but not both.reglist
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.