--- /dev/null
+/* { dg-do run } */
+/* { dg-additional-options "-O3" } */
+
+int src_stride = 0;
+int dst_stride = 0;
+
+int main() {
+ char src[12] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
+ char dst[16];
+ char *s = src;
+ char *d = dst;
+ for (int i = 0; i < 2; i++) {
+ d[0] = s[0] + s[1] + s[2] + s[3] + s[4];
+ d[1] = s[1] + s[2] + s[3] + s[4] + s[5];
+ d[2] = s[2] + s[3] + s[4] + s[5] + s[6];
+ d[3] = s[3] + s[4] + s[5] + s[6] + s[7];
+ d[4] = s[4] + s[5] + s[6] + s[7] + s[8];
+ d[5] = s[5] + s[6] + s[7] + s[8] + s[9];
+ d[6] = s[6] + s[7] + s[8] + s[9] + s[10];
+ d[7] = s[7] + s[8] + s[9] + s[10] + s[11];
+ s += src_stride;
+ d += dst_stride;
+ }
+
+ if (d[0] != 15)
+ __builtin_abort ();
+}
}
/* Return whether if the load permutation of NODE is consecutive starting
- from index START_IDX. */
+ with value START_VAL in the first element. If START_VAL is not given
+ the first element's value is used. */
bool
-vect_load_perm_consecutive_p (slp_tree node, unsigned start_idx)
+vect_load_perm_consecutive_p (slp_tree node, unsigned start_val)
{
load_permutation_t perm = SLP_TREE_LOAD_PERMUTATION (node);
- if (!perm.exists () || perm.length () < start_idx)
+ if (!perm.exists () || !perm.length ())
return false;
- unsigned int start = perm[start_idx];
- for (unsigned int i = start_idx + 1; i < perm.length (); i++)
- if (perm[i] != start + (unsigned int)i)
+ if (start_val == UINT_MAX)
+ start_val = perm[0];
+
+ for (unsigned int i = 0; i < perm.length (); i++)
+ if (perm[i] != start_val + (unsigned int) i)
return false;
return true;
else
{
loop_vec_info loop_vinfo = as_a<loop_vec_info> (m_vinfo);
- bool this_load_permuted = !vect_load_perm_consecutive_p (node);
+ bool this_load_permuted = !vect_load_perm_consecutive_p (node, 0);
/* When this isn't a grouped access we know it's single element
and contiguous. */
if (!STMT_VINFO_GROUPED_ACCESS (SLP_TREE_SCALAR_STMTS (node)[0]))
extern tree prepare_vec_mask (loop_vec_info, tree, tree, tree,
gimple_stmt_iterator *);
extern tree vect_get_mask_load_else (int, tree);
-extern bool vect_load_perm_consecutive_p (slp_tree, unsigned = 0);
+extern bool vect_load_perm_consecutive_p (slp_tree, unsigned = UINT_MAX);
/* In tree-vect-patterns.cc. */
extern void