On Fri, Oct 28, 2011 at 06:50:49PM +0200, Jakub Jelinek wrote: > On Fri, Oct 28, 2011 at 09:07:31AM -0700, Richard Henderson wrote: > > I think this is the same problem as Jakub is attacking here: > > > > http://gcc.gnu.org/ml/gcc-patches/2011-10/msg02503.html > > It has been checked in already. But my patch only deals > with the vector << vector case, vector << scalar (including > vector << scalar implemented using vector << vector) supposedly still > needs fold_const somewhere if the type sizes disagree.
A wild guess, though untested, because I don't have a reproducer: 2011-10-28 Jakub Jelinek <ja...@redhat.com> * tree-vect-stmts.c (vectorizable_shift): If op1 is vect_external_def and has different type from op0, cast it to op0's type before the loop first. --- gcc/tree-vect-stmts.c.jj 2011-10-28 16:21:06.000000000 +0200 +++ gcc/tree-vect-stmts.c 2011-10-28 20:19:27.000000000 +0200 @@ -2483,6 +2483,13 @@ vectorizable_shift (gimple stmt, gimple_ dealing with vectors of short/char. */ if (dt[1] == vect_constant_def) op1 = fold_convert (TREE_TYPE (vectype), op1); + else if (!useless_type_conversion_p (TREE_TYPE (vectype), + TREE_TYPE (op1))) + { + op1 = fold_convert (TREE_TYPE (vectype), op1); + op1 = vect_init_vector (stmt, op1, TREE_TYPE (vectype), + NULL); + } } } } Jakub