From patchwork Sun Apr 17 14:26:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 91560 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 25A3BB6F06 for ; Mon, 18 Apr 2011 00:26:35 +1000 (EST) Received: (qmail 6392 invoked by alias); 17 Apr 2011 14:26:34 -0000 Received: (qmail 6384 invoked by uid 22791); 17 Apr 2011 14:26:33 -0000 X-SWARE-Spam-Status: No, hits=-6.4 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, TW_TM, T_RP_MATCHES_RCVD 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; Sun, 17 Apr 2011 14:26:17 +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 p3HEQGhw004360 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 17 Apr 2011 10:26:16 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (tyan-ft48-01.lab.bos.redhat.com [10.16.42.4]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p3HEQFUD002335 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 17 Apr 2011 10:26:16 -0400 Received: from tyan-ft48-01.lab.bos.redhat.com (localhost.localdomain [127.0.0.1]) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4) with ESMTP id p3HEQFnX014565; Sun, 17 Apr 2011 16:26:15 +0200 Received: (from jakub@localhost) by tyan-ft48-01.lab.bos.redhat.com (8.14.4/8.14.4/Submit) id p3HEQEbI014564; Sun, 17 Apr 2011 16:26:14 +0200 Date: Sun, 17 Apr 2011 16:26:14 +0200 From: Jakub Jelinek To: Ira Rosen Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Fix SLP vectorization of shifts (PR tree-optimization/48616) Message-ID: <20110417142614.GW17079@tyan-ft48-01.lab.bos.redhat.com> Reply-To: Jakub Jelinek References: <20110416061623.GU17079@tyan-ft48-01.lab.bos.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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 Sun, Apr 17, 2011 at 11:30:31AM +0300, Ira Rosen wrote: > We already have this check in vect_build_slp_tree(). It didn't work for the > testcase because it doesn't take into account the type of definition. I > agree that it's better to move it here and base the vector/scalar decision > on it, but please remove the now redundant check from vect_build_slp_tree > (). I've tried to add this to my patch, unfortunately slp-36.c test then fails on both x86_64-linux and i686-linux. The problem is that during the analysis vectorizable_shift is called with NULL slp_node, but later on it is called with non-NULL: #0 vect_build_slp_tree (loop_vinfo=0x91dae60, bb_vinfo=0x0, node=0xffffcba8, group_size=2, inside_cost=0xffffcc2c, outside_cost=0xffffcc30, ncopies_for_cost=1, max_nunits=0xffffcc34, load_permutation=0xffffcc38, loads=0xffffcc3c, vectorization_factor=4) at ../../gcc/tree-vect-slp.c:428 #1 0x086f9a1f in vect_build_slp_tree (loop_vinfo=0x91dae60, bb_vinfo=0x0, node=0xffffcc28, group_size=2, inside_cost=0xffffcc2c, outside_cost=0xffffcc30, ncopies_for_cost=1, max_nunits=0xffffcc34, load_permutation=0xffffcc38, loads=0xffffcc3c, vectorization_factor=4) at ../../gcc/tree-vect-slp.c:648 #2 0x086fae4c in vect_analyze_slp_instance (loop_vinfo=0x91dae60, bb_vinfo=0x0, stmt=0xf7d97900) at ../../gcc/tree-vect-slp.c:1212 #3 0x086fbf17 in vect_analyze_slp (loop_vinfo=0x91dae60, bb_vinfo=0x0) at ../../gcc/tree-vect-slp.c:1303 #4 0x086eef7b in vect_analyze_loop_2 (loop=0xf7d00b7c) at ../../gcc/tree-vect-loop.c:1523 #5 vect_analyze_loop (loop=0xf7d00b7c) at ../../gcc/tree-vect-loop.c:1585 #0 vectorizable_shift (stmt=0xf7d88bc8, gsi=0x0, vec_stmt=0x0, slp_node=0x0) at ../../gcc/tree-vect-stmts.c:2053 #1 0x086e1679 in vect_analyze_stmt (stmt=0xf7d88bc8, need_to_vectorize=0xffffcd08 "\001", node=0x0) at ../../gcc/tree-vect-stmts.c:4719 #2 0x086ef1c9 in vect_analyze_loop_operations (loop=0xf7d00b7c) at ../../gcc/tree-vect-loop.c:1279 #3 vect_analyze_loop_2 (loop=0xf7d00b7c) at ../../gcc/tree-vect-loop.c:1536 #4 vect_analyze_loop (loop=0xf7d00b7c) at ../../gcc/tree-vect-loop.c:1585 #0 vectorizable_shift (stmt=0xf7d88bc8, gsi=0xffffcb80, vec_stmt=0xffffcb0c, slp_node=0x91dbc60) at ../../gcc/tree-vect-stmts.c:2053 #1 0x086e0dec in vect_transform_stmt (stmt=0xf7d88bc8, gsi=0xffffcb80, strided_store=0xffffcb8f "", slp_node=0x91dbc60, slp_node_instance=0x91dbd00) at ../../gcc/tree-vect-stmts.c:4813 #2 0x086f77bf in vect_schedule_slp_instance (node=Unhandled dwarf expression opcode 0xf3) at ../../gcc/tree-vect-slp.c:2494 #3 0x086f765c in vect_schedule_slp_instance (node=0x91dbc08, instance=0x91dbd00, vectorization_factor=2) at ../../gcc/tree-vect-slp.c:2431 #4 0x086fca9f in vect_schedule_slp (loop_vinfo=0x91dae60, bb_vinfo=0x0) at ../../gcc/tree-vect-slp.c:2523 #5 0x086f0687 in vect_transform_loop (loop_vinfo=0x91dae60) at ../../gcc/tree-vect-loop.c:4891 #6 0x086fd685 in vectorize_loops () at ../../gcc/tree-vectorizer.c:205 Jakub --- gcc/tree-vect-slp.c.jj 2010-12-27 10:18:14.000000000 +0100 +++ gcc/tree-vect-slp.c 2011-04-17 13:06:48.037388449 +0200 @@ -321,12 +321,10 @@ vect_build_slp_tree (loop_vec_info loop_ enum tree_code first_stmt_code = ERROR_MARK, rhs_code = ERROR_MARK; tree first_stmt_def1_type = NULL_TREE, first_stmt_def0_type = NULL_TREE; tree lhs; - bool stop_recursion = false, need_same_oprnds = false; - tree vectype, scalar_type, first_op1 = NULL_TREE; + bool stop_recursion = false; + tree vectype, scalar_type; unsigned int ncopies; optab optab; - int icode; - enum machine_mode optab_op2_mode; enum machine_mode vec_mode; tree first_stmt_const_oprnd = NULL_TREE; struct data_reference *first_dr; @@ -433,20 +431,6 @@ vect_build_slp_tree (loop_vec_info loop_ fprintf (vect_dump, "Build SLP failed: no optab."); return false; } - icode = (int) optab_handler (optab, vec_mode); - if (icode == CODE_FOR_nothing) - { - if (vect_print_dump_info (REPORT_SLP)) - fprintf (vect_dump, "Build SLP failed: " - "op not supported by target."); - return false; - } - optab_op2_mode = insn_data[icode].operand[2].mode; - if (!VECTOR_MODE_P (optab_op2_mode)) - { - need_same_oprnds = true; - first_op1 = gimple_assign_rhs2 (stmt); - } } } } @@ -472,19 +456,6 @@ vect_build_slp_tree (loop_vec_info loop_ return false; } - - if (need_same_oprnds - && !operand_equal_p (first_op1, gimple_assign_rhs2 (stmt), 0)) - { - if (vect_print_dump_info (REPORT_SLP)) - { - fprintf (vect_dump, - "Build SLP failed: different shift arguments in "); - print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM); - } - - return false; - } } /* Strided store or load. */