From: Richard Sandiford Date: Tue, 10 Dec 2019 11:30:49 +0000 (+0000) Subject: Disallow EXTRACT_LAST_REDUCTION for reduction chains X-Git-Tag: misc/cutover-git~614 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ca49c831ca9c042db6cea746c21040c1ada18abb;p=thirdparty%2Fgcc.git Disallow EXTRACT_LAST_REDUCTION for reduction chains gcc.dg/vect/vect-cond-reduc-5.c was ICEing for SVE because we tried to use an extract-last reduction for a chain of COND_EXPRs. Adding support for the chained case would be too invasive for stage 3 so this patch explicitly forbids it instead. I've filed PR92884 for the possible future work. 2019-12-10 Richard Sandiford gcc/ * tree-vect-loop.c (vectorizable_reduction): Don't use EXTRACT_LAST_REDUCTION for chained reductions. From-SVN: r279161 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 21a809532218..42d141891779 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2019-12-10 Richard Sandiford + + * tree-vect-loop.c (vectorizable_reduction): Don't use + EXTRACT_LAST_REDUCTION for chained reductions. + 2019-12-10 Richard Sandiford * ipa-utils.h (get_odr_name_for_type): Check for a TYPE_DECL. diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index ddc1d83a4d30..50f1a227d4e9 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -6196,8 +6196,9 @@ vectorizable_reduction (stmt_vec_info stmt_info, slp_tree slp_node, return false; } - if (direct_internal_fn_supported_p (IFN_FOLD_EXTRACT_LAST, - vectype_in, OPTIMIZE_FOR_SPEED)) + if (reduc_chain_length == 1 + && direct_internal_fn_supported_p (IFN_FOLD_EXTRACT_LAST, + vectype_in, OPTIMIZE_FOR_SPEED)) { if (dump_enabled_p ()) dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,