1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int } */
5 /* The GCC vectorizer generates loop versioning for the following loop
6 since there may exist aliasing between A and B. The predicate checks
7 if A may alias with B across all iterations. Then for the loop in
8 the true body, we can assert that *B is a loop invariant so that
9 we can hoist the load of *B before the loop body. */
11 void test1 (int* a
, int* b
)
14 for (i
= 0; i
< 100000; ++i
)
18 /* A test case with nested loops. The load of b[j+1] in the inner
19 loop should be hoisted. */
21 void test2 (int* a
, int* b
)
24 for (j
= 0; j
< 100000; ++j
)
25 for (i
= 0; i
< 100000; ++i
)
29 /* A test case with ifcvt transformation. */
31 void test3 (int* a
, int* b
)
34 for (i
= 0; i
< 10000; ++i
)
44 /* A test case in which the store in the loop can be moved outside
45 in the versioned loop with alias checks. Note this loop won't
48 void test4 (int* a
, int* b
)
51 for (i
= 0; i
< 100000; ++i
)
55 /* A test case in which the load and store in the loop to b
56 can be moved outside in the versioned loop with alias checks.
57 Note this loop won't be vectorized. */
59 void test5 (int* a
, int* b
)
62 for (i
= 0; i
< 100000; ++i
)
69 /* { dg-final { scan-tree-dump-times "hoist" 8 "vect" { xfail *-*-* } } } */
70 /* { dg-final { scan-tree-dump-times "hoist" 3 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */