poly_int: TYPE_VECTOR_SUBPARTS
[platform/upstream/gcc.git] / gcc / tree-vect-data-refs.c
index 2fad890..c1005ee 100644 (file)
@@ -4772,7 +4772,7 @@ vect_permute_store_chain (vec<tree> dr_chain,
   if (length == 3)
     {
       /* vect_grouped_store_supported ensures that this is constant.  */
-      unsigned int nelt = TYPE_VECTOR_SUBPARTS (vectype);
+      unsigned int nelt = TYPE_VECTOR_SUBPARTS (vectype).to_constant ();
       unsigned int j0 = 0, j1 = 0, j2 = 0;
 
       vec_perm_builder sel (nelt, nelt, 1);
@@ -4839,7 +4839,7 @@ vect_permute_store_chain (vec<tree> dr_chain,
       gcc_assert (pow2p_hwi (length));
 
       /* The encoding has 2 interleaved stepped patterns.  */
-      unsigned int nelt = TYPE_VECTOR_SUBPARTS (vectype);
+      poly_uint64 nelt = TYPE_VECTOR_SUBPARTS (vectype);
       vec_perm_builder sel (nelt, 2, 3);
       sel.quick_grow (6);
       for (i = 0; i < 3; i++)
@@ -4851,7 +4851,7 @@ vect_permute_store_chain (vec<tree> dr_chain,
        perm_mask_high = vect_gen_perm_mask_checked (vectype, indices);
 
        for (i = 0; i < 6; i++)
-         sel[i] += nelt / 2;
+         sel[i] += exact_div (nelt, 2);
        indices.new_vector (sel, 2, nelt);
        perm_mask_low = vect_gen_perm_mask_checked (vectype, indices);
 
@@ -5174,7 +5174,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
      that leaves unused vector loads around punt - we at least create
      very sub-optimal code in that case (and blow up memory,
      see PR65518).  */
-  if (single_element_p && count > TYPE_VECTOR_SUBPARTS (vectype))
+  if (single_element_p && maybe_gt (count, TYPE_VECTOR_SUBPARTS (vectype)))
     {
       if (dump_enabled_p ())
        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
@@ -5385,7 +5385,7 @@ vect_permute_load_chain (vec<tree> dr_chain,
   if (length == 3)
     {
       /* vect_grouped_load_supported ensures that this is constant.  */
-      unsigned nelt = TYPE_VECTOR_SUBPARTS (vectype);
+      unsigned nelt = TYPE_VECTOR_SUBPARTS (vectype).to_constant ();
       unsigned int k;
 
       vec_perm_builder sel (nelt, nelt, 1);
@@ -5438,7 +5438,7 @@ vect_permute_load_chain (vec<tree> dr_chain,
       gcc_assert (pow2p_hwi (length));
 
       /* The encoding has a single stepped pattern.  */
-      unsigned int nelt = TYPE_VECTOR_SUBPARTS (vectype);
+      poly_uint64 nelt = TYPE_VECTOR_SUBPARTS (vectype);
       vec_perm_builder sel (nelt, 1, 3);
       sel.quick_grow (3);
       for (i = 0; i < 3; ++i)
@@ -5581,12 +5581,12 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
 
   tree vectype = STMT_VINFO_VECTYPE (vinfo_for_stmt (stmt));
   unsigned int i;
-  unsigned nelt = TYPE_VECTOR_SUBPARTS (vectype);
   stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
   loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
 
-  unsigned HOST_WIDE_INT vf;
-  if (!LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant (&vf))
+  unsigned HOST_WIDE_INT nelt, vf;
+  if (!TYPE_VECTOR_SUBPARTS (vectype).is_constant (&nelt)
+      || !LOOP_VINFO_VECT_FACTOR (loop_vinfo).is_constant (&vf))
     /* Not supported for variable-length vectors.  */
     return false;