2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-live-slp-2.c
blob35689665b548cf6ade0c8e8e2fbd490335ce7779
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, 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; \
24 LIVELOOP (0)
25 LIVELOOP (1)
26 typedef int (*FP)(int n, int *x, int *y);
27 const FP llf[]= {&liveloop0, &liveloop1};
29 #define MAX 137
31 int
32 main (void)
34 int a[MAX*4];
35 int b[MAX*4];
36 int i;
38 check_vect ();
40 for (i=0; i<MAX*2; i++)
42 __asm__ volatile ("");
43 a[i] = i;
46 for (i=0; i<2; i++)
48 __asm__ volatile ("");
50 int ret = llf[i] (MAX, a, b);
52 if (ret != (MAX * 2) - 2 + i)
53 abort ();
55 for (i=0; i<MAX*2; i++)
57 __asm__ volatile ("");
58 if (b[i] != i + (i%2) + 1)
59 abort ();
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" } } */