http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52091
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-02
13:41:01 UTC ---
(In reply to comment #5)
> I think we should fail to vectorize D.2030_19 = prephitmp.17_21 & 65535, or
> any
> other non-phi/not vect_double_reduction_def stmt with a double reduction phi
> as
> a def_stmt.
>
> We can either check this in every vectorizable_* for every operand, like this:
> Index: tree-vect-stmts.c
> ===================================================================
> --- tree-vect-stmts.c (revision 183125)
> +++ tree-vect-stmts.c (working copy)
> @@ -3326,7 +3326,8 @@ vectorizable_operation (gimple stmt, gimple_stmt_i
>
> op0 = gimple_assign_rhs1 (stmt);
> if (!vect_is_simple_use_1 (op0, loop_vinfo, bb_vinfo,
> - &def_stmt, &def, &dt[0], &vectype))
> + &def_stmt, &def, &dt[0], &vectype)
> + || dt[0] == vect_double_reduction_def)
> {
> if (vect_print_dump_info (REPORT_DETAILS))
> fprintf (vect_dump, "use not simple.");
>
>
> or pass stmt or stmt_info to vect_is_simple_use and check it there.
Are you going to write a patch for this? Not sure how exactly would you like
it to look up.
> > OT, it is strange that we are creating a reduction for a loop which loops
> > exactly as many times as there are units in the vector, that doesn't seem
> > to be
> > profitable.
> >
>
> Right, but doesn't cost model catch this?
For simple testcases it does apparently.