libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-live-slp-3.c
blobe37822406751b99b3e5e7b33722dcb1912483345
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" } */
6 #include "tree-vect.h"
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; \
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};
38 #define MAX 153
40 int
41 main (void)
43 long a[MAX*4];
44 long b[MAX*4];
45 int i;
47 check_vect ();
49 for (i=0; i<MAX*4; i++)
51 __asm__ volatile ("");
52 a[i] = i;
55 #pragma GCC novector
56 for (i=0; i<4; i++)
58 __asm__ volatile ("");
60 int ret = llf[i] (MAX, a, b);
62 if (ret != (MAX * 4) - 4 + i)
63 abort ();
65 #pragma GCC novector
66 for (i=0; i<MAX*4; i++)
68 __asm__ volatile ("");
69 if (b[i] != i + (i%4) + 1)
70 abort ();
75 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 4 "vect" } } */
76 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 4 "vect" { xfail vect_variable_length } } } */
77 /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 4 "vect" } } */