diff options
author | Oleg Endo <olegendo@gcc.gnu.org> | 2012-03-02 20:56:46 +0000 |
---|---|---|
committer | Oleg Endo <olegendo@gcc.gnu.org> | 2012-03-02 20:56:46 +0000 |
commit | b6a0df6c472b04fffa3a458be71ab518caa5dade (patch) | |
tree | c500e77938ee84f8b9b3be4c205131a0aceaa32a /gcc | |
parent | cd33b08fbde7a7868f902161b4caeb6a3a2b42ae (diff) | |
download | gcc-b6a0df6c472b04fffa3a458be71ab518caa5dade.zip gcc-b6a0df6c472b04fffa3a458be71ab518caa5dade.tar.gz gcc-b6a0df6c472b04fffa3a458be71ab518caa5dade.tar.bz2 |
re PR target/31640 (cache block alignment is too aggressive on sh-elf)
PR target/31640
* config/sh/sh.h (LOOP_ALIGN): Move logic to sh_loop_align.
* config/sh/sh.c: Update copyright notice dates.
(sh_loop_align): Add logic from LOOP_ALIGN. Don't disable loop
alignment for TARGET_HARD_SH4.
(sh_option_override): Reduce default function alignment. Set
loop alignment to 4 bytes when not optimizing for size.
From-SVN: r184825
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/config/sh/sh.c | 43 | ||||
-rw-r--r-- | gcc/config/sh/sh.h | 4 |
3 files changed, 45 insertions, 12 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4f82fb3..94e66c0 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2012-01-02 Oleg Endo <olegendo@gcc.gnu.org> + + PR target/31640 + * config/sh/sh.h (LOOP_ALIGN): Move logic to sh_loop_align. + * config/sh/sh.c: Update copyright notice dates. + (sh_loop_align): Add logic from LOOP_ALIGN. Don't disable loop + alignment for TARGET_HARD_SH4. + (sh_option_override): Reduce default function alignment. Set + loop alignment to 4 bytes when not optimizing for size. + 2012-03-02 Maxim Kuvyrkov <maxim@codesourcery.com> PR middle-end/50335 diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 1077180..901a5a2 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -1,6 +1,6 @@ /* Output routines for GCC for Renesas / SuperH SH. Copyright (C) 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, - 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 + 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc. Contributed by Steve Chamberlain (sac@cygnus.com). Improved by Jim Wilson (wilson@cygnus.com). @@ -816,20 +816,42 @@ sh_option_override (void) } } + /* Adjust loop, jump and function alignment values (in bytes), if those + were not specified by the user using -falign-loops, -falign-jumps + and -falign-functions options. + 32 bit alignment is better for speed, because instructions can be + fetched as a pair from a longword boundary. For size use 16 bit + alignment to get more compact code. + Aligning all jumps increases the code size, even if it might + result in slightly faster code. Thus, it is set to the smallest + alignment possible if not specified by the user. */ if (align_loops == 0) - align_loops = 1 << (TARGET_SH5 ? 3 : 2); + { + if (TARGET_SH5) + align_loops = 8; + else + align_loops = optimize_size ? 2 : 4; + } + if (align_jumps == 0) - align_jumps = 1 << CACHE_LOG; + { + if (TARGET_SHMEDIA) + align_jumps = 1 << CACHE_LOG; + else + align_jumps = 2; + } else if (align_jumps < (TARGET_SHMEDIA ? 4 : 2)) align_jumps = TARGET_SHMEDIA ? 4 : 2; - /* Allocation boundary (in *bytes*) for the code of a function. - SH1: 32 bit alignment is faster, because instructions are always - fetched as a pair from a longword boundary. - SH2 .. SH5 : align to cache line start. */ if (align_functions == 0) - align_functions - = optimize_size ? FUNCTION_BOUNDARY/8 : (1 << CACHE_LOG); + { + if (TARGET_SHMEDIA) + align_functions = optimize_size + ? FUNCTION_BOUNDARY/8 : (1 << CACHE_LOG); + else + align_functions = optimize_size ? 2 : 4; + } + /* The linker relaxation code breaks when a function contains alignments that are larger than that at the start of a compilation unit. */ @@ -5342,6 +5364,9 @@ sh_loop_align (rtx label) { rtx next = label; + if (! optimize || optimize_size) + return 0; + do next = next_nonnote_insn (next); while (next && LABEL_P (next)); diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 10e87f8..7a2af0a 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -579,9 +579,7 @@ extern enum sh_divide_strategy_e sh_div_strategy; #define LABEL_ALIGN_AFTER_BARRIER(LABEL_AFTER_BARRIER) \ barrier_align (LABEL_AFTER_BARRIER) -#define LOOP_ALIGN(A_LABEL) \ - ((! optimize || TARGET_HARD_SH4 || optimize_size) \ - ? 0 : sh_loop_align (A_LABEL)) +#define LOOP_ALIGN(A_LABEL) sh_loop_align (A_LABEL) #define LABEL_ALIGN(A_LABEL) \ ( \ |