From WikiChip
x86/adx
< x86
Revision as of 18:25, 22 October 2018 by 217.253.228.16 (talk) (Created page with "The ADX instruction extension contains the instructions * ADCX * ADOX They are similar to the ADC instruction by doing a add with overflow, but * ADCX uses the Carry flag as s...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The ADX instruction extension contains the instructions

  • ADCX
  • ADOX

They are similar to the ADC instruction by doing a add with overflow, but

  • ADCX uses the Carry flag as source and destination of overflow and leaves the other flags untouched
  • ADOX uses the Overflow flag as source and destination of overflow and leaves the other flags untouched

This allowes two parallel addition of multi precision numbers, because both have their separate carry flag.

Note:

  • To add a constant to an register without effecting flags, you can use the LEA reg, [reg + n] instruction

   xor  rax, rax
lbl:
   mov  rbx, [r8 + r15]
   adcx rbx, [r9 + r15]
   mov  [r9 + r15], rbx
   mov  rbx, [r10 + r15]
   adox rbx, [r11 + r15]
   mov  [r11 + r15], rbx
   lea  r15, [r15 + 8]
   dec  r14
   jnz  lbl