Message ID | 7df58e7242a5b4b86f36beba93e4b10d31cbb18f.1444999379.git.segher@kernel.crashing.org |
---|---|
State | New |
Headers | show |
On 10/16/2015 02:53 PM, Segher Boessenkool wrote: > For x86, STC still gives better results for optimise-for-size than > "simple" does. So use STC at -Os as well. For how many targets is this true, and for the others, what is the biggest win from "simple"? If the list of targets which get patches such as this one is too large, maybe we ought to admit defeat on the "simple" algorithm and revert it. Bernd
On Fri, Oct 16, 2015 at 02:55:54PM +0200, Bernd Schmidt wrote: > On 10/16/2015 02:53 PM, Segher Boessenkool wrote: > >For x86, STC still gives better results for optimise-for-size than > >"simple" does. So use STC at -Os as well. > > For how many targets is this true, and for the others, what is the > biggest win from "simple"? See <http://gcc.gnu.org/ml/gcc-patches/2015-10/msg00882.html>. Of the targets I could test there, only x86 and mn10300 like STC better. My theory is that is because they have a smaller encoding for very short branches. Simple is about half a percent smaller on most targets. > If the list of targets which get patches such > as this one is too large, maybe we ought to admit defeat on the "simple" > algorithm and revert it. (Revert it for -Os, not -O1). Yes, but it's just these two. For everything else simple wins now. Segher
Adding x86 maintainer, ping? On Fri, Oct 16, 2015 at 05:53:41AM -0700, Segher Boessenkool wrote: > For x86, STC still gives better results for optimise-for-size than > "simple" does. So use STC at -Os as well. > > Is this okay for trunk? > > > Segher > > > 2015-10-16 Segher Boessenkool <segher@kernel.crashing.org> > > PR rtl-optimization/67864 > * common/config/i386/i386-common.c (ix86_option_optimization_table) > <OPT_freorder_blocks_algorithm_>: Use REORDER_BLOCKS_ALGORITHM_STC > at -Os and up. > > --- > gcc/common/config/i386/i386-common.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c > index 79b2472..bb9f29c 100644 > --- a/gcc/common/config/i386/i386-common.c > +++ b/gcc/common/config/i386/i386-common.c > @@ -1011,6 +1011,9 @@ static const struct default_options ix86_option_optimization_table[] = > { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 }, > /* Enable function splitting at -O2 and higher. */ > { OPT_LEVELS_2_PLUS, OPT_freorder_blocks_and_partition, NULL, 1 }, > + /* The STC algorithm produces the smallest code at -Os, for x86. */ > + { OPT_LEVELS_2_PLUS, OPT_freorder_blocks_algorithm_, NULL, > + REORDER_BLOCKS_ALGORITHM_STC }, > /* Turn off -fschedule-insns by default. It tends to make the > problem with not enough registers even worse. */ > { OPT_LEVELS_ALL, OPT_fschedule_insns, NULL, 0 }, > -- > 2.4.3
On Sat, Nov 7, 2015 at 3:34 AM, Segher Boessenkool <segher@kernel.crashing.org> wrote: > Adding x86 maintainer, ping? > > On Fri, Oct 16, 2015 at 05:53:41AM -0700, Segher Boessenkool wrote: >> For x86, STC still gives better results for optimise-for-size than >> "simple" does. So use STC at -Os as well. >> >> Is this okay for trunk? >> >> >> Segher >> >> >> 2015-10-16 Segher Boessenkool <segher@kernel.crashing.org> >> >> PR rtl-optimization/67864 >> * common/config/i386/i386-common.c (ix86_option_optimization_table) >> <OPT_freorder_blocks_algorithm_>: Use REORDER_BLOCKS_ALGORITHM_STC >> at -Os and up. OK. Thanks, Uros. >> --- >> gcc/common/config/i386/i386-common.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c >> index 79b2472..bb9f29c 100644 >> --- a/gcc/common/config/i386/i386-common.c >> +++ b/gcc/common/config/i386/i386-common.c >> @@ -1011,6 +1011,9 @@ static const struct default_options ix86_option_optimization_table[] = >> { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 }, >> /* Enable function splitting at -O2 and higher. */ >> { OPT_LEVELS_2_PLUS, OPT_freorder_blocks_and_partition, NULL, 1 }, >> + /* The STC algorithm produces the smallest code at -Os, for x86. */ >> + { OPT_LEVELS_2_PLUS, OPT_freorder_blocks_algorithm_, NULL, >> + REORDER_BLOCKS_ALGORITHM_STC }, >> /* Turn off -fschedule-insns by default. It tends to make the >> problem with not enough registers even worse. */ >> { OPT_LEVELS_ALL, OPT_fschedule_insns, NULL, 0 }, >> -- >> 2.4.3
diff --git a/gcc/common/config/i386/i386-common.c b/gcc/common/config/i386/i386-common.c index 79b2472..bb9f29c 100644 --- a/gcc/common/config/i386/i386-common.c +++ b/gcc/common/config/i386/i386-common.c @@ -1011,6 +1011,9 @@ static const struct default_options ix86_option_optimization_table[] = { OPT_LEVELS_2_PLUS, OPT_free, NULL, 1 }, /* Enable function splitting at -O2 and higher. */ { OPT_LEVELS_2_PLUS, OPT_freorder_blocks_and_partition, NULL, 1 }, + /* The STC algorithm produces the smallest code at -Os, for x86. */ + { OPT_LEVELS_2_PLUS, OPT_freorder_blocks_algorithm_, NULL, + REORDER_BLOCKS_ALGORITHM_STC }, /* Turn off -fschedule-insns by default. It tends to make the problem with not enough registers even worse. */ { OPT_LEVELS_ALL, OPT_fschedule_insns, NULL, 0 },