Copies the contents of a general-purpose register into a special-purpose register.
Bits | Value |
---|---|
0-5 | 31 |
6-10 | RS |
11-20 | spr |
21-30 | 467 |
31 | Rc |
mtspr | SPR, RS |
Note: The special-purpose register is a split field.
See Extended Mnemonics of Moving from or to Special-Purpose Registers for more information.
The mtspr instruction copies the contents of the source general-purpose register RS into the target special-purpose register SPR.
The special-purpose register identifier SPR can have any of the values specified in the following table. The order of the two 5-bit halves of the SPR number is reversed.
SPR Values | |||
Decimal | spr5:9 spr0:4 | Register Name | Privileged |
1 | 00000 00001 | XER | No |
8 | 00000 01000 | LR | No |
9 | 00000 01001 | CTR | No |
18 | 00000 10010 | DSISR | Yes |
19 | 00000 10011 | DAR | Yes |
22 | 00000 10110 | DEC | Yes1 |
25 | 00000 11001 | SDR1 | Yes |
26 | 00000 11010 | SRR0 | Yes |
27 | 00000 11011 | SRR1 | Yes |
272 | 01000 10000 | SPRG0 | Yes |
273 | 01000 10001 | SPRG1 | Yes |
274 | 01000 10010 | SPRG2 | Yes |
275 | 01000 10011 | SPRG3 | Yes |
282 | 01000 11010 | EAR | Yes |
284 | 01000 11100 | TBL | Yes |
285 | 01000 11101 | TBU | Yes |
528 | 10000 10000 | IBAT0U | Yes |
529 | 10000 10001 | IBAT0L | Yes |
530 | 10000 10010 | IBAT1U | Yes |
531 | 10000 10011 | IBAT1L | Yes |
532 | 10000 10100 | IBAT2U | Yes |
533 | 10000 10101 | IBAT2L | Yes |
534 | 10000 10110 | IBAT3U | Yes |
535 | 10000 10111 | IBAT3L | Yes |
536 | 10000 11000 | DBAT0U | Yes |
537 | 10000 11001 | DBAT0L | Yes |
538 | 10000 11010 | DBAT1U | Yes |
539 | 10000 11011 | DBAT1L | Yes |
540 | 10000 11100 | DBAT2U | Yes |
541 | 10000 11101 | DBAT2L | Yes |
542 | 10000 11110 | DBAT3U | Yes |
543 | 10000 11111 | DBAT3L | Yes |
0 | 00000 00000 | MQ2 | No |
20 | 00000 10100 | RTCU2 | Yes |
21 | 00000 10101 | RTCL2 | Yes |
If the SPR field contains any value other than those listed in the SPR Values table, the instruction form is invalid.
The mtspr instruction has one syntax form and does not affect the Fixed-Point Exception Register or Condition Register Field 0.
SPR | Specifies target special-purpose register for operation. |
RS | Specifies source general-purpose register for operation. |
The following code copies the contents of GPR 5 into the Link Register:
# Assume GPR 5 holds 0x1000 00FF. mtspr 8,5 # The Link Register now holds 0x1000 00FF.
Fixed-Point Move to or from Special-Purpose Registers Instructions .