
5 INSTRUCTION SET
S1C33 FAMILY C33 PE CORE MANUAL
EPSON
37
5.13 Push and Pop Instructions
The push and pop instructions are provided to temporarily save the contents of general-purpose or special registers
to the stack, and to restore the saved register data from the stack.
Push instructions
pushn %rs
push
%rs
pushs
%ss
The pushn instruction saves a range of general-purpose registers from rs to R0 to the stack successively. The
push instruction saves the general-purpose register specified by rs to the stack singly. The pushs instruction
saves the special registers (ALR only or AHR and ALR).
Pop instructions
popn %rd
pop
%rd
pops
%sd
The popn instruction restores the saved data from the stack to the general-purpose registers R0 to rd successively.
The pop instruction restores the saved data from the stack to the general-purpose register specified by rd singly.
The pops instruction restores the saved data from the stack to the special registers (ALR only or ALR and AHR).
The push and pop instructions must have the same register specification in pairs. These instructions alter the
SP depending on the number of pieces of data that are saved and restored. Because in addition to the push/pop
instructions, load instructions are available for register indirect addressing with displacement ([%sp+imm6
])
where the SP is the base address, individual store/load operations on each register can be performed with respect to
the SP. In this case, however, the SP is not altered.
A specific register number is assigned to each register (refer to Chapter 2, “Registers”). When general-purpose or
special registers are successively pushed, their data is saved to the stack in descending order of register numbers
beginning with the one specified by rs or ss. In successive pop operations, conversely, the register data is restored in
ascending order from R0 or ALR up to the specified register.
Differences from the C33 STD Core CPU
• General-purpose-register single push/pop instructions have been added.
push %rs pop %rd
• Special-register successive push/pop instructions have been added.
pushs %ss pops %sd
Example 1:
pushn %r15 Push all general-purpose registers onto the stack
popn %r15 Pop all general-purpose registers off the stack
31 0
Before execution of pushn
low address
31 0
After execution of pushn
r15
r14
r13
r12
:
:
r1
r0
low address
SP
SP
The stack pointer is updated before the register data is pushed onto the stack.
SP = SP - 4, rs → [SP]
Figure 5.13.1 Successive Push of General-Purpose Registers
Comentarios a estos manuales