Convert Packed Double-Precision Floating-Point Values to Packed Doubleword Integers

Encoding

EncodingOperand 1Operand 2Operand 3
rmn/aModRM.reg[w]ModRM.r/m[r]
ermfullModRM.reg[w]ModRM.r/m[r]

Description

The(V)CVTPD2DQ instruction converts two, four, or eight double - precision floating - point values from the source operand into doubleword integers. The result is stored in the destination operand.

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

Operation

public void CVTPD2DQ(SimdI32 dest, SimdF64 src)
{
    dest[0] = ConvertToI32(src[0]);
    dest[1] = ConvertToI32(src[1]);
    // dest[2..] is unmodified
}

void VCVTPD2DQ_Vex(SimdI32 dest, SimdF64 src, int kl)
{
    for (int n = 0; n < kl; n++)
        dest[n] = ConvertToI32(src[n]);
    dest[kl..] = 0;
}
public void VCVTPD2DQ_Vex128(SimdI32 dest, SimdF64 src) =>
    VCVTPD2DQ_Vex(dest, src, 2);
public void VCVTPD2DQ_Vex256(SimdI32 dest, SimdF64 src) =>
    VCVTPD2DQ_Vex(dest, src, 4);

void VCVTPD2DQ_EvexMemory(SimdI32 dest, SimdF64 src, KMask k, int kl)
{
    for (int n = 0; n < kl; n++)
    {
        if (k[n])
            dest[n] = ConvertToI32(EVEX.b ? src[0] : src[n]);
        else if (EVEX.z)
            dest[n] = 0;
        // otherwise unchanged
    }
    dest[kl..] = 0;
}
public void VCVTPD2DQ_Evex128Memory(SimdI32 dest, SimdF64 src, KMask k) =>
    VCVTPD2DQ_EvexMemory(dest, src, k, 2);
public void VCVTPD2DQ_Evex256Memory(SimdI32 dest, SimdF64 src, KMask k) =>
    VCVTPD2DQ_EvexMemory(dest, src, k, 4);
public void VCVTPD2DQ_Evex512Memory(SimdI32 dest, SimdF64 src, KMask k) =>
    VCVTPD2DQ_EvexMemory(dest, src, k, 8);

void VCVTPD2DQ_EvexRegister(SimdI32 dest, SimdF64 src, KMask k, int kl)
{
    if (kl == 8 && EVEX.b)
        OverrideRoundingModeForThisInstruction(EVEX.rc);

    for (int n = 0; n < kl; n++)
    {
        if (k[n])
            dest[n] = ConvertToI32(src[n]);
        else if (EVEX.z)
            dest[n] = 0;
        // otherwise unchanged
    }
    dest[kl..] = 0;
}
public void VCVTPD2DQ_Evex128Register(SimdI32 dest, SimdF64 src, KMask k) =>
    VCVTPD2DQ_EvexRegister(dest, src, k, 2);
public void VCVTPD2DQ_Evex256Register(SimdI32 dest, SimdF64 src, KMask k) =>
    VCVTPD2DQ_EvexRegister(dest, src, k, 4);
public void VCVTPD2DQ_Evex512Register(SimdI32 dest, SimdF64 src, KMask k) =>
    VCVTPD2DQ_EvexRegister(dest, src, k, 8);

Intrinsics

Exceptions

SIMD Floating-Point

#XM
  • #I - Invalid operation.
  • #P - Inexact result.

Other Exceptions

VEX Encoded Form: See Type 2 Exception Conditions.
EVEX Encoded Form: See Type E2 Exception Conditions.

#UD
  • If VEX.vvvv is not 1111b.
  • If EVEX.vvvvv is not 11111b.