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 
28   for (i = 0; i < N; i++)
29     {
30       arr[i].a = i;
31       arr[i].b = i * 2;
32       arr[i].c = 17;
33       arr[i].d = i+34;
34       arr[i].e = i + 5;
35       arr[i].f = i * 2 + 2;
36       arr[i].g = i - 3;
37       arr[i].h = 56;
38 
39       check_res[i].c = arr[i].a;
40       check_res[i].a = arr[i].f + arr[i].a;
41       check_res[i].d = arr[i].f - arr[i].a;
42       check_res[i].b = arr[i].f;
43       check_res[i].f = arr[i].a;
44       check_res[i].e = arr[i].f - arr[i].a;
45       check_res[i].h = arr[i].f;
46       check_res[i].g = arr[i].f - arr[i].a;
47 
48       asm volatile ("" ::: "memory");
49     }
50 
51   for (i = 0; i < N; i++)
52     {
53       res[i].c = ptr->a;
54       res[i].a = ptr->f + ptr->a;
55       res[i].d = ptr->f - ptr->a;
56       res[i].b = ptr->f;
57       res[i].f = ptr->a;
58       res[i].e = ptr->f - ptr->a;
59       res[i].h = ptr->f;
60       res[i].g = ptr->f - ptr->a;
61       ptr++;
62     }
63 
64   /* check results:  */
65   for (i = 0; i < N; i++)
66     {
67       if (res[i].a != check_res[i].a
68 	  || res[i].b != check_res[i].b
69 	  || res[i].c != check_res[i].c
70 	  || res[i].d != check_res[i].d
71 	  || res[i].e != check_res[i].e
72 	  || res[i].f != check_res[i].f
73 	  || res[i].g != check_res[i].g
74 	  || res[i].h != check_res[i].h)
75           abort ();
76    }
77 }
78 
79 
main(void)80 int main (void)
81 {
82   check_vect ();
83 
84   main1 ();
85 
86   return 0;
87 }
88 
89 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */
90 
91