http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52091
--- Comment #7 from Ira Rosen <irar at il dot ibm.com> 2012-02-02 15:16:18 UTC --- (In reply to comment #6) > (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. > We need to check that if def_stmt is vect_double_reduction_def, the stmt itself needs to be vect_double_reduction_def. We know def_type (dt in the above patch) of def_stmt from vect_is_simple_use. We call it from all the vectorizable_* functions. We don't pass the stmt itself to vect_is_simple_use, therefore, we should either do that and perform the check in vect_is_simple_use, or check this in all the vectorizable_* (except perhaps vectorizable_reduction). I prefer to pass stmt or stmt_info to vect_is_simple_use. I can do this on Sunday. You are welcome to do this yourself. Whatever you prefer.