Variable Blend Packed Double-Precision Floating-Point Values

Encoding

EncodingOperand 1Operand 2Operand 3Operand 4
rmModRM.reg[rw]ModRM.r/m[r]XMM0
rvmbModRM.reg[w]VEX.vvvv[r]ModRM.r/m[r]imm8(4..7)

Description

The (V)BLENDVPD instruction conditionally moves double-precision floating-point values from the two source operands. From the control operand, each bit, if cleared, will move from the first source operand, and, if set, will move from the second source operand. The result is stored in the destination operand.

This instruction, despite being named as if it operates on floating-point numbers, will work on 64 bit integers as well.

All forms except the legacy SSE one will zero the upper (untouched) bits.

Operation

public void BLENDVPD(SimdF64 dest, SimdF64 src)
{
    // if `XMM0.Bit[n]` is 0, `dest` will be copied into itself (i.e. nothing happens)
    if (XMM0.Bit[0])
        dest[0] = src[0];
    if (XMM0.Bit[1])
        dest[1] = src[1];
    // dest[2..] is unmodified
}

void VBLENDVPD_Vex(SimdF64 dest, SimdF64 src1, SimdF64 src2, SimdF64 mask, int kl)
{
    for (int n = 0; n < kl; n++)
        dest[n] = mask.Bit[n] ? src2[n] : src1[n];
    dest[kl..] = 0;
}
public void VBLENDVPD_Vex128(SimdF64 dest, SimdF64 src1, SimdF64 src2, SimdF64 mask) =>
    VBLENDVPD_Vex(dest, src1, src2, mask, 2);
public void VBLENDVPD_Vex256(SimdF64 dest, SimdF64 src1, SimdF64 src2, SimdF64 mask) =>
    VBLENDVPD_Vex(dest, src1, src2, mask, 4);

Intrinsics

Exceptions

SIMD Floating-Point

None.

Other Exceptions

VEX Encoded Form: See Type 4 Exception Conditions.

#UD
  • If VEX.W is not 0.