From patchwork Wed Dec 7 00:01:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 129857 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 5A96B1007D5 for ; Wed, 7 Dec 2011 11:02:25 +1100 (EST) Received: (qmail 28833 invoked by alias); 7 Dec 2011 00:02:22 -0000 Received: (qmail 28822 invoked by uid 22791); 7 Dec 2011 00:02:20 -0000 X-SWARE-Spam-Status: No, hits=-7.1 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; Wed, 07 Dec 2011 00:02:02 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pB7021Uf003392 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 6 Dec 2011 19:02:01 -0500 Received: from anchor.twiddle.home (vpn-11-132.rdu.redhat.com [10.11.11.132]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pB70205x013666; Tue, 6 Dec 2011 19:02:00 -0500 Message-ID: <4EDEACF7.4010904@redhat.com> Date: Tue, 06 Dec 2011 16:01:59 -0800 From: Richard Henderson User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 MIME-Version: 1.0 To: Jakub Jelinek CC: Richard Guenther , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix up VEC_INTERLEAVE_*_EXPR folding and expansion for big endian (PR tree-optimization/51074) References: <20111122143056.GR27242@tyan-ft48-01.lab.bos.redhat.com> <20111201100734.GS27242@tyan-ft48-01.lab.bos.redhat.com> <4ED7A3FC.1000600@redhat.com> <20111201160147.GW27242@tyan-ft48-01.lab.bos.redhat.com> In-Reply-To: <20111201160147.GW27242@tyan-ft48-01.lab.bos.redhat.com> 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 12/01/2011 08:01 AM, Jakub Jelinek wrote: > Here is the vectorizer part (untested so far) + some small i386 tweaks. > This patch as is regresses code quality for powerpc/ia64/sparc/mips > (I don't think spu has vec_interleave* patterns in *.md). > > If it works out, I guess we could also zap VEC_EXTRACT_{EVEN,ODD}_EXPR > similarly. > > 2011-12-01 Jakub Jelinek > > * tree.def (VEC_INTERLEAVE_HIGH_EXPR, VEC_INTERLEAVE_LOW_EXPR): Remove. > * gimple-pretty-print.c (dump_binary_rhs): Don't handle > VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. > * expr.c (expand_expr_real_2): Likewise. > * tree-cfg.c (verify_gimple_assign_binary): Likewise. > * cfgexpand.c (expand_debug_expr): Likewise. > * tree-inline.c (estimate_operator_cost): Likewise. > * tree-pretty-print.c (dump_generic_node): Likewise. > * tree-vect-generic.c (expand_vector_operations_1): Likewise. > * fold-const.c (fold_binary_loc): Likewise. > * doc/generic.texi (VEC_INTERLEAVE_HIGH_EXPR, > VEC_INTERLEAVE_LOW_EXPR): Remove documentation. > * optabs.c (optab_for_tree_code): Don't handle > VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. > (expand_binop, init_optabs): Remove vec_interleave_high_optab > and vec_interleave_low_optab. > * genopinit.c (optabs): Likewise. > * optabs.h (OTI_vec_interleave_high, OTI_vec_interleave_low): Remove. > (vec_interleave_high_optab, vec_interleave_low_optab): Remove. > * doc/md.texi (vec_interleave_high, vec_interleave_low): Remove > documentation. > * tree-vect-stmts.c (gen_perm_mask): Renamed to... > (vect_gen_perm_mask): ... this. No longer static. > (perm_mask_for_reverse, vectorizable_load): Adjust callers. > * tree-vectorizer.h (vect_gen_perm_mask): New prototype. > * tree-vect-data-refs.c (vect_strided_store_supported): Don't try > VEC_INTERLEAVE_*_EXPR, use can_vec_perm_p instead of > can_vec_perm_for_code_p. > (vect_permute_store_chain): Generate VEC_PERM_EXPR with interleaving > masks instead of VEC_INTERLEAVE_HIGH_EXPR and VEC_INTERLEAVE_LOW_EXPR. > * config/i386/i386.c (expand_vec_perm_interleave2): If > expand_vec_perm_interleave3 would handle it, return false. > (expand_vec_perm_broadcast_1): Don't use vec_interleave_*_optab. Looks nearly ok. I had to apply the following for a signed/unsigned bootstrap werror. I'm currently testing patches for altivec and ia64 to implement vec_perm_const, recognizing the few patterns that we need. I'm not 100% sure how to test the ppc paired-single support. I'll certainly get to the other targets asap. r~ diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index b9c4cb0..23813de 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -3902,7 +3902,7 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain, gimple perm_stmt; tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt)); tree perm_mask_low, perm_mask_high; - int i; + unsigned int i, n; unsigned int j, nelt = GET_MODE_NUNITS (TYPE_MODE (vectype)); unsigned char *sel = XALLOCAVEC (unsigned char, nelt); @@ -3910,7 +3910,7 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain, *result_chain = VEC_copy (tree, heap, dr_chain); - for (i = 0; i < nelt / 2; i++) + for (i = 0, n = nelt / 2; i < n; i++) { sel[i * 2] = i; sel[i * 2 + 1] = i + nelt; @@ -3920,7 +3920,7 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain, sel[i] += nelt / 2; perm_mask_low = vect_gen_perm_mask (vectype, sel); - for (i = 0; i < exact_log2 (length); i++) + for (i = 0, n = exact_log2 (length); i < n; i++) { for (j = 0; j < length/2; j++) {