aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorIra Rosen <irar@il.ibm.com>2005-01-04 07:56:51 +0000
committerDorit Nuzman <dorit@gcc.gnu.org>2005-01-04 07:56:51 +0000
commit7d23434bbe5fcf17afa0f57f7cbddf985c8425cb (patch)
treef412c09bb335055c6da1ef6ff7193443453ec2a1 /gcc/tree-vectorizer.c
parent1aae12a2d9286bedfc5a8b5d6c4fc828ef5d760a (diff)
downloadgcc-7d23434bbe5fcf17afa0f57f7cbddf985c8425cb.zip
gcc-7d23434bbe5fcf17afa0f57f7cbddf985c8425cb.tar.gz
gcc-7d23434bbe5fcf17afa0f57f7cbddf985c8425cb.tar.bz2
tree-vectorizer.c (vect_strip_conversions): New function.
2005-01-03 Ira Rosen <irar@il.ibm.com> * tree-vectorizer.c (vect_strip_conversions): New function. (vect_analyze_offset_expr): Call vect_strip_conversions. Add check for binary class. From-SVN: r92888
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c59
1 files changed, 44 insertions, 15 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index bd826d0..d233335 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -230,6 +230,7 @@ static tree vect_get_memtag_and_dr
(tree, tree, bool, loop_vec_info, tree, struct data_reference **);
static bool vect_analyze_offset_expr (tree, struct loop *, tree, tree *,
tree *, tree *);
+static tree vect_strip_conversion (tree);
/* Utility functions for the code transformation. */
static tree vect_create_destination_var (tree, tree);
@@ -1339,6 +1340,32 @@ vect_get_ptr_offset (tree ref ATTRIBUTE_UNUSED,
}
+/* Function vect_strip_conversions
+
+ Strip conversions that don't narrow the mode. */
+
+static tree
+vect_strip_conversion (tree expr)
+{
+ tree to, ti, oprnd0;
+
+ while (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR)
+ {
+ to = TREE_TYPE (expr);
+ oprnd0 = TREE_OPERAND (expr, 0);
+ ti = TREE_TYPE (oprnd0);
+
+ if (!INTEGRAL_TYPE_P (to) || !INTEGRAL_TYPE_P (ti))
+ return NULL_TREE;
+ if (GET_MODE_SIZE (TYPE_MODE (to)) < GET_MODE_SIZE (TYPE_MODE (ti)))
+ return NULL_TREE;
+
+ expr = oprnd0;
+ }
+ return expr;
+}
+
+
/* Function vect_analyze_offset_expr
Given an offset expression EXPR received from get_inner_reference, analyze
@@ -1391,22 +1418,10 @@ vect_analyze_offset_expr (tree expr,
tree init, evolution, def_stmt;
/* Strip conversions that don't narrow the mode. */
- while (TREE_CODE (expr) == NOP_EXPR || TREE_CODE (expr) == CONVERT_EXPR)
- {
- tree to, ti;
-
- to = TREE_TYPE (expr);
- oprnd0 = TREE_OPERAND (expr, 0);
- ti = TREE_TYPE (oprnd0);
-
- if (!INTEGRAL_TYPE_P (to) || !INTEGRAL_TYPE_P (ti))
- return false;
- if (GET_MODE_SIZE (TYPE_MODE (to)) < GET_MODE_SIZE (TYPE_MODE (ti)))
- return false;
+ expr = vect_strip_conversion (expr);
+ if (!expr)
+ return false;
- expr = oprnd0;
- }
-
*step = NULL_TREE;
*misalign = NULL_TREE;
*initial_offset = NULL_TREE;
@@ -1463,6 +1478,16 @@ vect_analyze_offset_expr (tree expr,
}
/* Recursive computation. */
+ if (!BINARY_CLASS_P (expr))
+ {
+ /* We expect to get binary expressions (PLUS/MINUS and MULT). */
+ if (vect_debug_details (NULL))
+ {
+ fprintf (dump_file, "Not binary expression ");
+ print_generic_expr (dump_file, expr, TDF_SLIM);
+ }
+ return false;
+ }
oprnd0 = TREE_OPERAND (expr, 0);
oprnd1 = TREE_OPERAND (expr, 1);
@@ -1483,6 +1508,10 @@ vect_analyze_offset_expr (tree expr,
FORNOW: We don't support such cases. */
return false;
+ /* Strip conversions that don't narrow the mode. */
+ left_offset = vect_strip_conversion (left_offset);
+ if (!left_offset)
+ return false;
/* Misalignment computation. */
if (SSA_VAR_P (left_offset))
{