From 3055f3ce13571287e98cfaa37cacc6cb8ac76890 Mon Sep 17 00:00:00 2001 From: hjl Date: Sun, 3 Oct 2010 05:39:32 +0000 Subject: Disallow negative steps in vectorizer. gcc/ 2010-10-02 H.J. Lu PR tree-optimization/45720 PR tree-optimization/45764 * tree-vect-data-refs.c (vect_analyze_data_ref_access): Don't accept backwards consecutive accesses. (vect_create_data_ref_ptr): Disallow negative steps. * tree-vect-stmts.c (vectorizable_store): Allow negative steps. (perm_mask_for_reverse): Removed. (reverse_vec_elements): Likewise. (vectorizable_load): Don't hanle negative steps. gcc/testsuite/ 2010-10-02 H.J. Lu PR tree-optimization/45720 PR tree-optimization/45764 * g++.dg/torture/pr45764.C: New. * gcc.dg/vect/pr43432.c: Xfail. * gcc.dg/vect/vect-114.c: Likewise. * gcc.dg/vect/vect-15.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164914 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-vect-data-refs.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'gcc/tree-vect-data-refs.c') diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 71825137cd7..0d1e3381738 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -2287,9 +2287,7 @@ vect_analyze_data_ref_access (struct data_reference *dr) } /* Consecutive? */ - if (!tree_int_cst_compare (step, TYPE_SIZE_UNIT (scalar_type)) - || (dr_step < 0 - && !compare_tree_int (TYPE_SIZE_UNIT (scalar_type), -dr_step))) + if (!tree_int_cst_compare (step, TYPE_SIZE_UNIT (scalar_type))) { /* Mark that it is not interleaving. */ DR_GROUP_FIRST_DR (vinfo_for_stmt (stmt)) = NULL; @@ -2972,7 +2970,6 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop, tree vptr; gimple_stmt_iterator incr_gsi; bool insert_after; - bool negative; tree indx_before_incr, indx_after_incr; gimple incr; tree step; @@ -3005,7 +3002,6 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop, *inv_p = true; else *inv_p = false; - negative = tree_int_cst_compare (step, size_zero_node) < 0; /* Create an expression for the first address accessed by this load in LOOP. */ @@ -3164,8 +3160,6 @@ vect_create_data_ref_ptr (gimple stmt, struct loop *at_loop, LOOP is zero. In this case the step here is also zero. */ if (*inv_p) step = size_zero_node; - else if (negative) - step = fold_build1 (NEGATE_EXPR, TREE_TYPE (step), step); standard_iv_increment_position (loop, &incr_gsi, &insert_after); -- cgit v1.2.1