OSDN Git Service

PR tree-optimization/40238
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-vfa-slp.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7 struct S
8 {
9   unsigned short a;
10   unsigned short b;
11 };
12
13 struct S result[N] = {12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18,
14                       18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24,
15                       24, 25, 25, 26, 26, 27, 27, 28};
16 struct S X[N] = {10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16,
17                  16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22,
18                  23, 23, 24, 24, 25, 25};
19 struct S Y[N] = {};
20  
21 __attribute__ ((noinline)) void
22 foo (struct S * in, struct S * out)
23 {
24   int i;
25
26   for (i = 0; i < N; i++)
27     {
28       out[i].a = in[i].a + 2;
29       out[i].b = in[i].b + 3;
30     }
31 }
32
33 int
34 main (void)
35
36   int i;
37
38   check_vect ();
39
40   foo (X, Y);
41   
42   /* check results:  */
43   for (i = 0; i < N; i++)
44     {
45       if (Y[i].a != result[i].a)
46         abort ();
47
48       if (Y[i].b != result[i].b)
49         abort ();
50
51     }
52   return 0;
53
54
55 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { xfail vect_no_align } } } */
56 /* { dg-final { cleanup-tree-dump "vect" } } */