Extract Quadword

Encoding

EncodingOperand 1Operand 2
miModRM.r/m[rw]imm16
mrModRM.r/m[rw]ModRM.reg[r]

Description

The EXTRQ extracts a quadword from the destination operand, and using the source operand as a control, shifts and masks the value. The resulting value is then stored in the destination operand.

Operation

public void EXTRQ_Immediate(SimdU64 dest, U16 src)
{
    byte shift = (byte)((src >> 8) & 0xFF);
    byte maskCount = (byte)(src & 0xFF);

    ulong mask = (1u << maskCount) - 1;

    dest[0] = (dest[0] >> shift) & mask;
}

public void EXTRQ_Vector(SimdU64 dest, SimdU64 src)
{
    byte shift = (byte)((src[0] >> 8) & 0xFF);
    byte maskCount = (byte)(src[0] & 0xFF);

    ulong mask = (1u << maskCount) - 1;

    dest[0] = (dest[0] >> shift) & mask;
}

Flags Affected

None.

Exceptions

SIMD Floating-Point

None.