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 short a;
10    unsigned short b;
11 } s;
12 
13 s buffer1[N], buffer2[N];
14 
15 __attribute__ ((noinline)) int
main1(s * __restrict__ pIn,s * __restrict__ pOut)16 main1 (s * __restrict__  pIn, s* __restrict__ pOut)
17 {
18   unsigned short i, x, y, d;
19   s *p, *q;
20 
21   p = pIn;
22   q = pOut;
23 
24   for (i = 0; i < N/2; i++)
25     {
26       x = pIn->a + 5;
27       y = pIn->a + 2;
28       pOut->a = x;
29       pOut->b = pIn->b;
30       pOut++;
31       pOut->a = y;
32       pOut->b = pIn->b;
33       pOut++;
34       pIn++;
35     }
36 
37   /* check results:  */
38   for (i = 0; i < N/2; i++)
39     {
40       if (q->a != p->a + 5
41           || q->b != p->b)
42          abort ();
43       q++;
44       if (q->a != p->a + 2
45           || q->b != p->b)
46         abort ();
47       q++;
48       p++;
49     }
50 
51   return 0;
52 }
53 
main(void)54 int main (void)
55 {
56   short i;
57 
58   for (i = 0; i < N; i++)
59     {
60       buffer1[i].a = i;
61       buffer1[i].b = i + 8;
62       buffer2[i].a = i * 3;
63       buffer2[i].b = i * 2;
64       asm volatile ("" ::: "memory");
65     }
66 
67   check_vect ();
68 
69   main1 (buffer1, buffer2);
70 
71   return 0;
72 }
73 
74 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect"  { target vect_strided2 } } } */
75