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