Examples

Example of 32-bit Rotate and Shift Extended Mnemonics for POWER® family and PowerPC®

  1. To extract the sign bit (bit 31) of register RY and place the result right-justified into register RX:
    
    extrwi   RX, RY, 1, 0
    
    This is equivalent to:
    
    rlwinm   RX, RY, 1, 31, 31
    
  2. To insert the bit extracted in Example 1 into the sign bit (bit 31) of register RX:
    
    insrwi   RZ, RX, 1, 0
    
    This is equivalent to:
    
    rlwimi   RZ, RX, 31, 0, 0
    
  3. To shift the contents of register RX left 8 bits and clear the high-order 32 bits:
    
    slwi   RX, RX, 8
    
    This is equivalent to:
    
    rlwinm   RX, RX, 8, 0, 23
    
  4. To clear the high-order 16 bits of the low-order 32 bits of register RY and place the result in register RX, and clear the high-order 32 bits of register RX:
    
    clrlwi   RX, RY, 16
    
    This is equivalent to:
    
    rlwinm   RX, RY, 0, 16, 31