which multiplies the 32 bit %eax by the 32 bit 3435973837 (which was
put in %edx). The result of the multiplication is always stored in %edx:%eax (a total of 64 bits). So if after the multiplication %edx is right shifted by 2 bits, it will contain the initial content of %eax divided by 5.
I think the back-end, in its current state, doesn't give access to the high order bits. It only assigns a register dest to the low order bits if I'm not mistaken (the low order bits are the ones usually regarded as the "result" without overflow, I believe?). Can you confirm this, Erick?
I only know that it works for unsigned numbers. You'll have to check
what happens with negative integers.
Ok. If/when the back-end supports it, I'll implement the algorithm and check the results. It seems pretty obvious, at least, that dividing by powers of 2 using the signed right shift should work.
- Maxime