Commit ea0f3e87 by Xinliang David Li Committed by Xinliang David Li

Introduce -ftree-loop-vectorize option

From-SVN: r202636
parent 7fe46fbe
2013-09-16 Xinliang David Li <davidxl@google.com>
* tree-if-conv.c (main_tree_if_conversion): Check new flag.
* omp-low.c (omp_max_vf): Ditto.
(expand_omp_simd): Ditto.
* tree-vectorizer.c (vectorize_loops): Ditto.
(gate_vect_slp): Ditto.
(gate_increase_alignment): Ditto.
* tree-ssa-pre.c (inhibit_phi_insertion): Ditto.
* tree-ssa-loop.c (gate_tree_vectorize): Ditto.
(gate_tree_vectorize): Name change.
(tree_vectorize): Ditto.
(pass_vectorize::gate): Call new function.
(pass_vectorize::execute): Ditto.
opts.c: O3 default setting change.
(finish_options): Check new flag.
* doc/invoke.texi: Document new flags.
* common.opt: New flags.
2013-09-16 Andreas Schwab <schwab@linux-m68k.org> 2013-09-16 Andreas Schwab <schwab@linux-m68k.org>
* doc/tm.texi.in (Cond Exec Macros): Remove node. * doc/tm.texi.in (Cond Exec Macros): Remove node.
......
...@@ -2264,14 +2264,18 @@ Perform variable tracking and also tag variables that are uninitialized ...@@ -2264,14 +2264,18 @@ Perform variable tracking and also tag variables that are uninitialized
ftree-vectorize ftree-vectorize
Common Report Var(flag_tree_vectorize) Optimization Common Report Var(flag_tree_vectorize) Optimization
Enable loop vectorization on trees Enable vectorization on trees
ftree-vectorizer-verbose= ftree-vectorizer-verbose=
Common RejectNegative Joined UInteger Var(common_deferred_options) Defer Common RejectNegative Joined UInteger Var(common_deferred_options) Defer
-ftree-vectorizer-verbose=<number> This switch is deprecated. Use -fopt-info instead. -ftree-vectorizer-verbose=<number> This switch is deprecated. Use -fopt-info instead.
ftree-loop-vectorize
Common Report Var(flag_tree_loop_vectorize) Optimization
Enable loop vectorization on trees
ftree-slp-vectorize ftree-slp-vectorize
Common Report Var(flag_tree_slp_vectorize) Init(2) Optimization Common Report Var(flag_tree_slp_vectorize) Optimization
Enable basic block vectorization (SLP) on trees Enable basic block vectorization (SLP) on trees
fvect-cost-model fvect-cost-model
......
...@@ -419,10 +419,11 @@ Objective-C and Objective-C++ Dialects}. ...@@ -419,10 +419,11 @@ Objective-C and Objective-C++ Dialects}.
-ftree-loop-if-convert-stores -ftree-loop-im @gol -ftree-loop-if-convert-stores -ftree-loop-im @gol
-ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol -ftree-phiprop -ftree-loop-distribution -ftree-loop-distribute-patterns @gol
-ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol -ftree-loop-ivcanon -ftree-loop-linear -ftree-loop-optimize @gol
-ftree-loop-vectorize @gol
-ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol -ftree-parallelize-loops=@var{n} -ftree-pre -ftree-partial-pre -ftree-pta @gol
-ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol -ftree-reassoc -ftree-sink -ftree-slsr -ftree-sra @gol
-ftree-switch-conversion -ftree-tail-merge @gol -ftree-switch-conversion -ftree-tail-merge -ftree-ter @gol
-ftree-ter -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol -ftree-vect-loop-version -ftree-vectorize -ftree-vrp @gol
-funit-at-a-time -funroll-all-loops -funroll-loops @gol -funit-at-a-time -funroll-all-loops -funroll-loops @gol
-funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol -funsafe-loop-optimizations -funsafe-math-optimizations -funswitch-loops @gol
-fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol -fvariable-expansion-in-unroller -fvect-cost-model -fvpt -fweb @gol
...@@ -6751,8 +6752,8 @@ invoking @option{-O2} on programs that use computed gotos. ...@@ -6751,8 +6752,8 @@ invoking @option{-O2} on programs that use computed gotos.
Optimize yet more. @option{-O3} turns on all optimizations specified Optimize yet more. @option{-O3} turns on all optimizations specified
by @option{-O2} and also turns on the @option{-finline-functions}, by @option{-O2} and also turns on the @option{-finline-functions},
@option{-funswitch-loops}, @option{-fpredictive-commoning}, @option{-funswitch-loops}, @option{-fpredictive-commoning},
@option{-fgcse-after-reload}, @option{-ftree-vectorize}, @option{-fgcse-after-reload}, @option{-ftree-loop-vectorize},
@option{-fvect-cost-model}, @option{-ftree-slp-vectorize}, @option{-fvect-cost-model},
@option{-ftree-partial-pre} and @option{-fipa-cp-clone} options. @option{-ftree-partial-pre} and @option{-fipa-cp-clone} options.
@item -O0 @item -O0
...@@ -8011,8 +8012,13 @@ higher. ...@@ -8011,8 +8012,13 @@ higher.
@item -ftree-vectorize @item -ftree-vectorize
@opindex ftree-vectorize @opindex ftree-vectorize
Perform vectorization on trees. This flag enables @option{-ftree-loop-vectorize}
and @option{-ftree-slp-vectorize} if not explicitly specified.
@item -ftree-loop-vectorize
@opindex ftree-loop-vectorize
Perform loop vectorization on trees. This flag is enabled by default at Perform loop vectorization on trees. This flag is enabled by default at
@option{-O3}. @option{-O3} and when @option{-ftree-vectorize} is enabled.
@item -ftree-slp-vectorize @item -ftree-slp-vectorize
@opindex ftree-slp-vectorize @opindex ftree-slp-vectorize
......
...@@ -2305,8 +2305,9 @@ omp_max_vf (void) ...@@ -2305,8 +2305,9 @@ omp_max_vf (void)
{ {
if (!optimize if (!optimize
|| optimize_debug || optimize_debug
|| (!flag_tree_vectorize || (!flag_tree_loop_vectorize
&& global_options_set.x_flag_tree_vectorize)) && (global_options_set.x_flag_tree_loop_vectorize
|| global_options_set.x_flag_tree_vectorize)))
return 1; return 1;
int vs = targetm.vectorize.autovectorize_vector_sizes (); int vs = targetm.vectorize.autovectorize_vector_sizes ();
...@@ -5684,10 +5685,11 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd) ...@@ -5684,10 +5685,11 @@ expand_omp_simd (struct omp_region *region, struct omp_for_data *fd)
loop->simduid = OMP_CLAUSE__SIMDUID__DECL (simduid); loop->simduid = OMP_CLAUSE__SIMDUID__DECL (simduid);
cfun->has_simduid_loops = true; cfun->has_simduid_loops = true;
} }
/* If not -fno-tree-vectorize, hint that we want to vectorize /* If not -fno-tree-loop-vectorize, hint that we want to vectorize
the loop. */ the loop. */
if ((flag_tree_vectorize if ((flag_tree_loop_vectorize
|| !global_options_set.x_flag_tree_vectorize) || (!global_options_set.x_flag_tree_loop_vectorize
&& !global_options_set.x_flag_tree_vectorize))
&& loop->safelen > 1) && loop->safelen > 1)
{ {
loop->force_vect = true; loop->force_vect = true;
......
...@@ -498,7 +498,8 @@ static const struct default_options default_options_table[] = ...@@ -498,7 +498,8 @@ static const struct default_options default_options_table[] =
{ OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1 }, { OPT_LEVELS_1_PLUS_NOT_DEBUG, OPT_finline_functions_called_once, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_funswitch_loops, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_fgcse_after_reload, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_vectorize, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_ftree_loop_vectorize, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_slp_vectorize, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fvect_cost_model, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_fvect_cost_model, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_fipa_cp_clone, NULL, 1 },
{ OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 }, { OPT_LEVELS_3_PLUS, OPT_ftree_partial_pre, NULL, 1 },
...@@ -826,7 +827,8 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set, ...@@ -826,7 +827,8 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
/* Set PARAM_MAX_STORES_TO_SINK to 0 if either vectorization or if-conversion /* Set PARAM_MAX_STORES_TO_SINK to 0 if either vectorization or if-conversion
is disabled. */ is disabled. */
if (!opts->x_flag_tree_vectorize || !opts->x_flag_tree_loop_if_convert) if ((!opts->x_flag_tree_loop_vectorize && !opts->x_flag_tree_slp_vectorize)
|| !opts->x_flag_tree_loop_if_convert)
maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0, maybe_set_param_value (PARAM_MAX_STORES_TO_SINK, 0,
opts->x_param_values, opts_set->x_param_values); opts->x_param_values, opts_set->x_param_values);
...@@ -1660,8 +1662,12 @@ common_handle_option (struct gcc_options *opts, ...@@ -1660,8 +1662,12 @@ common_handle_option (struct gcc_options *opts,
opts->x_flag_unswitch_loops = value; opts->x_flag_unswitch_loops = value;
if (!opts_set->x_flag_gcse_after_reload) if (!opts_set->x_flag_gcse_after_reload)
opts->x_flag_gcse_after_reload = value; opts->x_flag_gcse_after_reload = value;
if (!opts_set->x_flag_tree_vectorize) if (!opts_set->x_flag_tree_loop_vectorize
opts->x_flag_tree_vectorize = value; && !opts_set->x_flag_tree_vectorize)
opts->x_flag_tree_loop_vectorize = value;
if (!opts_set->x_flag_tree_slp_vectorize
&& !opts_set->x_flag_tree_vectorize)
opts->x_flag_tree_slp_vectorize = value;
if (!opts_set->x_flag_vect_cost_model) if (!opts_set->x_flag_vect_cost_model)
opts->x_flag_vect_cost_model = value; opts->x_flag_vect_cost_model = value;
if (!opts_set->x_flag_tree_loop_distribute_patterns) if (!opts_set->x_flag_tree_loop_distribute_patterns)
...@@ -1691,6 +1697,12 @@ common_handle_option (struct gcc_options *opts, ...@@ -1691,6 +1697,12 @@ common_handle_option (struct gcc_options *opts,
opts->x_flag_ipa_reference = false; opts->x_flag_ipa_reference = false;
break; break;
case OPT_ftree_vectorize:
if (!opts_set->x_flag_tree_loop_vectorize)
opts->x_flag_tree_loop_vectorize = value;
if (!opts_set->x_flag_tree_slp_vectorize)
opts->x_flag_tree_slp_vectorize = value;
break;
case OPT_fshow_column: case OPT_fshow_column:
dc->show_column = value; dc->show_column = value;
break; break;
......
2013-09-16 Xinliang David Li <davidxl@google.com>
* gcc.misc-tests/help.exp: Optimizer help change.
2013-09-16 Jeff Law <law@redhat.com> 2013-09-16 Jeff Law <law@redhat.com>
* gcc.c-torture/execute/pr58419.c: New test. * gcc.c-torture/execute/pr58419.c: New test.
......
...@@ -55,11 +55,11 @@ check_for_options c "--help=target,optimizers" "" "" "" ...@@ -55,11 +55,11 @@ check_for_options c "--help=target,optimizers" "" "" ""
check_for_options c "--help=warnings,^joined,^undocumented" "" "" "" check_for_options c "--help=warnings,^joined,^undocumented" "" "" ""
check_for_options c "-Q -O2 --help=optimizers" { check_for_options c "-Q -O2 --help=optimizers" {
-O -O
-ftree-vectorize[^\n]*disabled -ftree-loop-vectorize[^\n]*disabled
} " -g " "" } " -g " ""
check_for_options c "-Q -O3 --help=optimizers" { check_for_options c "-Q -O3 --help=optimizers" {
-O -O
-ftree-vectorize[^\n]*enabled -ftree-loop-vectorize[^\n]*enabled
} " -g " "" } " -g " ""
# Try repeated --help=. # Try repeated --help=.
check_for_options c "--help=params --help=optimizers" { check_for_options c "--help=params --help=optimizers" {
......
...@@ -1789,7 +1789,7 @@ main_tree_if_conversion (void) ...@@ -1789,7 +1789,7 @@ main_tree_if_conversion (void)
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
if (flag_tree_loop_if_convert == 1 if (flag_tree_loop_if_convert == 1
|| flag_tree_loop_if_convert_stores == 1 || flag_tree_loop_if_convert_stores == 1
|| flag_tree_vectorize || flag_tree_loop_vectorize
|| loop->force_vect) || loop->force_vect)
changed |= tree_if_conversion (loop); changed |= tree_if_conversion (loop);
...@@ -1815,7 +1815,7 @@ main_tree_if_conversion (void) ...@@ -1815,7 +1815,7 @@ main_tree_if_conversion (void)
static bool static bool
gate_tree_if_conversion (void) gate_tree_if_conversion (void)
{ {
return (((flag_tree_vectorize || cfun->has_force_vect_loops) return (((flag_tree_loop_vectorize || cfun->has_force_vect_loops)
&& flag_tree_loop_if_convert != 0) && flag_tree_loop_if_convert != 0)
|| flag_tree_loop_if_convert == 1 || flag_tree_loop_if_convert == 1
|| flag_tree_loop_if_convert_stores == 1); || flag_tree_loop_if_convert_stores == 1);
......
...@@ -303,7 +303,7 @@ make_pass_predcom (gcc::context *ctxt) ...@@ -303,7 +303,7 @@ make_pass_predcom (gcc::context *ctxt)
/* Loop autovectorization. */ /* Loop autovectorization. */
static unsigned int static unsigned int
tree_vectorize (void) tree_loop_vectorize (void)
{ {
if (number_of_loops (cfun) <= 1) if (number_of_loops (cfun) <= 1)
return 0; return 0;
...@@ -312,9 +312,9 @@ tree_vectorize (void) ...@@ -312,9 +312,9 @@ tree_vectorize (void)
} }
static bool static bool
gate_tree_vectorize (void) gate_tree_loop_vectorize (void)
{ {
return flag_tree_vectorize || cfun->has_force_vect_loops; return flag_tree_loop_vectorize || cfun->has_force_vect_loops;
} }
namespace { namespace {
...@@ -342,8 +342,8 @@ public: ...@@ -342,8 +342,8 @@ public:
{} {}
/* opt_pass methods: */ /* opt_pass methods: */
bool gate () { return gate_tree_vectorize (); } bool gate () { return gate_tree_loop_vectorize (); }
unsigned int execute () { return tree_vectorize (); } unsigned int execute () { return tree_loop_vectorize (); }
}; // class pass_vectorize }; // class pass_vectorize
......
...@@ -3026,7 +3026,7 @@ inhibit_phi_insertion (basic_block bb, pre_expr expr) ...@@ -3026,7 +3026,7 @@ inhibit_phi_insertion (basic_block bb, pre_expr expr)
unsigned i; unsigned i;
/* If we aren't going to vectorize we don't inhibit anything. */ /* If we aren't going to vectorize we don't inhibit anything. */
if (!flag_tree_vectorize) if (!flag_tree_loop_vectorize)
return false; return false;
/* Otherwise we inhibit the insertion when the address of the /* Otherwise we inhibit the insertion when the address of the
......
...@@ -341,7 +341,7 @@ vectorize_loops (void) ...@@ -341,7 +341,7 @@ vectorize_loops (void)
than all previously defined loops. This fact allows us to run than all previously defined loops. This fact allows us to run
only over initial loops skipping newly generated ones. */ only over initial loops skipping newly generated ones. */
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
if ((flag_tree_vectorize && optimize_loop_nest_for_speed_p (loop)) if ((flag_tree_loop_vectorize && optimize_loop_nest_for_speed_p (loop))
|| loop->force_vect) || loop->force_vect)
{ {
loop_vec_info loop_vinfo; loop_vec_info loop_vinfo;
...@@ -486,10 +486,7 @@ execute_vect_slp (void) ...@@ -486,10 +486,7 @@ execute_vect_slp (void)
static bool static bool
gate_vect_slp (void) gate_vect_slp (void)
{ {
/* Apply SLP either if the vectorizer is on and the user didn't specify return flag_tree_slp_vectorize != 0;
whether to run SLP or not, or if the SLP flag was set by the user. */
return ((flag_tree_vectorize != 0 && flag_tree_slp_vectorize != 0)
|| flag_tree_slp_vectorize == 1);
} }
namespace { namespace {
...@@ -579,7 +576,7 @@ increase_alignment (void) ...@@ -579,7 +576,7 @@ increase_alignment (void)
static bool static bool
gate_increase_alignment (void) gate_increase_alignment (void)
{ {
return flag_section_anchors && flag_tree_vectorize; return flag_section_anchors && flag_tree_loop_vectorize;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment