何时使用 ADOX 而不是 ADCX?

When to use ADOX instead of ADCX?

Intel instruction set reference中提到的唯一区别是使用溢出标志而不是进位标志。什么时候使用 ADOX 而不是 ADCX 来执行带进位的无符号加法?

当你不想覆盖进位标志时,可以使用ADOX,就像你存储了一些旋转出来的东西。

然而,它们的主要用途是加速大整数运算,因为现在您可以结合 mulx

并行执行两个带进位的加法

来自英特尔的论文New Instructions Support Large Integer Arithmetic

ADCX/ADOX Instructions

The adcx and adox instructions are extensions of the adc instruction, designed to support two separate carry chains. They are defined as:

adcx dest/src1, src2
adox dest/src1, src2

Both instructions compute the sum of src1 and src2 plus a carry-in and generate an output sum dest and a carry-out. The difference between these two instructions is that adcx uses the CF flag for the carry in and carry out (leaving the OF flag unchanged), whereas the adox instruction uses the OF flag for the carry in and carry out (leaving the CF flag unchanged).

相关: