Examples
Example of 32-bit Rotate and Shift Extended Mnemonics for POWER® family and PowerPC®
- To extract the sign bit (bit 31) of register RY and place
the result right-justified into register RX:
This is equivalent to:extrwi RX, RY, 1, 0
rlwinm RX, RY, 1, 31, 31
- To insert the bit extracted in Example 1 into the sign bit (bit
31) of register RX:
This is equivalent to:insrwi RZ, RX, 1, 0
rlwimi RZ, RX, 31, 0, 0
- To shift the contents of register RX left 8 bits and clear
the high-order 32 bits:
This is equivalent to:slwi RX, RX, 8
rlwinm RX, RX, 8, 0, 23
- 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:
This is equivalent to:clrlwi RX, RY, 16
rlwinm RX, RY, 0, 16, 31