Merged with mainline at revision 128810.
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-mult.c
blob6ddf0932411a90551639510722e2ca075b646aed
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 typedef struct {
14 unsigned int a;
15 unsigned int b;
16 } ii;
18 __attribute__ ((noinline)) int
19 main1 (s *arr, ii *iarr)
21 s *ptr = arr;
22 ii *iptr = iarr;
23 s res[N];
24 ii ires[N];
25 int i;
27 for (i = 0; i < N; i++)
29 ires[i].a = iptr->b - iptr->a;
30 ires[i].b = iptr->b + iptr->a;
31 res[i].b = ptr->b - ptr->a;
32 res[i].a = ptr->b + ptr->a;
33 iptr++;
34 ptr++;
37 /* check results: */
38 for (i = 0; i < N; i++)
40 if (res[i].b != arr[i].b - arr[i].a
41 || ires[i].a != iarr[i].b - iarr[i].a
42 || res[i].a != arr[i].b + arr[i].a
43 || ires[i].b != iarr[i].b + iarr[i].a
45 abort ();
48 return 0;
51 int main (void)
53 int i;
54 s arr[N];
55 ii iarr[N];
57 check_vect ();
59 for (i = 0; i < N; i++)
61 arr[i].a = i;
62 arr[i].b = i * 2;
63 iarr[i].a = i;
64 iarr[i].b = i * 3;
65 if (arr[i].a == 178)
66 abort();
69 main1 (arr, iarr);
71 return 0;
74 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target { vect_interleave && vect_extract_even_odd } } } } */
75 /* { dg-final { cleanup-tree-dump "vect" } } */