OSDN Git Service

Daily bump.
[pf3gnuchains/gcc-fork.git] / gcc / tree-vect-generic.c
index dc01ce7..cb64065 100644 (file)
@@ -1,5 +1,5 @@
 /* Lower vector operations to scalar operations.
-   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -471,13 +471,13 @@ expand_vector_operation (gimple_stmt_iterator *gsi, tree type, tree compute_type
                                    gimple_assign_rhs2 (assign), code);
 }
 \f
-/* Return a type for the widest vector mode whose components are of mode
-   INNER_MODE, or NULL_TREE if none is found.
-   SATP is true for saturating fixed-point types.  */
+/* Return a type for the widest vector mode whose components are of type
+   TYPE, or NULL_TREE if none is found.  */
 
 static tree
-type_for_widest_vector_mode (enum machine_mode inner_mode, optab op, int satp)
+type_for_widest_vector_mode (tree type, optab op)
 {
+  enum machine_mode inner_mode = TYPE_MODE (type);
   enum machine_mode best_mode = VOIDmode, mode;
   int best_nunits = 0;
 
@@ -503,13 +503,7 @@ type_for_widest_vector_mode (enum machine_mode inner_mode, optab op, int satp)
   if (best_mode == VOIDmode)
     return NULL_TREE;
   else
-    {
-      /* For fixed-point modes, we need to pass satp as the 2nd parameter.  */
-      if (ALL_FIXED_POINT_MODE_P (best_mode))
-       return lang_hooks.types.type_for_mode (best_mode, satp);
-
-      return lang_hooks.types.type_for_mode (best_mode, 1);
-    }
+    return build_vector_type_for_mode (type, best_mode);
 }
 
 
@@ -583,8 +577,9 @@ vector_element (gimple_stmt_iterator *gsi, tree vect, tree idx, tree *ptmpvec)
       else
         {
          tree size = TYPE_SIZE (vect_elt_type);
-          tree pos = fold_build2 (MULT_EXPR, TREE_TYPE (idx), idx, size);
-          return fold_build3 (BIT_FIELD_REF, vect_elt_type, vect, size, pos);
+         tree pos = fold_build2 (MULT_EXPR, bitsizetype, bitsize_int (index),
+                                 size);
+         return fold_build3 (BIT_FIELD_REF, vect_elt_type, vect, size, pos);
         }
     }
 
@@ -773,15 +768,6 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
       || code == VIEW_CONVERT_EXPR)
     return;
 
-  /* These are only created by the vectorizer, after having queried
-     the target support.  It's more than just looking at the optab,
-     and there's no need to do it again.  */
-  if (code == VEC_INTERLEAVE_HIGH_EXPR
-      || code == VEC_INTERLEAVE_LOW_EXPR
-      || code == VEC_EXTRACT_EVEN_EXPR
-      || code == VEC_EXTRACT_ODD_EXPR)
-    return;
-
   gcc_assert (code != CONVERT_EXPR);
 
   /* The signedness is determined from input argument.  */
@@ -796,10 +782,12 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
       || code == LROTATE_EXPR
       || code == RROTATE_EXPR)
     {
+      optab opv;
+
       /* Check whether we have vector <op> {x,x,x,x} where x
          could be a scalar variable or a constant.  Transform
          vector <op> {x,x,x,x} ==> vector <op> scalar.  */
-      if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (rhs2))))
+      if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
         {
           tree first;
           gimple def_stmt;
@@ -818,17 +806,18 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
             }
         }
 
-      if (VECTOR_MODE_P (TYPE_MODE (TREE_TYPE (rhs2))))
-        op = optab_for_tree_code (code, type, optab_vector);
+      opv = optab_for_tree_code (code, type, optab_vector);
+      if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (rhs2)))
+       op = opv;
       else
        {
           op = optab_for_tree_code (code, type, optab_scalar);
 
          /* The rtl expander will expand vector/scalar as vector/vector
             if necessary.  Don't bother converting the stmt here.  */
-         if (op == NULL
-             || optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing)
-           op = optab_for_tree_code (code, type, optab_vector);
+         if (optab_handler (op, TYPE_MODE (type)) == CODE_FOR_nothing
+             && optab_handler (opv, TYPE_MODE (type)) != CODE_FOR_nothing)
+           return;
        }
     }
   else
@@ -859,14 +848,15 @@ expand_vector_operations_1 (gimple_stmt_iterator *gsi)
 
   /* For very wide vectors, try using a smaller vector mode.  */
   compute_type = type;
-  if (TYPE_MODE (type) == BLKmode && op)
+  if (!VECTOR_MODE_P (TYPE_MODE (type)) && op)
     {
       tree vector_compute_type
-        = type_for_widest_vector_mode (TYPE_MODE (TREE_TYPE (type)), op,
-                                      TYPE_SATURATING (TREE_TYPE (type)));
+        = type_for_widest_vector_mode (TREE_TYPE (type), op);
       if (vector_compute_type != NULL_TREE
          && (TYPE_VECTOR_SUBPARTS (vector_compute_type)
-             < TYPE_VECTOR_SUBPARTS (compute_type)))
+             < TYPE_VECTOR_SUBPARTS (compute_type))
+         && (optab_handler (op, TYPE_MODE (vector_compute_type))
+             != CODE_FOR_nothing))
        compute_type = vector_compute_type;
     }