From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25886 invoked by alias); 7 Nov 2011 15:38:34 -0000 Received: (qmail 25877 invoked by uid 22791); 7 Nov 2011 15:38:33 -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-yw0-f47.google.com (HELO mail-yw0-f47.google.com) (209.85.213.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 07 Nov 2011 15:37:53 +0000 Received: by ywf9 with SMTP id 9so5941223ywf.20 for ; Mon, 07 Nov 2011 07:37:52 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.83.81 with SMTP id p57mr11368139yhe.97.1320680272371; Mon, 07 Nov 2011 07:37:52 -0800 (PST) Received: by 10.147.114.16 with HTTP; Mon, 7 Nov 2011 07:37:52 -0800 (PST) In-Reply-To: <20111104132231.GN1052@tyan-ft48-01.lab.bos.redhat.com> References: <20111102201829.GT1052@tyan-ft48-01.lab.bos.redhat.com> <20111104102525.GH1052@tyan-ft48-01.lab.bos.redhat.com> <20111104132231.GN1052@tyan-ft48-01.lab.bos.redhat.com> Date: Mon, 07 Nov 2011 15:49:00 -0000 Message-ID: Subject: Re: [PATCH] Gather vectorization (PR tree-optimization/50789, take 2) From: Uros Bizjak To: Jakub Jelinek Cc: Richard Guenther , Ira Rosen , Richard Henderson , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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-11/txt/msg00961.txt.bz2 On Fri, Nov 4, 2011 at 2:22 PM, Jakub Jelinek wrote: > On Fri, Nov 04, 2011 at 12:21:49PM +0100, Richard Guenther wrote: >> Ok. =A0I guess it's ok to use builtins for now - I didn't think of >> the memory reference issue ;) > > Based on IRC discussion I'm posting an updated patch (both former > patches (base and incremental) in one). > > I'm now using expr_invariant_in_loop_p instead of chrec_contains*, > which nicely handles also the is_gimple_min_invariant case, > and I've added several comments and fixed the MEM_REF offset > folding. =A0Smoke tested on the *gather* testcases, will do full > bootstrap/regtest soon. > > 2011-11-04 =A0Jakub Jelinek =A0 > > =A0 =A0 =A0 =A0PR tree-optimization/50789 > =A0 =A0 =A0 =A0* tree-vect-stmts.c (process_use): Add force argument, avo= id > =A0 =A0 =A0 =A0exist_non_indexing_operands_for_use_p check if true. > =A0 =A0 =A0 =A0(vect_mark_stmts_to_be_vectorized): Adjust callers. =A0Han= dle > =A0 =A0 =A0 =A0STMT_VINFO_GATHER_P. > =A0 =A0 =A0 =A0(gen_perm_mask): New function. > =A0 =A0 =A0 =A0(perm_mask_for_reverse): Use it. > =A0 =A0 =A0 =A0(reverse_vec_element): Rename to... > =A0 =A0 =A0 =A0(permute_vec_elements): ... this. =A0Add Y and MASK_VEC ar= guments, > =A0 =A0 =A0 =A0generalize for any permutations. > =A0 =A0 =A0 =A0(vectorizable_load): Adjust caller. =A0Handle STMT_VINFO_G= ATHER_P. > =A0 =A0 =A0 =A0* target.def (TARGET_VECTORIZE_BUILTIN_GATHER): New hook. > =A0 =A0 =A0 =A0* doc/tm.texi.in (TARGET_VECTORIZE_BUILTIN_GATHER): Docume= nt it. > =A0 =A0 =A0 =A0* doc/tm.texi: Regenerate. > =A0 =A0 =A0 =A0* tree-data-ref.c (initialize_data_dependence_relation, > =A0 =A0 =A0 =A0compute_self_dependence): No longer static. > =A0 =A0 =A0 =A0* tree-data-ref.h (initialize_data_dependence_relation, > =A0 =A0 =A0 =A0compute_self_dependence): New prototypes. > =A0 =A0 =A0 =A0* tree-vect-data-refs.c (vect_check_gather): New function. > =A0 =A0 =A0 =A0(vect_analyze_data_refs): Detect possible gather load data > =A0 =A0 =A0 =A0refs. > =A0 =A0 =A0 =A0* tree-vectorizer.h (struct _stmt_vec_info): Add gather_p = field. > =A0 =A0 =A0 =A0(STMT_VINFO_GATHER_P): Define. > =A0 =A0 =A0 =A0(vect_check_gather): New prototype. > =A0 =A0 =A0 =A0* config/i386/i386-builtin-types.def: Add types for altern= ate > =A0 =A0 =A0 =A0gather builtins. > =A0 =A0 =A0 =A0* config/i386/sse.md (AVXMODE48P_DI): Remove. > =A0 =A0 =A0 =A0(VEC_GATHER_MODE): Rename mode_attr to... > =A0 =A0 =A0 =A0(VEC_GATHER_IDXSI): ... this. > =A0 =A0 =A0 =A0(VEC_GATHER_IDXDI, VEC_GATHER_SRCDI): New mode_attrs. > =A0 =A0 =A0 =A0(avx2_gathersi, *avx2_gathersi): Use > =A0 =A0 =A0 =A0instead of . > =A0 =A0 =A0 =A0(avx2_gatherdi): Use instead of > =A0 =A0 =A0 =A0< and instead of VEC_GAT= HER_MODE > =A0 =A0 =A0 =A0on src and mask operands. > =A0 =A0 =A0 =A0(*avx2_gatherdi): Likewise. =A0Use VEC_GATHER_MODE i= terator > =A0 =A0 =A0 =A0instead of AVXMODE48P_DI. > =A0 =A0 =A0 =A0(avx2_gatherdi256, *avx2_gatherdi256): Removed. > =A0 =A0 =A0 =A0* config/i386/i386.c (enum ix86_builtins): Add > =A0 =A0 =A0 =A0IX86_BUILTIN_GATHERALTSIV4DF, IX86_BUILTIN_GATHERALTDIV8SF, > =A0 =A0 =A0 =A0IX86_BUILTIN_GATHERALTSIV4DI and IX86_BUILTIN_GATHERALTDIV= 8SI. > =A0 =A0 =A0 =A0(ix86_init_mmx_sse_builtins): Create those builtins. > =A0 =A0 =A0 =A0(ix86_expand_builtin): Handle those builtins and adjust ex= pansions > =A0 =A0 =A0 =A0of other gather builtins. > =A0 =A0 =A0 =A0(ix86_vectorize_builtin_gather): New function. > =A0 =A0 =A0 =A0(TARGET_VECTORIZE_BUILTIN_GATHER): Define. > > =A0 =A0 =A0 =A0* gcc.target/i386/avx2-gather-1.c: New test. > =A0 =A0 =A0 =A0* gcc.target/i386/avx2-gather-2.c: New test. > =A0 =A0 =A0 =A0* gcc.target/i386/avx2-gather-3.c: New test. > =A0 =A0 =A0 =A0* gcc.target/i386/avx2-gather-4.c: New test. x86 parts are also OK. Thanks, Uros.