From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7574 invoked by alias); 22 Sep 2004 19:35:51 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 7567 invoked from network); 22 Sep 2004 19:35:50 -0000 Received: from unknown (HELO mail-out4.apple.com) (17.254.13.23) by sourceware.org with SMTP; 22 Sep 2004 19:35:50 -0000 Received: from mailgate2.apple.com (a17-128-100-204.apple.com [17.128.100.204]) by mail-out4.apple.com (8.12.11/8.12.11) with ESMTP id i8MJcwUQ026555 for ; Wed, 22 Sep 2004 12:38:58 -0700 (PDT) Received: from relay2.apple.com (relay2.apple.com) by mailgate2.apple.com (Content Technologies SMTPRS 4.3.14) with ESMTP id ; Wed, 22 Sep 2004 12:35:50 -0700 Received: from [17.201.26.144] (il0102b-dhcp94.apple.com [17.201.26.144]) by relay2.apple.com (8.12.11/8.12.11) with ESMTP id i8MJZl6O008455; Wed, 22 Sep 2004 12:35:48 -0700 (PDT) In-Reply-To: <20040921214329.GB32068@redhat.com> References: <498C85A6-0800-11D9-A562-000393A91CAA@apple.com> <20040921214329.GB32068@redhat.com> Mime-Version: 1.0 (Apple Message framework v669) Content-Type: multipart/mixed; boundary=Apple-Mail-1--537053505 Message-Id: <9A02536A-0CCE-11D9-9D86-000393A91CAA@apple.com> Cc: GCC Patches From: Devang Patel Subject: Re: [PATCH] AV - Use distance vector Date: Wed, 22 Sep 2004 19:54:00 -0000 To: Richard Henderson X-SW-Source: 2004-09/txt/msg02294.txt.bz2 --Apple-Mail-1--537053505 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 1237 On Sep 21, 2004, at 2:43 PM, Richard Henderson wrote: > On Thu, Sep 16, 2004 at 09:48:51AM -0700, Devang Patel wrote: >> + if (SUB_DISTANCE (subscript) == integer_zero_node) > > integer_zerop. > >> + else if (INT_CST_LT (vf, SUB_DISTANCE (subscript))) >> + { >> + dep_exists = false; >> + >> + if (TREE_INT_CST_LOW (vf) == TREE_INT_CST_LOW (SUB_DISTANCE >> (subscript)) >> + && TREE_INT_CST_HIGH (vf) == TREE_INT_CST_HIGH (SUB_DISTANCE >> (subscript))) > > Both can be done with one tree_int_cst_compare. How about following? Bootstrapped and tested on powerpc-darwin. I also included Dorit's feedback to check subscript for given loop depth only. ChangeLog entry is same. OK? Thanks, - Devang 2004-09-22 Devang Patel * tree-data-ref.c (compute_distance_vector): Export. * tree-data-ref.h (compute_distance_vector): Same. * tree-vectorizer.c (vect_analyze_data_ref_dependence): new parameter, loop_vinfo. Use distance vector. (vect_analyze_data_ref_dependences): Supply new parameter. (vect_analyze_loop): Analyze operations before data dependences. testsuite * gcc.dg/vect/vect-20040915-1.c: New test. --Apple-Mail-1--537053505 Content-Transfer-Encoding: 7bit Content-Type: application/octet-stream; x-unix-mode=0644; name="ifc2_fsf_mainline.2.1.diff" Content-Disposition: attachment; filename=ifc2_fsf_mainline.2.1.diff Content-length: 7814 Index: gcc/tree-data-ref.h =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.h,v retrieving revision 2.4 diff -Idpatel.pbxuser -c -3 -p -r2.4 tree-data-ref.h *** gcc/tree-data-ref.h 10 Sep 2004 15:09:38 -0000 2.4 --- gcc/tree-data-ref.h 22 Sep 2004 19:25:04 -0000 *************** struct data_dependence_relation *** 147,152 **** --- 147,153 ---- struct data_dependence_relation *initialize_data_dependence_relation (struct data_reference *, struct data_reference *); void compute_affine_dependence (struct data_dependence_relation *); + void compute_distance_vector (struct data_dependence_relation *ddr); extern void analyze_all_data_dependences (struct loops *); extern void compute_data_dependences_for_loop (unsigned, struct loop *, varray_type *, varray_type *); Index: gcc/tree-data-ref.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-data-ref.c,v retrieving revision 2.7 diff -Idpatel.pbxuser -c -3 -p -r2.7 tree-data-ref.c *** gcc/tree-data-ref.c 10 Sep 2004 15:09:38 -0000 2.7 --- gcc/tree-data-ref.c 22 Sep 2004 19:25:04 -0000 *************** init_data_ref (tree stmt, *** 598,604 **** /* When there exists a dependence relation, determine its distance vector. */ ! static void compute_distance_vector (struct data_dependence_relation *ddr) { if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE) --- 598,604 ---- /* When there exists a dependence relation, determine its distance vector. */ ! void compute_distance_vector (struct data_dependence_relation *ddr) { if (DDR_ARE_DEPENDENT (ddr) == NULL_TREE) Index: gcc/tree-vectorizer.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v retrieving revision 2.8 diff -Idpatel.pbxuser -c -3 -p -r2.8 tree-vectorizer.c *** gcc/tree-vectorizer.c 10 Sep 2004 10:44:47 -0000 2.8 --- gcc/tree-vectorizer.c 22 Sep 2004 19:25:05 -0000 *************** vect_analyze_scalar_cycles (loop_vec_inf *** 1973,1982 **** static bool vect_analyze_data_ref_dependence (struct data_reference *dra, struct data_reference *drb, ! struct loop *loop) { bool differ_p; struct data_dependence_relation *ddr; if (!array_base_name_differ_p (dra, drb, &differ_p)) { --- 2116,2131 ---- static bool vect_analyze_data_ref_dependence (struct data_reference *dra, struct data_reference *drb, ! struct loop *loop, ! loop_vec_info loop_info) { bool differ_p; struct data_dependence_relation *ddr; + unsigned int i, loop_depth = 0; + struct loop *tloop; + struct subscript *subscript; + int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_info); + tree vf = NULL_TREE; if (!array_base_name_differ_p (dra, drb, &differ_p)) { *************** vect_analyze_data_ref_dependence (struct *** 2000,2005 **** --- 2149,2166 ---- if (DDR_ARE_DEPENDENT (ddr) == chrec_known) return false; + /* Check distance vector. */ + compute_distance_vector (ddr); + vf = build_int_cst (unsigned_type_node, vectorization_factor); + + tloop = loop->outer; + for (i = 0; tloop; tloop = tloop->outer, loop_depth++); + loop_depth--; + subscript = DDR_SUBSCRIPT (ddr, loop_depth); + if (integer_zerop (SUB_DISTANCE (subscript)) + || (tree_int_cst_compare (SUB_DISTANCE (subscript), vf) == 1)) + return false; + if (vect_debug_stats (loop) || vect_debug_details (loop)) { fprintf (dump_file, *************** vect_analyze_data_ref_dependences (loop_ *** 2045,2051 **** VARRAY_GENERIC_PTR (loop_write_refs, i); struct data_reference *drb = VARRAY_GENERIC_PTR (loop_write_refs, j); ! if (vect_analyze_data_ref_dependence (dra, drb, loop)) return false; } } --- 2206,2212 ---- VARRAY_GENERIC_PTR (loop_write_refs, i); struct data_reference *drb = VARRAY_GENERIC_PTR (loop_write_refs, j); ! if (vect_analyze_data_ref_dependence (dra, drb, loop, loop_vinfo)) return false; } } *************** vect_analyze_data_ref_dependences (loop_ *** 2062,2068 **** struct data_reference *dra = VARRAY_GENERIC_PTR (loop_read_refs, i); struct data_reference *drb = VARRAY_GENERIC_PTR (loop_write_refs, j); ! if (vect_analyze_data_ref_dependence (dra, drb, loop)) return false; } } --- 2223,2229 ---- struct data_reference *dra = VARRAY_GENERIC_PTR (loop_read_refs, i); struct data_reference *drb = VARRAY_GENERIC_PTR (loop_write_refs, j); ! if (vect_analyze_data_ref_dependence (dra, drb, loop, loop_vinfo)) return false; } } *************** vect_analyze_loop (struct loop *loop) *** 3275,3327 **** } ! /* Analyze data dependences between the data-refs in the loop. ! FORNOW: fail at the first data dependence that we encounter. */ ! ok = vect_analyze_data_ref_dependences (loop_vinfo); if (!ok) { if (vect_debug_details (loop)) ! fprintf (dump_file, "bad data dependence."); destroy_loop_vec_info (loop_vinfo); return NULL; } ! /* Analyze the access patterns of the data-refs in the loop (consecutive, ! complex, etc.). FORNOW: Only handle consecutive access pattern. */ ! ok = vect_analyze_data_ref_accesses (loop_vinfo); if (!ok) { if (vect_debug_details (loop)) ! fprintf (dump_file, "bad data access."); destroy_loop_vec_info (loop_vinfo); return NULL; } ! /* Analyze the alignment of the data-refs in the loop. ! FORNOW: Only aligned accesses are handled. */ ! ! ok = vect_analyze_data_refs_alignment (loop_vinfo); if (!ok) { if (vect_debug_details (loop)) ! fprintf (dump_file, "bad data alignment."); destroy_loop_vec_info (loop_vinfo); return NULL; } ! /* Scan all the operations in the loop and make sure they are ! vectorizable. */ ! ! ok = vect_analyze_operations (loop_vinfo); if (!ok) { if (vect_debug_details (loop)) ! fprintf (dump_file, "bad operation or unsupported loop bound."); destroy_loop_vec_info (loop_vinfo); return NULL; } --- 3436,3486 ---- } ! /* Analyze the alignment of the data-refs in the loop. ! FORNOW: Only aligned accesses are handled. */ ! ok = vect_analyze_data_refs_alignment (loop_vinfo); if (!ok) { if (vect_debug_details (loop)) ! fprintf (dump_file, "bad data alignment."); destroy_loop_vec_info (loop_vinfo); return NULL; } ! /* Scan all the operations in the loop and make sure they are ! vectorizable. */ ! ok = vect_analyze_operations (loop_vinfo); if (!ok) { if (vect_debug_details (loop)) ! fprintf (dump_file, "bad operation or unsupported loop bound."); destroy_loop_vec_info (loop_vinfo); return NULL; } + /* Analyze data dependences between the data-refs in the loop. + FORNOW: fail at the first data dependence that we encounter. */ ! ok = vect_analyze_data_ref_dependences (loop_vinfo); if (!ok) { if (vect_debug_details (loop)) ! fprintf (dump_file, "bad data dependence."); destroy_loop_vec_info (loop_vinfo); return NULL; } + /* Analyze the access patterns of the data-refs in the loop (consecutive, + complex, etc.). FORNOW: Only handle consecutive access pattern. */ ! ok = vect_analyze_data_ref_accesses (loop_vinfo); if (!ok) { if (vect_debug_details (loop)) ! fprintf (dump_file, "bad data access."); destroy_loop_vec_info (loop_vinfo); return NULL; } --Apple-Mail-1--537053505 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed Content-length: 1 --Apple-Mail-1--537053505--