On 10/23/19 11:37 AM, Jozef Lawrynowicz wrote:
> For MSP430 in some configurations, GCC will generate code for mulhisi3 by
> inserting instructions to widen each 16-bit operand before calling a library
> routine for mulsi3.
> However, there exists a hardware multiply routine to perform this widening
> multiplication, but it is only made use of at -O3 where it is inserted
> inline into program.
> 
> We can reduce code size and improve performance by always calling the mspabi
> helper function to perform this widening multiplication when hardware multiply
> is available. 
> 
> I also benchmarked the effect of using a library function for mulsidi3
> but it resulted in slower execution both with and without hardware multiply
> support. It also increased code size for a variety of programs.
> 
> Successfully regtested on trunk.
> 
> Additionally regtested msp430.exp at -O1, -O2, -O3 and -Os.
> There are tests which check each supported hardware multiply option
> executes correctly, so running at these optimization levels verifies the 
> changes
> in this patch.
> 
> Ok for trunk?
> 
> 
> 0001-MSP430-Use-mspabi-helper-function-to-perform-HImode-.patch
> 
> From 695ae0e560396034bc1fc2e9d9e601ab7b3d901b Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <joze...@mittosystems.com>
> Date: Wed, 23 Oct 2019 13:19:45 +0100
> Subject: [PATCH] MSP430: Use mspabi helper function to perform HImode widening
>  multiplication
> 
> gcc/ChangeLog:
> 
> 2019-10-23  Jozef Lawrynowicz  <joze...@mittosystems.com>
> 
>       * config/msp430/msp430.c (msp430_expand_helper): Support expansion of
>       calls to __mspabi_mpy* functions.
>       * config/msp430/msp430.md (mulhisi3): New define_expand.
>       (umulhisi3): New define_expand.
>       (*mulhisi3_inline): Use old mulhisi3 define_insn.
>       (*umulhisi3_inline): Use old umulhisi3 define_insn.
OK
jeff

Reply via email to