]> gcc.gnu.org Git - gcc.git/commitdiff
tree-vectorizer.c (vect_strip_conversions): New function.
authorIra Rosen <irar@il.ibm.com>
Tue, 4 Jan 2005 07:56:51 +0000 (07:56 +0000)
committerDorit Nuzman <dorit@gcc.gnu.org>
Tue, 4 Jan 2005 07:56:51 +0000 (07:56 +0000)
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

gcc/ChangeLog
gcc/tree-vectorizer.c

index d9439885c26fea192c7908f457eafa6b028f2d3e..51d5225ef6be4d008542550799bf6a6d81cd00d4 100644 (file)
@@ -1,3 +1,9 @@
+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. 
+
 2005-01-03  Daniel Berlin  <dberlin@dberlin.org>
 
        Fix PR debug/17924
index bd826d0127c659c91bc20644e3eb37c397c90f93..d2333352df6272734acd290ab3367b9b4a874990 100644 (file)
@@ -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))
        {
This page took 0.070812 seconds and 5 git commands to generate.