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.

Tested on aarch64-linux-gnu and x86_64-linux-gnu, applied as obvious.

Richard


2019-12-10  Richard Sandiford  <richard.sandif...@arm.com>

gcc/
        * tree-vect-loop.c (vectorizable_reduction): Don't use
        EXTRACT_LAST_REDUCTION for chained reductions.

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c        2019-12-06 10:31:12.558424757 +0000
+++ gcc/tree-vect-loop.c        2019-12-10 11:30:16.014189041 +0000
@@ -6196,8 +6196,9 @@ vectorizable_reduction (stmt_vec_info st
          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,

Reply via email to