2011/4/26 Nicolas Pitre nicolas.pitre@linaro.org:
On Tue, 26 Apr 2011, Michael Hope wrote:
Yip, so the compiler spots these two lines: Ndiv = target / source; Nmod = target % source;
and turns them into Ndiv, Nmod = __aeabi_uldivmod(target, source)
Why would gcc do that? All four variables involved here are of type unsigned int, no unsigned long long. Seems to me that __aeabi_uidivmod should have been used here instead.
I think we should dig into do_div, as i have reported, add a line "asm("" : "+r"(source));" before "do_div(Kpart, source);" can also avoid this optimization. So the __aeabi_uldivmod should be in do_div.
Nicolas