1

I need to Reverse these PowerPC instructions here they are:

clrrwi    r10, r10, 7
clrrwi    r31, r11, 7
R10 = 64
R11 = b3

I dont know the instruction clrrwi and i cant find it on the internet.

Dko
  • 820
  • 6
  • 12
user3885393
  • 41
  • 2
  • 9
  • You may find reading this thread useful: http://stackoverflow.com/questions/22238073/confused-with-powerpcs-registerss-values – JColl Jul 28 '14 at 19:21
  • I still dont understand – user3885393 Jul 28 '14 at 20:21
  • It's equivalent to writing "r10=r10 & 0xFFFFFF80" and "r31=r11 & 0xFFFFFF80" in C. It could be used to round down to the nearest 128 bit multiple. – Dko Jul 28 '14 at 22:27

1 Answers1

1

I don't have an expert understanding of the instruction set, but I believe it works as follows:

clrrwi is a simplified mnemonic that can be used instead of

rlwinm rA, rS, 0, 0, 31 - n.

The standard rlwinm takes the following form:

rlwinm rA, rS, SH, MB, ME

n.b. rlwinm stands for Rotate Left Word Immediate then aNd with Mask

Where;

  • rA = target general-purpose register (where the result is stored)
  • rS = source general-purpose register for operation
  • SH = shift amount
  • MB = mask begin (start bit for mask)
  • ME = mask end (end bit for mask)

With your example;

clrrwi    r10, r10, 7
  • the contents of register r10 are rotated left by 0 bits (no rotation)

  • A mask is created; with 1's from bit (0 + 32) to ((31 - 7) + 32) and 0's everywhere else. [32 - 56]

  • then r10 (after its rotation of 0 bits) is logically ANDed with this mask

  • the result is stored in r10

Most of this can be read from the IBM documentation available at: http://www.ibm.com/developerworks/systems/library/es-archguide-v2-pdf.pdf

JColl
  • 51
  • 3