mfcr

Move From Condition Register

mfcr RT

Copies the entire 32-bit Condition Register into a General Purpose Register.

Encoding

Binary Layout
31
0:5
RT
6:10
00000
11:15
00000
16:20
19
21:30
/
31
 
Format X-form
Opcode 0x7C000026
Extension Base

Operands

  • RT
    Target Register

Example

mfcr r3

// Save flags to r3.

Registers Altered

CR

Related

More in Base

Reference

Description

Moves the entire 32-bit Condition Register into the target GPR. All eight 4-bit CR fields (CR0-CR7) are copied as a single 32-bit value. No condition register or status fields are modified by this operation.

Operation

RT ← CR

Programming Note

The mfcr instruction is commonly used to save the current state of the condition register for later use, such as before a function call or when implementing exception handling. It's important to note that this instruction does not affect any flags in the condition register itself; it merely copies its contents. Ensure that the target general-purpose register RT is properly aligned and accessible at the privilege level where the instruction is executed.