From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24359 invoked by alias); 5 Oct 2011 08:40:36 -0000 Received: (qmail 24340 invoked by uid 22791); 5 Oct 2011 08:40:34 -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 X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 05 Oct 2011 08:40:20 +0000 Received: by yxj17 with SMTP id 17so1529877yxj.20 for ; Wed, 05 Oct 2011 01:40:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.150.131.2 with SMTP id e2mr2138134ybd.10.1317804019766; Wed, 05 Oct 2011 01:40:19 -0700 (PDT) Received: by 10.151.9.9 with HTTP; Wed, 5 Oct 2011 01:40:19 -0700 (PDT) In-Reply-To: References: Date: Wed, 05 Oct 2011 08:40:00 -0000 Message-ID: Subject: Re: New warning for expanded vector operations From: Richard Guenther To: Artem Shinkarov Cc: GCC Patches 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-10/txt/msg00305.txt.bz2 On Wed, Oct 5, 2011 at 12:18 AM, Artem Shinkarov wrote: > Hi > > Here is a patch to inform a programmer about the expanded vector operatio= n. > Bootstrapped on x86-unknown-linux-gnu. > > ChangeLog: > > =A0 =A0 =A0 =A0* gcc/tree-vect-generic.c (expand_vector_piecewise): Adjus= t to > =A0 =A0 =A0 =A0 =A0produce the warning. > =A0 =A0 =A0 =A0 =A0(expand_vector_parallel): Adjust to produce the warnin= g. Entries start without gcc/, they are relative to the gcc/ChangeLog file. > =A0 =A0 =A0 =A0 =A0(lower_vec_shuffle): Adjust to produce the warning. > =A0 =A0 =A0 =A0* gcc/common.opt: New warning Wvector-operation-expanded. > =A0 =A0 =A0 =A0* gcc/doc/invoke.texi: Document the wawning. > > > Ok? I don't like the name -Wvector-operation-expanded. We emit a similar warning for missed inline expansions with -Winline, so maybe -Wvector-extensions (that's the name that appears in the C extension documentation). + location_t loc =3D gimple_location (gsi_stmt (*gsi)); + + warning_at (loc, OPT_Wvector_operation_expanded, + "vector operation will be expanded piecewise"); v =3D VEC_alloc(constructor_elt, gc, (nunits + delta - 1) / delta); for (i =3D 0; i < nunits; @@ -260,6 +264,10 @@ expand_vector_parallel (gimple_stmt_iter tree result, compute_type; enum machine_mode mode; int n_words =3D tree_low_cst (TYPE_SIZE_UNIT (type), 1) / UNITS_PER_WORD; + location_t loc =3D gimple_location (gsi_stmt (*gsi)); + + warning_at (loc, OPT_Wvector_operation_expanded, + "vector operation will be expanded in parallel"); what's the difference between 'piecewise' and 'in parallel'? @@ -301,16 +309,15 @@ expand_vector_addition (gimple_stmt_iter { int parts_per_word =3D UNITS_PER_WORD / tree_low_cst (TYPE_SIZE_UNIT (TREE_TYPE (type)), 1); + location_t loc =3D gimple_location (gsi_stmt (*gsi)); if (INTEGRAL_TYPE_P (TREE_TYPE (type)) && parts_per_word >=3D 4 && TYPE_VECTOR_SUBPARTS (type) >=3D 4) - return expand_vector_parallel (gsi, f_parallel, - type, a, b, code); + return expand_vector_parallel (gsi, f_parallel, type, a, b, code); else - return expand_vector_piecewise (gsi, f, - type, TREE_TYPE (type), - a, b, code); + return expand_vector_piecewise (gsi, f, type, + TREE_TYPE (type), a, b, code); } /* Check if vector VEC consists of all the equal elements and unless i miss something loc is unused here. Please avoid random whitespace changes (just review your patch yourself before posting and revert pieces that do nothing). +@item -Wvector-operation-expanded +@opindex Wvector-operation-expanded +@opindex Wno-vector-operation-expanded +Warn if vector operation is not implemented via SIMD capabilities of the +architecture. Mainly useful for the performance tuning. I'd mention that this is for vector operations as of the C extension documented in "Vector Extensions". The vectorizer can produce some operations that will need further lowering - we probably should make sure to _not_ warn about those. Try running the vect.exp testsuite with the new warning turned on (eventually disabling SSE), like with obj/gcc> make check-gcc RUNTESTFLAGS=3D"--target_board=3Dunix/-Wvector-extensions/-mno-sse vect.exp" > P.S. It is hard to write a reasonable testcase for the patch, because > one needs to guess which architecture would expand a given vector > operation. But the patch is trivial. You can create an aritificial large vector type for example, or put a testcase under gcc.target/i386 and disable SSE. We should have a testcase for this. Thanks, Richard.