Add compile command to each testcase
[gcc-vect-testsuite.git] / vect-strided-same-dr.c
blobf16aa1a94d739d82c3382eb37614be113d0af964
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 typedef struct {
9 unsigned short a;
10 unsigned short b;
11 } s;
13 s buffer1[N], buffer2[N];
15 __attribute__ ((noinline)) int
16 main1 (s * __restrict__ pIn, s* __restrict__ pOut)
18 unsigned short i, x, y, d;
19 s *p, *q;
21 p = pIn;
22 q = pOut;
24 for (i = 0; i < N/2; i++)
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++;
37 /* check results: */
38 for (i = 0; i < N/2; i++)
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++;
51 return 0;
54 int main (void)
56 short i;
58 for (i = 0; i < N; i++)
60 buffer1[i].a = i;
61 buffer1[i].b = i + 8;
62 buffer2[i].a = i * 3;
63 buffer2[i].b = i * 2;
64 if (buffer1[i].a == 500)
65 abort();
68 check_vect ();
70 main1 (buffer1, buffer2);
72 return 0;
75 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided2 } } } */
76 /* { dg-final { cleanup-tree-dump "vect" } } */