1 /* { dg-require-effective-target vect_int } */
2 
3 #include <stdarg.h>
4 #include "tree-vect.h"
5 
6 #define N 128
7 
8 typedef struct {
9    unsigned char a;
10    unsigned char b;
11    unsigned char c;
12    unsigned char d;
13    unsigned char e;
14    unsigned char f;
15    unsigned char g;
16    unsigned char h;
17 } s;
18 
19 __attribute__ ((noinline)) int
main1()20 main1 ()
21 {
22   int i;
23   s arr[N];
24   s *ptr = arr;
25   s check_res[N];
26   s res[N];
27   unsigned char u, t, s, x, y, z, w;
28 
29   for (i = 0; i < N; i++)
30     {
31       arr[i].a = i;
32       arr[i].b = i * 2;
33       arr[i].c = 17;
34       arr[i].d = i+34;
35       arr[i].e = i * 3 + 5;
36       arr[i].f = i * 5;
37       arr[i].g = i - 3;
38       arr[i].h = 67;
39 
40       u = arr[i].b - arr[i].a;
41       t = arr[i].d - arr[i].c;
42       check_res[i].c = u + t;
43       x = arr[i].b + arr[i].d;
44       check_res[i].a = arr[i].a + x;
45       check_res[i].d = u + t;
46       s = arr[i].h - arr[i].a;
47       check_res[i].b = s + t;
48       check_res[i].f = arr[i].f + arr[i].h;
49       check_res[i].e = arr[i].b + arr[i].e;
50       check_res[i].h = arr[i].d;
51       check_res[i].g = u + t;
52 
53       if (arr[i].a == 178)
54          abort ();
55     }
56 
57   for (i = 0; i < N; i++)
58     {
59       u = ptr->b - ptr->a;
60       t = ptr->d - ptr->c;
61       res[i].c = u + t;
62       x = ptr->b + ptr->d;
63       res[i].a = ptr->a + x;
64       res[i].d = u + t;
65       s = ptr->h - ptr->a;
66       res[i].b = s + t;
67       res[i].f = ptr->f + ptr->h;
68       res[i].e = ptr->b + ptr->e;
69       res[i].h = ptr->d;
70       res[i].g = u + t;
71       ptr++;
72     }
73 
74   /* check results:  */
75   for (i = 0; i < N; i++)
76     {
77       if (res[i].a != check_res[i].a
78 	  || res[i].b != check_res[i].b
79 	  || res[i].c != check_res[i].c
80 	  || res[i].d != check_res[i].d
81 	  || res[i].e != check_res[i].e
82 	  || res[i].f != check_res[i].f
83 	  || res[i].g != check_res[i].g
84 	  || res[i].h != check_res[i].h)
85          abort ();
86    }
87 }
88 
89 
main(void)90 int main (void)
91 {
92   check_vect ();
93 
94   main1 ();
95 
96   return 0;
97 }
98 
99 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
100 /* { dg-final { cleanup-tree-dump "vect" } } */
101 
102