]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/tree-vect-patterns.c
Merge from trunk.
[thirdparty/gcc.git] / gcc / tree-vect-patterns.c
index 099880488bc41587c467f8aa1b354eb3b9d0f590..da4cc94f7b7d2ec52d99955349b44d6224cf6875 100644 (file)
@@ -24,13 +24,17 @@ along with GCC; see the file COPYING3.  If not see
 #include "tm.h"
 #include "ggc.h"
 #include "tree.h"
+#include "stor-layout.h"
 #include "target.h"
 #include "basic-block.h"
 #include "gimple-pretty-print.h"
 #include "gimple.h"
+#include "gimplify.h"
+#include "gimple-iterator.h"
 #include "gimple-ssa.h"
 #include "tree-phinodes.h"
 #include "ssa-iterators.h"
+#include "stringpool.h"
 #include "tree-ssanames.h"
 #include "cfgloop.h"
 #include "expr.h"
@@ -781,8 +785,8 @@ vect_recog_pow_pattern (vec<gimple> *stmts, tree *type_in,
   *type_out = NULL_TREE;
 
   /* Catch squaring.  */
-  if ((host_integerp (exp, 0)
-       && tree_low_cst (exp, 0) == 2)
+  if ((tree_fits_shwi_p (exp)
+       && tree_to_shwi (exp) == 2)
       || (TREE_CODE (exp) == REAL_CST
           && REAL_VALUES_EQUAL (TREE_REAL_CST (exp), dconst2)))
     {
@@ -1633,14 +1637,13 @@ vect_recog_rotate_pattern (vec<gimple> *stmts, tree *type_in, tree *type_out)
 
   if (TREE_CODE (def) == INTEGER_CST)
     {
-      if (!host_integerp (def, 1)
-         || (unsigned HOST_WIDE_INT) tree_low_cst (def, 1)
-            >= GET_MODE_PRECISION (TYPE_MODE (type))
+      if (!tree_fits_uhwi_p (def)
+         || tree_to_uhwi (def) >= GET_MODE_PRECISION (TYPE_MODE (type))
          || integer_zerop (def))
        return NULL;
       def2 = build_int_cst (stype,
                            GET_MODE_PRECISION (TYPE_MODE (type))
-                           - tree_low_cst (def, 1));
+                           - tree_to_uhwi (def));
     }
   else
     {
@@ -2063,9 +2066,8 @@ vect_recog_divmod_pattern (vec<gimple> *stmts,
       return pattern_stmt;
     }
 
-  if (!host_integerp (oprnd1, TYPE_UNSIGNED (itype))
-      || integer_zerop (oprnd1)
-      || prec > HOST_BITS_PER_WIDE_INT)
+  if (prec > HOST_BITS_PER_WIDE_INT
+      || integer_zerop (oprnd1))
     return NULL;
 
   if (!can_mult_highpart_p (TYPE_MODE (vectype), TYPE_UNSIGNED (itype)))
@@ -2077,8 +2079,8 @@ vect_recog_divmod_pattern (vec<gimple> *stmts,
     {
       unsigned HOST_WIDE_INT mh, ml;
       int pre_shift, post_shift;
-      unsigned HOST_WIDE_INT d = tree_low_cst (oprnd1, 1)
-                                & GET_MODE_MASK (TYPE_MODE (itype));
+      unsigned HOST_WIDE_INT d = (TREE_INT_CST_LOW (oprnd1)
+                                 & GET_MODE_MASK (TYPE_MODE (itype)));
       tree t1, t2, t3, t4;
 
       if (d >= ((unsigned HOST_WIDE_INT) 1 << (prec - 1)))
@@ -2194,7 +2196,7 @@ vect_recog_divmod_pattern (vec<gimple> *stmts,
     {
       unsigned HOST_WIDE_INT ml;
       int post_shift;
-      HOST_WIDE_INT d = tree_low_cst (oprnd1, 0);
+      HOST_WIDE_INT d = TREE_INT_CST_LOW (oprnd1);
       unsigned HOST_WIDE_INT abs_d;
       bool add = false;
       tree t1, t2, t3, t4;
@@ -2259,13 +2261,13 @@ vect_recog_divmod_pattern (vec<gimple> *stmts,
       else
        t3 = t2;
 
-      double_int oprnd0_min, oprnd0_max;
+      widest_int oprnd0_min, oprnd0_max;
       int msb = 1;
       if (get_range_info (oprnd0, &oprnd0_min, &oprnd0_max) == VR_RANGE)
        {
-         if (!oprnd0_min.is_negative ())
+         if (!wi::neg_p (oprnd0_min))
            msb = 0;
-         else if (oprnd0_max.is_negative ())
+         else if (wi::neg_p (oprnd0_max))
            msb = -1;
        }