Convert Scalar Double-Precision Floating-Point Values to Scalar Single-Precision Floating-Point Values

Encoding

EncodingOperand 1Operand 2Operand 3
rmn/aModRM.reg[w]ModRM.r/m[r]
rvmn/aModRM.reg[w]VEX.vvvv[r]ModRM.r/m[r]
ervmtuple1-scalarModRM.reg[w]EVEX.vvvvv[r]ModRM.r/m[r]

Description

The (V)CVTSD2SS instruction converts a scalar double-precision floating-point value from the source operand to a scalar single-precision floating-point value. The result is stored in the destination operand.

The VEX and EVEX forms will copy bits 32..127 from the first source operand into the destination. All forms except the legacy SSE one will zero the upper (untouched) bits.

Operation

public void CVTSD2SS(SimdF32 dest, SimdF64 src)
{
    dest[0] = ConvertToF32(src[0]);
    // dest[1..] is unmodified
}

public void VCVTSD2SS_Vex(SimdF32 dest, SimdF32 src1, SimdF64 src2)
{
    dest[0] = ConvertToF32(src2[0]);
    dest[1] = src1[1];
    dest[2] = src1[2];
    dest[3] = src1[3];
    dest[4..] = 0;
}

public void VCVTSD2SS_EvexMemory(SimdF32 dest, SimdF32 src1, SimdF64 src2, KMask k)
{
    if (k[0])
        dest[0] = ConvertToF32(src2[0]);
    else if (EVEX.z)
        dest[0] = 0;
    // otherwise unchanged
    dest[1] = src1[1];
    dest[2] = src1[2];
    dest[3] = src1[3];
    dest[4..] = 0;
}

public void VCVTSD2SS_EvexRegister(SimdF32 dest, SimdF32 src1, SimdF64 src2, KMask k)
{
    if (EVEX.b)
        OverrideRoundingModeForThisInstruction(EVEX.rc);

    if (k[0])
        dest[0] = ConvertToF32(src2[0]);
    else if (EVEX.z)
        dest[0] = 0;
    // otherwise unchanged
    dest[1] = src1[1];
    dest[2] = src1[2];
    dest[3] = src1[3];
    dest[4..] = 0;
}

Intrinsics

Exceptions

SIMD Floating-Point

#XM
  • #D - Denormal operand.
  • #I - Invalid operation.
  • #O - Numeric overflow.
  • #P - Inexact result.
  • #U - Numeric underflow.

Other Exceptions

VEX Encoded Form: See Type 3 Exception Conditions.
EVEX Encoded Form: See Type E3 Exception Conditions.