diff options
author | alalaw01 <alalaw01@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-27 14:20:52 +0000 |
---|---|---|
committer | alalaw01 <alalaw01@138bc75d-0d04-0410-961f-82ee72b054a4> | 2014-10-27 14:20:52 +0000 |
commit | f3d76545eefd6c4027ff1fc6b190813c286ed48a (patch) | |
tree | bcaacd0bd9927dbb5bc3f3a2660d16c40919ad1b /gcc/tree-vect-loop.c | |
parent | 7ba68b188744b2128dd590e939a92cdfc592a178 (diff) | |
download | gcc-f3d76545eefd6c4027ff1fc6b190813c286ed48a.tar.gz |
Add new optabs for reducing vectors to scalars
PR tree-optimization/61114
* doc/md.texi (Standard Names): Add reduc_(plus,[us](min|max))|scal
optabs, and note in reduc_[us](plus|min|max) to prefer the former.
* expr.c (expand_expr_real_2): Use reduc_..._scal if available, fall
back to old reduc_... + BIT_FIELD_REF only if not.
* optabs.c (optab_for_tree_code): for REDUC_(MAX,MIN,PLUS)_EXPR,
return the reduce-to-scalar (reduc_..._scal) optab.
(scalar_reduc_to_vector): New.
* optabs.def (reduc_smax_scal_optab, reduc_smin_scal_optab,
reduc_plus_scal_optab, reduc_umax_scal_optab, reduc_umin_scal_optab):
New.
* optabs.h (scalar_reduc_to_vector): Declare.
* tree-vect-loop.c (vectorizable_reduction): Look for optabs reducing
to either scalar or vector.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@216737 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index b4847ab7b76..a15ce14ef84 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -5113,15 +5113,17 @@ vectorizable_reduction (gimple stmt, gimple_stmt_iterator *gsi, epilog_reduc_code = ERROR_MARK; } - - if (reduc_optab - && optab_handler (reduc_optab, vec_mode) == CODE_FOR_nothing) + else if (optab_handler (reduc_optab, vec_mode) == CODE_FOR_nothing) { - if (dump_enabled_p ()) - dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, - "reduc op not supported by target.\n"); + optab = scalar_reduc_to_vector (reduc_optab, vectype_out); + if (optab_handler (optab, vec_mode) == CODE_FOR_nothing) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "reduc op not supported by target.\n"); - epilog_reduc_code = ERROR_MARK; + epilog_reduc_code = ERROR_MARK; + } } } else |