PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-live-slp-3.c
blob854116fa36efc12bd612385ffe19b177c1fc6813
1 /* { dg-require-effective-target vect_long } */
2 /* { dg-additional-options "-fno-tree-scev-cprop" } */
4 #include "tree-vect.h"
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)) long \
11 liveloop##RET (int n, long *x, long *y) \
12 { \
13 long n0, n1, n2, n3; \
14 int j; \
15 for (j = 0; j < n; ++j) \
16 { \
17 n0 = x[(j*4)]; \
18 n1 = x[(j*4)+1]; \
19 n2 = x[(j*4)+2]; \
20 n3 = x[(j*4)+3]; \
21 y[(j*4)] = n0 + 1; \
22 y[(j*4)+1] = n1 + 2; \
23 y[(j*4)+2] = n2 + 3; \
24 y[(j*4)+3] = n3 + 4; \
25 } \
26 return n##RET; \
29 LIVELOOP (0)
30 LIVELOOP (1)
31 LIVELOOP (2)
32 LIVELOOP (3)
33 typedef long (*FP)(int n, long *x, long *y);
34 const FP llf[]= {&liveloop0, &liveloop1, &liveloop2, &liveloop3};
36 #define MAX 153
38 int
39 main (void)
41 long a[MAX*4];
42 long b[MAX*4];
43 int i;
45 check_vect ();
47 for (i=0; i<MAX*4; i++)
49 __asm__ volatile ("");
50 a[i] = i;
53 for (i=0; i<4; i++)
55 __asm__ volatile ("");
57 int ret = llf[i] (MAX, a, b);
59 if (ret != (MAX * 4) - 4 + i)
60 abort ();
62 for (i=0; i<MAX*4; i++)
64 __asm__ volatile ("");
65 if (b[i] != i + (i%4) + 1)
66 abort ();
71 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
72 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { xfail vect_variable_length } } } */
73 /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 4 "vect" } } */