From patchwork Fri Oct 28 18:41:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 122479 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id E87B8B6F68 for ; Sat, 29 Oct 2011 05:41:54 +1100 (EST) Received: (qmail 16072 invoked by alias); 28 Oct 2011 18:41:52 -0000 Received: (qmail 16055 invoked by uid 22791); 28 Oct 2011 18:41:51 -0000 X-SWARE-Spam-Status: No, hits=-6.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 28 Oct 2011 18:41:34 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p9SIfWIK008629 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 28 Oct 2011 14:41:32 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p9SIfVLq005421 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 28 Oct 2011 14:41:32 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p9SIfVnV012107; Fri, 28 Oct 2011 20:41:31 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p9SIfUTW012105; Fri, 28 Oct 2011 20:41:30 +0200 Date: Fri, 28 Oct 2011 20:41:30 +0200 From: Jakub Jelinek To: David Miller Cc: Richard Henderson , gcc-patches@gcc.gnu.org Subject: Re: scalar vector shift expansion problem on 64-bit Message-ID: <20111028184130.GV1052@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20111028.010554.926011603737119372.davem@davemloft.net> <4EAAD343.8070304@redhat.com> <20111028165049.GB27949@sunsite.ms.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20111028165049.GB27949@sunsite.ms.mff.cuni.cz> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list 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); + } } } }