Torbjörn Granlund <t...@gmplib.org> writes: > Unfortunately, x86 is not as easy. The subtract-with-borrow > instructions clobber all flags, making the new adcx/adox pretty > pointless. And no, there are no non-clobbering negation (or one's > complement) instructions.
I revisited the x86 docs for another reason, and noticed that the NOT (one's complement) instruction actually is documented as "Flags affected: None". If that's right, it seems one could compute s = a + b, d = a - b using something like mov (ap), s mov (bp), b mov s, d adcx b, s not b adox b, d mov s, (sp) mov d, (dp) Does that work? Looks to me like it could be pretty fast. XOR, on the other hand, clobbers more or less all flags, including both O and C. So if one needs *conditional* negation without clobbering flags, one would have to combine not and cmov. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel