When to use ADOX instead of ADCX?

痞子三分冷 提交于 2019-12-10 13:44:39

问题


The only difference mentioned in the Intel instruction set reference is the usage of the overflow-flag instead of the carry-flag. When does one use ADOX instead of ADCX to perform an unsigned addition with a carry?


回答1:


ADOX can be used when you don't want to overwrite the carry flag, like you've stored something like a rotation out.

However their main usage is to accelerate big-int arithmetics because now you can do two additions with carry in parallel in conjunction with mulx

From Intel's paper 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).

Related:

What is the difference between the ADC and ADCX instructions on ia32/ia64?



来源:https://stackoverflow.com/questions/45033397/when-to-use-adox-instead-of-adcx

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!