mtctr
Move To Count Register
mtctr RS
Moves GPR to CTR. (Alias for 'mtspr 9, RS').
Encoding
Binary Layout
31
0:5
RS
6:10
9
11:20
467
21:30
/
31
Operands
-
RS
Source
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
Moves a value from a general-purpose register into the Count register (CTR), typically used to set up loop counts or branch targets for branch-to-CTR instructions. This is an alias for 'mtspr 9, RS' where SPR 9 designates CTR. No condition register flags are modified.
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.