OK, if it has been addressed or it is irrelevant:

How do I do an "add with carry" (or subtract with carry/borrow) on RISC-V (for this, of course, the addition has to set a carry flag, and the subtraction either has to set a carry or borrow flag).

This feature is very important for a high-performant implementation of arbitrary-precision arithmetic.

Yes yes that's the other widely quoted criticism of RISC-V, from a GNU MP maintainer.

At the time there was no widely-available RISC-V hardware. There is now, and earlier this year I tested it.

It turns out that the GNU MP project's own benchmark runs better on SiFive RISC-V cores than on comparable µarch Arm cores, specifically better on U74 than on A53, and better on P550 than on A72, despite (obviously) the Arm cores having carry flags and ADC instructions and the RISC-V cores not having those.

The ensuing discussion also came to a consensus that once you get to very wide cores e.g. 8+ like Apple's M1 and several upcoming RISC-V cores, carry flags are ACTIVELY BAD because they serialise the computation (even with OoO, renaming the flags register etc) while only one 64 bit A + 64 bit B + 1 bit carry-in limb computation in 18,446,744,073,709,551,616 has an actual carry-out dependency on the carry-in, so you can almost always simply add all the limbs in parallel. The carry-in only affects carry-out when A+B is exactly 0xFFFFFFFFFFFFFFFF.

Full thread here:

https://www.reddit.com/r/RISCV/comments/1jsnbdr/gnu_mp_bignu...