vrlwmi
Vector Rotate Left Word then Mask Insert VX-form
Rotates the contents of each word element in a vector left by a specified number of bits and inserts the result into another vector under control of a mask.
Details
Rotates each word element of VRA left by the number of bits specified in VRB, then inserts the rotated result into VRT under control of a mask generated from VRB. No condition flags are affected.
Pseudocode Operation
for i in 0 to 3 do
shamt ← (VRB[i*32+27:i*32+31]) & 0x1F
word ← (u32)VRA[i*32:(i*32+31)]
rotated ← (word << shamt) | (word >> (32 - shamt))
mask ← Generate_Mask_From_VRB(i)
VRT[i*32:(i*32+31)] ← (VRT[i*32:(i*32+31)] & ~mask) | (rotated & mask)
end for
Programming Note
The vrlwmi instruction is useful for performing masked insertions after rotating word elements. Ensure that the mask bits (11:15 and 19:23) are set correctly to achieve the desired insertion pattern. This instruction operates on vector registers, so ensure that the Vector Facility is enabled in the Machine State Register (MSR).
Example
Encoding
Operands
-
VRT
Target Vector Register -
VRA
Source Vector Register -
VRB
Source Vector Register