From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26296 invoked by alias); 29 Jun 2011 10:16:33 -0000 Received: (qmail 26288 invoked by uid 22791); 29 Jun 2011 10:16:32 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,TW_TM X-Spam-Check-By: sourceware.org Received: from mail-wy0-f175.google.com (HELO mail-wy0-f175.google.com) (74.125.82.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Jun 2011 10:16:18 +0000 Received: by wyg30 with SMTP id 30so870125wyg.20 for ; Wed, 29 Jun 2011 03:16:17 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.58.71 with SMTP id f7mr528628wbh.110.1309342567372; Wed, 29 Jun 2011 03:16:07 -0700 (PDT) Received: by 10.227.36.212 with HTTP; Wed, 29 Jun 2011 03:16:07 -0700 (PDT) In-Reply-To: References: Date: Wed, 29 Jun 2011 11:29:00 -0000 Message-ID: Subject: Re: [patch, vectorizer] Handle pattern statements with multiple uses From: Richard Guenther To: Ira Rosen Cc: gcc-patches@gcc.gnu.org, Patch Tracking Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-06/txt/msg02218.txt.bz2 On Wed, Jun 29, 2011 at 8:31 AM, Ira Rosen wrote: > Hi, > > This is a follow-up patch for > http://gcc.gnu.org/ml/gcc-patches/2011-06/msg01205.html. > The previous patch added a support for widen-mult in intermediate type, e= .g.,: > > =A0 =A0 char a_t; > =A0 =A0 short a_it; > =A0 =A0 int a_T, prod_T, =A0prod_T'; > > =A0 =A0 S1 =A0a_t =3D ; > =A0 =A0 S3 =A0a_T =3D (int) a_t; > =A0 =A0 =A0 =A0 =A0 '--> a_it =3D (short) a_t; > =A0 =A0 S5 =A0prod_T =3D a_T * CONST; > =A0 =A0 =A0 =A0 =A0 '--> prod_T' =3D a_it w* CONST; > > > This way we create a patten stmt a_it =3D (short) a_t; (used in the > pattern) to replace the original a_T =3D (int) a_t;, which prevents > vectorization if there are other uses of a_T outside the pattern, > e.g., > > =A0 =A0char a_t; > =A0 =A0 short a_it; > =A0 =A0 int a_T, prod_T, =A0prod_T', x_T, y_T; > > =A0 =A0 S1 =A0a_t =3D ; > =A0 =A0 S3 =A0a_T =3D (int) a_t; > =A0 =A0 =A0 =A0 =A0 '--> a_it =3D (short) a_t; > =A0 =A0 S5 =A0prod_T =3D a_T * CONST; > =A0 =A0 =A0 =A0 =A0 '--> prod_T' =3D a_it w* CONST; > =A0 =A0 S6 x_T =3D a_T + y_T; > > Here the addition (S6) should be performed on int and use the original > definition. > Currently the vectorization fails on the type check of this statement. > > This patch adds a support of such cases: we mark the original > statement as relevant for vectorization (and not only its related > pattern statement) and handle both the original and pattern statements > in the analysis and the transformation. > > Bootstrapped and tested on powerpc64-suse-linux. > Comments are welcome. Looks reasonable to me. Thanks, Richard. > Thanks, > Ira > > ChangeLog: > > =A0 * tree-vect-loop.c (vect_determine_vectorization_factor): Handle > =A0 both pattern and original statements if necessary. > =A0 (vect_transform_loop): Likewise. > =A0 =A0* tree-vect-patterns.c (vect_pattern_recog): Update documentation. > =A0 =A0* tree-vect-stmts.c (vect_mark_relevant): Add new argument. > =A0 Mark the pattern statement only if the original statement doesn't > =A0 have its own uses. > =A0 (process_use): Call vect_mark_relevant with additional parameter. > =A0 (vect_mark_stmts_to_be_vectorized): Likewise. > =A0 (vect_get_vec_def_for_operand): Use vectorized pattern statement. > =A0 (vect_analyze_stmt): Handle both pattern and original statements > =A0 if necessary. > =A0 (vect_transform_stmt): Don't store vectorized pattern statement > =A0 in the original statement. > =A0 (vect_is_simple_use_1): Use related pattern statement only if the > =A0 original statement is irrelevant. > =A0 * tree-vect-slp.c (vect_get_and_check_slp_defs): Likewise. > > testsuite/ChangeLog: > =A0 * gcc.dg/vect/slp-widen-mult-half.c: New test. > =A0 * gcc.dg/vect/vect-widen-mult-half.c: New test. >