mfocrf

Move From One Condition Register Field

mfocrf RT, FXM

Moves a single CR field to a GPR.

Details

The mfocrf instruction moves the contents of a single field from the Condition Register (CR) to a general-purpose register (RT). If exactly one bit in the FXM field is set, it copies the corresponding CR field into RT, setting other bits of RT to zero. Otherwise, the contents of RT are undefined.

Pseudocode Operation

count ←0
RT ←undefined
do i = 0 to 7
   if FXMi = 1 then
      n ←i
      count ←count + 1
if count = 1 then
   RT ←640
   RT4×n+32:4×n+35 ←CR4×n+32:4×n+35

Programming Note

The mfocrf instruction is used to extract a specific condition register field into a general-purpose register. Ensure that exactly one bit in the FXM field is set to avoid undefined behavior. This instruction operates at user privilege level and does not generate exceptions under normal conditions.

Example

mfocrf r3, 0xFF

Encoding

Binary Layout
31
0
RT
6
FXM
11
19
19
/
31
 
Format XFX-form
Opcode 0x7C000026
Extension Base
Registers Altered CR

Operands

  • RT
    Target
  • FXM
    Mask