comparison gcc/testsuite/gcc.dg/vect/vect-live-slp-3.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-require-effective-target vect_long } */
2 /* { dg-additional-options "-fno-tree-scev-cprop" } */
3
4 #include "tree-vect.h"
5
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; \
27 }
28
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};
35
36 #define MAX 153
37
38 int
39 main (void)
40 {
41 long a[MAX*4];
42 long b[MAX*4];
43 int i;
44
45 check_vect ();
46
47 for (i=0; i<MAX*4; i++)
48 {
49 __asm__ volatile ("");
50 a[i] = i;
51 }
52
53 for (i=0; i<4; i++)
54 {
55 __asm__ volatile ("");
56
57 int ret = llf[i] (MAX, a, b);
58
59 if (ret != (MAX * 4) - 4 + i)
60 abort ();
61
62 for (i=0; i<MAX*4; i++)
63 {
64 __asm__ volatile ("");
65 if (b[i] != i + (i%4) + 1)
66 abort ();
67 }
68 }
69 }
70
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" } } */
73 /* { dg-final { scan-tree-dump-times "vec_stmt_relevant_p: stmt live but not relevant" 4 "vect" } } */