111
|
1 /* { dg-require-effective-target vect_int } */
|
|
2 /* { dg-additional-options "-fno-tree-scev-cprop" } */
|
|
3
|
|
4 #include "tree-vect.h"
|
|
5
|
|
6 /* Statement in SLP vectorization used outside the loop.
|
|
7 NOTE: SCEV disabled to ensure the live operation is not removed before
|
|
8 vectorization. */
|
|
9 #define LIVELOOP(RET) \
|
|
10 __attribute__ ((noinline)) int \
|
|
11 liveloop##RET (int n, int *x, int *y) \
|
|
12 { \
|
|
13 int n0, n1, j; \
|
|
14 for (j = 0; j < n; ++j) \
|
|
15 { \
|
|
16 n0 = x[(j*2)]; \
|
|
17 n1 = x[(j*2)+1]; \
|
|
18 y[(j*2)] = n0 + 1; \
|
|
19 y[(j*2)+1] = n1 + 2; \
|
|
20 } \
|
|
21 return n##RET; \
|
|
22 }
|
|
23
|
|
24 LIVELOOP (0)
|
|
25 LIVELOOP (1)
|
|
26 typedef int (*FP)(int n, int *x, int *y);
|
|
27 const FP llf[]= {&liveloop0, &liveloop1};
|
|
28
|
|
29 #define MAX 137
|
|
30
|
|
31 int
|
|
32 main (void)
|
|
33 {
|
|
34 int a[MAX*4];
|
|
35 int b[MAX*4];
|
|
36 int i;
|
|
37
|
|
38 check_vect ();
|
|
39
|
|
40 for (i=0; i<MAX*2; i++)
|
|
41 {
|
|
42 __asm__ volatile ("");
|
|
43 a[i] = i;
|
|
44 }
|
|
45
|
|
46 for (i=0; i<2; i++)
|
|
47 {
|
|
48 __asm__ volatile ("");
|
|
49
|
|
50 int ret = llf[i] (MAX, a, b);
|
|
51
|
|
52 if (ret != (MAX * 2) - 2 + i)
|
|
53 abort ();
|
|
54
|
|
55 for (i=0; i<MAX*2; i++)
|
|
56 {
|
|
57 __asm__ volatile ("");
|
|
58 if (b[i] != i + (i%2) + 1)
|
|
59 abort ();
|
|
60 }
|
|
61 }
|
|
62 }
|
|
63
|
|
64 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" } } */
|
|
65 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 2 "vect" } } */
|
|
66 /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 2 "vect" } } */
|