vrlwmi
Vector Rotate Left Word then Mask Insert VX-form
vrlwmi VRT,VRA,VRB
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.
Encoding
Binary Layout
4
0:5
VRT
6:10
VRA
11:15
VRB
16:31
Operands
-
VRT
Target Vector Register -
VRA
Source Vector Register -
VRB
Source Vector Register
Example
vrlwmi v1, v2, v3
Related
More in VMX (AltiVec)
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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).