rldic
Rotate Left Doubleword Immediate Clear
rldic RT,RA,RB,MB
rldic. RT,RA,RB,MB
rldic. RT,RA,RB,MB
Rotates a 64-bit register left, then clears bits based on a mask. 64-bit equivalent of rlwinm.
Details
The contents of register RS are rotated64 left SH bits. A mask is generated having 1-bits from bit MB through bit 63-SH and 0-bits elsewhere. The rotated data are ANDed with the generated mask and the result is placed into register RA.
Pseudocode Operation
if 'rldic' then
SH ← sh5 || sh0:4
r ← ROTL64((RS), SH)
MB ← mb5 || mb0:4
m ← MASK(MB, 63-SH)
RA ← r & m
Programming Note
rldic can be used to clear the high-order b bits of the contents of a register and then shift the result left by n bits, by setting SH=n and MB=b-n. It can be used to clear the high-order n bits of a register, by setting SH=0 and MB=n.
Extended Mnemonics
| Extended Mnemonic | Equivalent Instruction |
|---|---|
| clrlsldi | |
| clrlsldi.RA,RS,b,n |
Example
rldic r3, r4, 4, 10
// Rotate left 4, clear bits 0-9.
Encoding
Binary Layout
30
0
RS
6
RA
11
SH
16
MB
21
2
27
sh Rc
30 31
Operands
-
RA
Target -
RS
Source -
SH
Shift Amount -
MB
Mask Begin -
RT
Target General Purpose Register -
RB
Immediate Value for SH (Shift Amount)