mfctr

Move From Count Register

mfctr RT

Moves CTR to GPR. (Alias for 'mfspr RT, 9').

Details

The mfctr instruction moves the value from the Count Register (CTR) to a general-purpose register specified by RT.

Pseudocode Operation

RT ← CTR

Programming Note

The mfctr instruction is commonly used to retrieve the current count value from the Count Register, which is often utilized in loop control. Ensure that the destination register (RT) is properly aligned and accessible at the privilege level where this instruction is executed. This instruction does not raise exceptions under normal circumstances but should be used with caution in critical loops to avoid unintended behavior.

Example

mfctr r3

Encoding

Binary Layout
31
0
RT
6
9
11
339
21
/
31
 
Format XFX-form
Opcode 0x7C0902A6
Extension Base
Registers Altered CTR

Operands

  • RT
    Target