[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-libc-dev] Faster integer division
From: |
Weddington, Eric |
Subject: |
Re: [avr-libc-dev] Faster integer division |
Date: |
Sat, 8 Jun 2013 14:31:44 +0000 |
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden On
> Behalf Of Ambroz Bizjak
> Sent: Friday, June 07, 2013 8:34 PM
> To: address@hidden
> Subject: [avr-libc-dev] Faster integer division
>
> Hi!
>
> I've found 32bit integer division in gcc too slow, and I managed to
> implement division in asm that's faster than what gcc 4.8 produces at
> -O4, about 2/3 the time (but I'm not sure if any of this is due to
> inlining). The algorithm is restoring division but unrolled and
> heavily optimized. Could this get in gcc or avr-libc, wherever the
> right place is?
>
Hi Ambroz,
What's difficult is to balance different needs of different users. For the most
part, and there are always exceptions to this, most of the AVR GCC users are
interested in code size, rather than speed. They would rather see the smallest
way to do division, even if it is slower. But I also recognize that there are
definitely times where speed is the most desired.
So given that, where do you think it best for your algorithm to generated?
Should it be generated at a specific optimization level in gcc? Should it be a
specialized inline-assembly function call in avr-libc that is specifically
called by the user?
You said that it's faster than what gcc produces about 2/3 of the time, but
you're not sure if that is due to inlining. Can you do some further testing to
see if it's due to inlining? Or whether it's because your algorithm is better?
This is important to know, to see if it's worth the time and effort to get it
in gcc or avr-libc.
Thanks,
Eric