2018-01-16 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-live-4.c
blob21cc27320acb5a71c6a37d1439e1dabcf98252d3
1 /* { dg-require-effective-target vect_int } */
3 #include "tree-vect.h"
5 /* Statement used outside the loop, not used inside the loop. SCEV cannot
6 hoist the stmt. */
7 __attribute__ ((noinline)) int
8 liveloop (int n, int *x, int *y)
10 int i;
11 int ret;
13 for (i = 0; i < n; ++i)
15 ret = x[i] + 5;
16 y[i] = ret;
18 return ret;
21 #define MAX 273
23 int
24 main (void)
26 int a[MAX];
27 int b[MAX];
28 int i;
30 check_vect ();
32 for (i=0; i<MAX; i++)
34 __asm__ volatile ("");
35 a[i] = i;
38 int ret = liveloop (MAX, a, b);
40 if (ret != MAX + 4)
41 abort ();
43 for (i=0; i<MAX; i++)
45 __asm__ volatile ("");
46 if (b[i] != i+5)
47 abort ();
51 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
52 /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 1 "vect" } } */