mtctr

Move To Count Register

mtctr RS

Moves GPR to CTR. (Alias for 'mtspr 9, RS').

Details

The Move To Condition Register Fields instruction moves specified fields from a general-purpose register to the condition register. The preferred form of this instruction sets exactly one bit in the FXM field.

Pseudocode Operation

CTR ← RS

Programming Note

The mtctr instruction is commonly used to set up loop counters by moving values from a general-purpose register into the Count Register (CTR). Ensure that the source register contains the correct value for the desired loop iterations. This instruction operates at user privilege level and does not generate exceptions under normal conditions, but incorrect usage can lead to infinite loops if not managed properly.

Example

mtctr r3

Encoding

Binary Layout
31
0
RS
6
9
11
467
21
/
31
 
Format XFX-form
Opcode 0x7C0903A6
Extension Base
Registers Altered CTR

Operands

  • RS
    Source