vsel
Vector Select
vsel vD, vA, vB, vC
Bitwise selection. copies bits from vA if the corresponding bit in vC is 0, or from vB if vC is 1. (Like 'mux').
Details
The vsel instruction selects elements from two vector registers (VRA and VRB) based on the corresponding bits in a mask vector register (VRC). The result is stored in another vector register (VRT).
Pseudocode Operation
Programming Note
The vsel instruction requires the Vector Facility to be enabled in the MSR. Ensure that VRA, VRB, and VRC are properly aligned and contain valid data. The result is stored in VRT, so ensure it is not being used elsewhere in your computation until the operation completes.
Example
vsel v1, v2, v3, v4
Encoding
Binary Layout
0
0
VRT
6
VRA
11
VRB
16
VRC
21
42
Operands
-
vD
Target -
vA
Source 0 -
vB
Source 1 -
vC
Control (Selector) -
VRT
Target Vector Register -
VRA
Source Vector Register -
VRB
Source Vector Register -
VRC
Mask Vector Register