PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-live-slp-1.c
blobaff37c100f046021b7834ef0bfa399744a618dd8
1 /* { dg-require-effective-target vect_int } */
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)) int \
11 liveloop##RET (int n, int *x, int *y) \
12 { \
13 int n0, n1, n2, n3, j; \
14 for (j = 0; j < n; ++j) \
15 { \
16 n0 = x[(j*4)]; \
17 n1 = x[(j*4)+1]; \
18 n2 = x[(j*4)+2]; \
19 n3 = x[(j*4)+3]; \
20 y[(j*4)] = n0 + 1; \
21 y[(j*4)+1] = n1 + 2; \
22 y[(j*4)+2] = n2 + 3; \
23 y[(j*4)+3] = n3 + 4; \
24 } \
25 return n##RET; \
28 LIVELOOP (0)
29 LIVELOOP (1)
30 LIVELOOP (2)
31 LIVELOOP (3)
32 typedef int (*FP)(int n, int *x, int *y);
33 const FP llf[]= {&liveloop0, &liveloop1, &liveloop2, &liveloop3};
35 #define MAX 113
37 int
38 main (void)
40 int a[MAX*4];
41 int b[MAX*4];
42 int i;
44 check_vect ();
46 for (i=0; i<MAX*4; i++)
48 __asm__ volatile ("");
49 a[i] = i;
52 for (i=0; i<4; i++)
54 __asm__ volatile ("");
56 int ret = llf[i] (MAX, a, b);
58 if (ret != (MAX * 4) - 4 + i)
59 abort ();
61 for (i=0; i<MAX*4; i++)
63 __asm__ volatile ("");
64 if (b[i] != i + (i%4) + 1)
65 abort ();
70 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
71 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" } } */
72 /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 4 "vect" } } */