[PATCH][MSP430][3/4] Disable performance optimal library code shifts when optimizing for size

Jeff Law law@redhat.com
Wed Jun 5 22:22:00 GMT 2019


On 6/4/19 7:14 AM, Jozef Lawrynowicz wrote:
> This patch reduces code size by disabling the performance optimized,
> "const_variant" of shift library functions when optimization for size is
> enabled.
> 
> For the following program, the below code size reduction is observed:
>   long a;
> 
>   int
>   main (void)
>   {
>     a = a >> 4;
>     return 0;
>   }
> 
> With shift patch 2:
>    text    data     bss     dec     hex filename
>     522      12      22     556     22c a.out
> New patch:
>    text    data     bss     dec     hex filename
>     474      12      22     508     1fc a.out
> 
> Ok for trunk?
> 
> 
> 0003-MSP430-Do-not-use-the-performance-optimized-variant-.patch
> 
> From 894b6809822ba3a3a1bab3750abe29e03f2a3ad6 Mon Sep 17 00:00:00 2001
> From: Jozef Lawrynowicz <jozef.l@mittosystems.com>
> Date: Mon, 13 May 2019 17:52:19 +0100
> Subject: [PATCH 3/4] MSP430: Do not use the performance optimized variant of a
>  shift by constant amount when optimizing for size
> 
> gcc/ChangeLog
> 
> 2019-06-04  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> 
> 	* config/msp430/msp430.md (ashlhi3): Use the const_variant of shift
> 	library functions only when not optimizing for size.
> 	(ashlsi3): Likewise.
> 	(ashrhi3): Likewise.
> 	(ashrsi3): Likewise.
> 	(lshrhi3): Likewise.
> 	(lshrsi3): Likewise.
> 
> gcc/testsuite/ChangeLog
> 
> 2019-06-04  Jozef Lawrynowicz  <jozef.l@mittosystems.com>
> 
> 	* gcc.target/msp430/size-optimized-shifts.c: New test.
OK
jeff



More information about the Gcc-patches mailing list