Where are the integer math functions implemented?
SRLM
Posts: 5,045
Where are the integer math functions such as division, multiplication, and modulus implemented? I assume addition and subtraction is done by hardware, but we can't do that for */%.
I have a curious timing problem that seems to depend on the particular modulus values, and I think it has to do with the implementation. In my case, I *think* that it's taking less time to do i%550 than i%549 or i%551
I have a curious timing problem that seems to depend on the particular modulus values, and I think it has to do with the implementation. In my case, I *think* that it's taking less time to do i%550 than i%549 or i%551
Comments
In the current default branch the division functions are in gcc/gcc/config/propeller/kernel.ext (they used to be in the various kernels, like crt0_lmm.s). The multiplication routine is still in the kernel. The division and modulus routines try to estimate the number of iterations required by counting the leading 0's of both the dividend and divisor. I don't think i % 550 should take any different amount of time than i %549, since both 550 and 549 have the same number of bits.
Here are the inner loops: