This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][ARM] optimizing _muldi3 for Thumb
The compiler already uses very efficient code to do 64-bit
multiplication in ARM mode. In the THUMB mode, the same code cannot
be generated because the required instructions are not available. So
64-bit multiplication in THUMB is done by calling libgcc, which
implements 64-bit multiplication using 32-bit operations in C. The
code is inherently not very efficient and never uses the ARM
multiplication instruction because it is compiled for THUMB.
-Doug
2008/7/23 Nathan Froyd <froydnj@codesourcery.com>:
> On Wed, Jul 23, 2008 at 10:40:37AM -0700, Doug Kwan wrote:
>> >>> This patch adds an ARM assembly implementation for _muldi3. In
>> >>> current gcc, thumb code calls the generic version in libgcc2.c and
>> >>> generated code from C is not efficient. The thumb version is 53
>> >>> instructions long. The patch implements _muldi3 in just 6 ARM
>> >>> instructions.
>
> Obviously I'm not competent to review the patch, but out of curiousity,
> why write an assembly version rather than improve the compiler?
>
> -Nathan
>