On 6/4/19 7:11 AM, Jozef Lawrynowicz wrote:
> This patch reduces code size by enabling the emulation of some 16-bit shift
> instructions with the native rotate instructions, when the source operand is
> in
> memory. This is achieved by forcing the source operand into a register.
>
> For the following program, the below code size reduction is observed:
> int a;
>
> int
> main (void)
> {
> a = a << 4;
> return 0;
> }
>
> With shift patch 1:
> text data bss dec hex filename
> 484 12 20 516 204 a.out
> With new patch:
> text data bss dec hex filename
> 452 12 20 484 1e4 a.out
>
> Ok for trunk?
>
>
> 0002-MSP430-Force-the-src-operand-of-a-HImode-shift-into-.patch
>
> From e609f63d49227ce385316896dde6a476f5f27db7 Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <joze...@mittosystems.com>
> Date: Mon, 13 May 2019 17:48:00 +0100
> Subject: [PATCH 2/4] MSP430: Force the src operand of a HImode shift into a
> register if it is in memory
>
> gcc/ChangeLog
>
> 2019-06-04 Jozef Lawrynowicz <joze...@mittosystems.com>
>
> * config/msp430/msp430.md (ashlhi3): Force shift src operand into a
> register if it is in memory, so the shift can be emulated with a rotate
> instruction.
> (ashrhi3): Likewise.
> (lshrhi3): Likewise.
>
> gcc/testsuite/ChangeLog
>
> 2019-06-04 Jozef Lawrynowicz <joze...@mittosystems.com>
>
> * gcc.target/msp430/emulate-slli.c: New test.
> * gcc.target/msp430/emulate-srai.c: New test.
> * gcc.target/msp430/emulate-srli.c: New test.
OK
jeff
> ---