mtocrf

Move To One Condition Register Field

mtocrf FXM, RS

Moves a GPR field to a single CR field.

Details

The mtocrf instruction moves a specific field from the Condition Register (CR) to a general-purpose register (RS). It requires exactly one bit in the FXM field to be set, indicating which CR field to move. If more than one bit is set, the contents of the Condition Register become undefined.

Pseudocode Operation

count ←0
 do i = 0 to 7
    if FXMi = 1 then
       n ←i
    count ←count + 1
 if count = 1 then
    CR4×n+32:4×n+35 ←(RS)4×n+32:4×n+35
 else
    CR ←undefined

Programming Note

The mtocrf instruction is used to transfer a specific field from the Condition Register (CR) to a general-purpose register. Ensure that exactly one bit in the FXM field is set to avoid undefined behavior of the Condition Register. This instruction operates at user privilege level and does not generate exceptions under normal conditions.

Example

mtocrf 0xFF, r3

Encoding

Binary Layout
31
0
RS
6
FXM
11
144
19
/
31
 
Format XFX-form
Opcode 0x7C000120
Extension Base
Registers Altered CR

Operands

  • FXM
    Mask
  • RS
    Source