mbox series

[MSP430,0/4] Reduce code size when performing bit shifts

Message ID 20190604140329.5c4e1629@jozef-kubuntu
Headers show
Series Reduce code size when performing bit shifts | expand

Message

Jozef Lawrynowicz June 4, 2019, 1:03 p.m. UTC
The following series of patches reduces the code size of MSP430 programs that
make use of bit shifts.
The MSP430 does not have a native instruction for shifting integers, but in
some cases the native rotate instruction can be substituted. In other cases,
assembly code in libgcc is used to emulate the shift.

Successfully regtested the changes with the GCC and G++ testsuites for
msp430-elf, in both the small and large memory models.
I've included some details about the achieved code size reduction in the
individual patch submissions.

Ok for trunk?

jozefl (4):
  Put libgcc shift functions in their own sections
  Emulate 16-bit shifts with rotate insn when src operand is originally in
    memory
  Disable performance optimal library code shifts when optimizing for size
  Implement 64-bit shifts in assembly code

 gcc/config/msp430/msp430.c                         | 13 ++++-
 gcc/config/msp430/msp430.md                        | 66 ++++++++++++++++++----
 gcc/testsuite/gcc.target/msp430/emulate-slli.c     | 15 +++++
 gcc/testsuite/gcc.target/msp430/emulate-srai.c     | 15 +++++
 gcc/testsuite/gcc.target/msp430/emulate-srli.c     | 15 +++++
 gcc/testsuite/gcc.target/msp430/mspabi_sllll.c     | 10 ++++
 gcc/testsuite/gcc.target/msp430/mspabi_srall.c     | 10 ++++
 gcc/testsuite/gcc.target/msp430/mspabi_srlll.c     | 10 ++++
 .../gcc.target/msp430/size-optimized-shifts.c      | 26 +++++++++
 libgcc/config/msp430/slli.S                        | 41 +++++++++++++-
 libgcc/config/msp430/srai.S                        | 42 +++++++++++++-
 libgcc/config/msp430/srli.S                        | 43 +++++++++++++-
 12 files changed, 286 insertions(+), 20 deletions(-)