mfocrf

Move From One Condition Register Field

mfocrf RT, FXM

Moves a single CR field to a GPR.

Details

Moves a single condition register field to a GPR, using FXM as a mask to select which CR field (CR0–CR7) is read. The FXM field must have only one bit set; the selected 4-bit CR field is placed in bits [0:3] of RT, with all other GPR bits zeroed.

Pseudocode Operation

// Move CR field selected by FXM to GPR bits [0:31]
RT ← 0
for i in 0 to 7:
  if FXM[i] = 1 then
    RT[i*4:(i+1)*4] ← CR[i*4:(i+1)*4]

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 0x7C100026
Extension Base
Registers Altered CR

Operands

  • RT
    Target
  • FXM
    Mask