You copied the Doc URL to your clipboard.

ARM Compiler armasm User Guide : Program Counter in AArch32 state

Program Counter in AArch32 state

You can use the Program Counter explicitly, for example in some T32 data processing instructions, and implicitly, for example in branch instructions.

The Program Counter (PC) is accessed as PC (or R15). It is incremented by the size of the instruction executed, which is always four bytes in A32 state. Branch instructions load the destination address into the PC. You can also load the PC directly using data operation instructions. For example, to branch to the address in a general purpose register, use:

MOV PC,R0

During execution, the PC does not contain the address of the currently executing instruction. The address of the currently executing instruction is typically PC–8 for A32, or PC–4 for T32.

Note

ARM® recommends you use the BX instruction to jump to an address or to return from a function, rather than writing to the PC directly.

Related reference

Was this page helpful? Yes No