Move To Special Purpose Register

XFX-Form

  • mtspr SPR,RS

Pseudo-code:

n <- spr[5:9] || spr[0:4]
switch (n)
  case(13): see(Book_III_p974)
  case(808, 809, 810, 811):
  default:
    if length(SPR(n)) = 64 then
      SPR(n) <- (RS)
    else
      SPR(n) <- (RS) [32:63]

Special Registers Altered:

See spec 3.3.17

Move From Special Purpose Register

XFX-Form

  • mfspr RT,SPR

Pseudo-code:

n <- spr[5:9] || spr[0:4]
switch (n)
  case(129): see(Book_III_p975)
  case(808, 809, 810, 811):
  default:
    if length(SPR(n)) = 64 then
      RT <- SPR(n)
    else
      RT <- [0]*32 || SPR(n)

Special Registers Altered:

None

Move to CR from XER Extended

X-Form

  • mcrxrx BF

Pseudo-code:

CR[4*BF+32:4*BF+35] <-  XER[OV] || XER[OV32] || XER[CA] || XER[CA32]

Special Registers Altered:

CR field BF

Move To One Condition Register Field

XFX-Form

  • mtocrf FXM,RS

Pseudo-code:

count <- 0
do i = 0 to 7
  if FXM[i] = 1 then
    n <- i
    count <- count + 1
if count = 1 then
    CR[4*n+32:4*n+35] <- (RS)[4*n+32:4*n+35]
else CR <- undefined

Special Registers Altered:

CR field selected by FXM

Move To Condition Register Fields

XFX-Form

  • mtcrf FXM,RS

Pseudo-code:

mask <- ([FXM[0]]*4 || [FXM[1]]*4 || [FXM[2]]*4 || [FXM[3]]*4 ||
         [FXM[4]]*4 || [FXM[5]]*4 || [FXM[6]]*4 || [FXM[7]]*4)
CR <- ((RS)[32:63] & mask) | (CR & ¬mask)

Special Registers Altered:

CR fields selected by mask

Move From One Condition Register Field

XFX-Form

  • mfocrf RT,FXM

Pseudo-code:

RT <- undefined
count <- 0
do i = 0 to 7
  if FXM[i] = 1 then
    n <- i
    count <- count + 1
if count = 1 then
    RT <- [0]*64
RT[4*n+32:4*n+35] <- CR[4*n+32:4* n+35]

Special Registers Altered:

None

Move From Condition Register

XFX-Form

  • mfcr RT

Pseudo-code:

RT <- [0]*32 || CR

Special Registers Altered:

None

Set Boolean

X-Form

  • setb RT,BFA

Pseudo-code:

if CR[4*BFA+32] = 1 then
   RT <- 0xFFFF_FFFF_FFFF_FFFF
else if CR[4*BFA+33]=1 then
   RT <- 0x0000_0000_0000_0001
else
   RT <- 0x0000_0000_0000_0000

Special Registers Altered:

None

Move To Machine State Register

X-Form

  • mtmsr RS,L

Pseudo-code:

if L = 0 then
    MSR[48] <- (RS)[48] | (RS)[49]
    MSR[58] <- ((RS)[58] | (RS)[49]) & ¬(MSR[41] & MSR[3] & (¬(RS)[49]))
    MSR[59] <- ((RS)[59] | (RS)[49]) & ¬(MSR[41] & MSR[3] & (¬(RS)[49]))
    MSR[32:40] <- (RS)[32:40]
    MSR[42:47] <- (RS)[42:47]
    MSR[49:50] <- (RS)[49:50]
    MSR[52:57] <- (RS)[52:57]
    MSR[60:62] <- (RS)[60:62]
else
    MSR[48] <- (RS)[48]
    MSR[62] <- (RS)[62]

Special Registers Altered:

MSR

Move From Machine State Register

X-Form

  • mfmsr RT

Pseudo-code:

RT <- MSR

Special Registers Altered:

None