mtcrf
Move To Condition Register Fields
Copies bits from a register into the Condition Register, updated only the fields specified by the mask (FXM).
Details
Moves bits from the source register (RS) into the Condition Register (CR), updating only the fields specified by the mask FXM. Each bit in FXM corresponds to one of the eight 4-bit CR fields; a 1 indicates that field should be updated. This instruction affects the CR as specified by the mask, with no other status register modifications.
Pseudocode Operation
do i = 0 to 7
if FXM[i] = 1 then
CR[4*i:4*i+3] ← RS[4*i:4*i+3]
end do
Programming Note
The mtcrf instruction is used to move specific fields of the Condition Register (CR) into general-purpose registers. It's important to note that if the SPR number is between 808 and 811, the instruction acts as a no-op. Ensure that the FXM field correctly specifies which CR fields to transfer to avoid unintended behavior.
Example
// Restore all CR fields from r3.
Encoding
Operands
-
FXM
Field Mask (8 bits) -
RS
Source Register