vrlb
Vector Rotate Left Byte
vrlb vD, vA, vB
Rotates each byte of the source vector left by a specified number of bits.
Encoding
Binary Layout
4
0:5
vD
6:10
vA
11:15
vB
16:20
4
21:31
Operands
-
vD
Target -
vA
Data -
vB
Rotate Count -
VRT
Target Vector Register -
VRA
Source Vector Register -
VRB
Shift Control Vector Register
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
For vrlb, each byte in VSR[VRA+32] is rotated left by the number of bits specified in the low-order 3 bits of the corresponding byte in VSR[VRB+32]. The result is stored in VSR[VRT+32].
Operation
if MSR.VEC=0 then
Vector_Unavailable()
do i = 0 to 7
src ← VSR[VRA+32].byte[i]
sh ← VSR[VRB+32].byte[i].bit[5:7]
VSR[VRT+32].byte[i] ← src <<< sh
Programming Note
The vrlb instruction rotates each byte in the source vector left by a specified number of bits determined by another vector. Ensure that the Vector Facility is enabled (MSR.VEC=1) to avoid exceptions. The shift amount is derived from the high-order 3 bits of each byte in the second vector, so be cautious with bit manipulation to achieve the desired rotation.