From patchwork Tue Feb 21 09:41:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 142272 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 4D6E6B6FA7 for ; Tue, 21 Feb 2012 20:41:51 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1330422112; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Cc:Subject:In-Reply-To:Message-ID:References:User-Agent: MIME-Version:Content-Type:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=kq7JeZWDJ3j1Ix57OUGF0jzvbPk=; b=eDf+FRYyn5DtoLj 50V8D7ZfzuvC0PSxMjFOLCraTccvfVPZ3XiQqVnKAHiRK69yccqtolZTIGLZdFD6 szv1+cXYJRhUJO/xFT76iipMjw7+nswbWhGoXyLLKLY23HSzzZqjaHVgCXzTM49K xZ6+YjNkMxhpAd+tWXeHfJOP+JpE= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Date:From:To:Cc:Subject:In-Reply-To:Message-ID:References:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=vXoN24VjpaLoxW93V+pPjBLs0KxUDNRryUi/wMB6BQNMabM1B15U2U6gGLTy3m VX0mYu4bBALTd2Ev9eTAS/KnuJJ+oGFOMOGtJEM4U2fpwHUMcvp0vmVQ5lsnQrCu 1DSghZiitnXIBXjLe5j0KD4VXjlD6OjNry6dtXkbaloZE=; Received: (qmail 15649 invoked by alias); 21 Feb 2012 09:41:45 -0000 Received: (qmail 15639 invoked by uid 22791); 21 Feb 2012 09:41:45 -0000 X-SWARE-Spam-Status: No, hits=-5.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 21 Feb 2012 09:41:23 +0000 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id E271690072; Tue, 21 Feb 2012 10:41:21 +0100 (CET) Date: Tue, 21 Feb 2012 10:41:21 +0100 (CET) From: Richard Guenther To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix PR52298 In-Reply-To: <20120220151846.GU18768@tyan-ft48-01.lab.bos.redhat.com> Message-ID: References: <20120220151846.GU18768@tyan-ft48-01.lab.bos.redhat.com> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 Mon, 20 Feb 2012, Jakub Jelinek wrote: > On Mon, Feb 20, 2012 at 04:11:13PM +0100, Richard Guenther wrote: > > This fixes PR52298, we need to use the proper DR step for outer > > loop vectorization. > > > > Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. > > Thanks. > > > *************** vectorizable_load (gimple stmt, gimple_s > > *** 4266,4272 **** > > if (!STMT_VINFO_DATA_REF (stmt_info)) > > return false; > > > > ! negative = tree_int_cst_compare (DR_STEP (dr), size_zero_node) < 0; > > if (negative && ncopies > 1) > > { > > if (vect_print_dump_info (REPORT_DETAILS)) > > --- 4268,4277 ---- > > if (!STMT_VINFO_DATA_REF (stmt_info)) > > return false; > > > > ! negative = tree_int_cst_compare (loop && nested_in_vect_loop_p (loop, stmt) > > ! ? STMT_VINFO_DR_STEP (stmt_info) > > ! : DR_STEP (dr), > > ! size_zero_node) < 0; > > vectorizable_loop, unlike vectorizable_store, has nested_in_vect_loop > bool flag, so you could just test that instead of > loop && nested_in_vect_loop_p (loop, stmt) above and below. Fixed as follows. Richard. 2012-02-21 Richard Guenther * tree-vect-stmts.c (vectorizable_load): Use pre-computed nested_in_vect_loop. Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c (revision 184396) +++ gcc/tree-vect-stmts.c (working copy) @@ -4268,7 +4268,7 @@ vectorizable_load (gimple stmt, gimple_s if (!STMT_VINFO_DATA_REF (stmt_info)) return false; - negative = tree_int_cst_compare (loop && nested_in_vect_loop_p (loop, stmt) + negative = tree_int_cst_compare (nested_in_vect_loop ? STMT_VINFO_DR_STEP (stmt_info) : DR_STEP (dr), size_zero_node) < 0; @@ -4658,7 +4658,7 @@ vectorizable_load (gimple stmt, gimple_s This can only occur when vectorizing memory accesses in the inner-loop nested within an outer-loop that is being vectorized. */ - if (loop && nested_in_vect_loop_p (loop, stmt) + if (nested_in_vect_loop && (TREE_INT_CST_LOW (STMT_VINFO_DR_STEP (stmt_info)) % GET_MODE_SIZE (TYPE_MODE (vectype)) != 0)) {