Unsigned Integer Addition With Overflow Flag

Encoding

EncodingOperand 1Operand 2
rmModRM.reg[rw]ModRM.r/m[rw]

Description

The ADCX instruction adds the source operand, the destination operand, and the overflow flag. The result is stored in the destination operand. Only the overflow flag is affected.

This instruction is designed for use in multibyte additions such as in arbitrary precision arithmetic. The difference between this instruction and ADC (Add with Carry) is that this one allows the creation of two "carry chains" – one using OF (this one) and one using CF (ADCX (Unsigned Integer Addition with Carry Flag)).

Operation

public void ADOX(ref U32 dest, U32 src)
{
    dest += src + EFLAGS.OF;
}

public void ADOX(ref U64 dest, U64 src)
{
    dest += src + EFLAGS.OF;
}

Flags Affected

CF (carry flag)
Unmodified.
PF (parity flag)
Unmodified.
AF (auxiliary flag)
Unmodified.
ZF (zero flag)
Unmodified.
SF (sign flag)
Unmodified.
OF (overflow flag)
Set if an unsigned overflow occurs. Cleared otherwise.

Intrinsics

Exceptions

ExceptionModeCause of Exception
Real
Mode
Virtual
8086
Protected and CompatibilityLong
Mode
#UDXXXXIf the LOCK prefix is used.
#SS(0)XXXXIf a memory operand using the SS segment has an effective address that is outside the SS segment's limit.
XIf a memory operand using the SS segment is in non-canonical form.
#GP(0)XXXXIf a memory operand (using a segment other than SS) has an effective address that is outside the segment's limit.
XXIf the destination is located in a non-writable segment.
XXIf a memory operand uses a segment containing a NULL selector.
XIf a memory operand (using a segment other than SS) is in non-canonical form.
#PF(fc) XXXIf a page fault occurs.
#AC(0) XXXIf alignment checking is enabled while the current privilege level is 3 and an unaligned memory access is made.