Niels Möller <ni...@lysator.liu.se> writes: One could get rid of the absolute value by letting one of the working values be negative. Something like this, in pseudo code
b = - b while ( (sum = a + b) != 0) { if (sum > 0) a = sum; else b = sum; } [snip] That's one instruction less than the current code, but looks quite clumsy. It's annoying that bsf clobbers the carry flag. Since we can't use carry from the first addition anyway, we can use lea for that and save a mov. But then we still need a mov + add to get the carry later on; here negation works against us, since that makes the compare instruction useless. The way to improve the current code on almost any processor is by shortening the critical dependency path. reducing the insn count helps very few CPUs these days. Do you think you can shorten the dependency path? -- Torbjörn Please encrypt, key id 0xC8601622 _______________________________________________ gmp-devel mailing list gmp-devel@gmplib.org https://gmplib.org/mailman/listinfo/gmp-devel