From patchwork Fri Oct 28 18:41:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: scalar vector shift expansion problem on 64-bit Date: Fri, 28 Oct 2011 08:41:30 -0000 From: Jakub Jelinek X-Patchwork-Id: 122479 Message-Id: <20111028184130.GV1052@tyan-ft48-01.lab.bos.redhat.com> To: David Miller Cc: Richard Henderson , gcc-patches@gcc.gnu.org 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 * 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. Jakub --- 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); + } } } }