Microsoft DirectX 8.0 (C++)

min

Calculates the minimum of the sources.

min   vDest, vSrc0, vSrc1

Registers

vDest
Destination register, holding the result of the operation.
vSrc0
Source register, specifying the input argument.
vSrc1
Source register, specifying the input argument.

Operation

The following code fragment shows the operations performed by the min instruction to write a result to the destination.

    SetDestReg();
    SetSrcReg(0);
    SetSrcReg(1);

    m_TmpReg.x=(m_Source[0].x < m_Source[1].x) ? m_Source[0].x : m_Source[1].x;
    m_TmpReg.y=(m_Source[0].y < m_Source[1].y) ? m_Source[0].y : m_Source[1].y;
    m_TmpReg.z=(m_Source[0].z < m_Source[1].z) ? m_Source[0].z : m_Source[1].z;
    m_TmpReg.w=(m_Source[0].w < m_Source[1].w) ? m_Source[0].w : m_Source[1].w;

    WriteResult();

Remarks

The following example illustrates how the min instruction might be used.

min   r2, r3, r4