If I have two large integers with thousands of digits, which instructions would be useful to multiply them? I'm assuming I will have to loop over the digits, multiply and add, like you do manual multiplication.
I don't expect any solutions here, just point me to the right instructions that would best accomplish the job. It can be any instruction from the MMX, SSE, x87 fpu etc...
mul
should do the job just fine. It is likely useful to vectorise this in which casepmuldq
will be useful. MMX and the x87 FPU will likely not be useful. - fuzadc
? See also BigInt class in C++ for a survey of some ways of doing BigInteger stuff. - Peter Cordeslibgmp
. If you want to learn how to do it yourself, still readlibgmp
documentation. It discusses the algorithms used. That's a good starting point. - Margaret Bloom