xxblendvw
VSX Vector Blend Variable Word
xxblendvw XT, XA, XB, XC
Selects words from XA or XB based on the MSB of words in XC.
Encoding
Binary Layout
60
0:5
XT
6:10
XA
11:15
XB
16:20
XC
21:25
35
26:31
Operands
-
XT
Target -
XA
Src A -
XB
Src B -
XC
Control
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
Selects whole words from XA or XB based on the MSB of the corresponding word in control register XC. If the MSB of a word in XC is 1, the word from XB is selected; otherwise the word from XA is selected. This VSX instruction does not affect condition registers or status fields.
Operation
for i in 0 to 3:
if XC[32*i] == 1:
XT[32*i:32*i+31] ← XB[32*i:32*i+31]
else:
XT[32*i:32*i+31] ← XA[32*i:32*i+31]
Programming Note
The xxblendvw instruction is commonly used for conditional blending of word elements from two source vectors based on a control vector. Ensure that the VSX (Vector Scalar Extensions) are enabled in the MSR register to avoid exceptions. This instruction operates on 16-word elements, so alignment and ordering of input registers must be correct to prevent data corruption or incorrect results.