openmp: Fix signed/unsigned warning
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-mult.c
blob350223fa23ace9253e8e56bbbbd065e575639b19
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 #pragma GCC novector
39 for (i = 0; i < N; i++)
41 if (res[i].b != arr[i].b - arr[i].a
42 || ires[i].a != iarr[i].b - iarr[i].a
43 || res[i].a != arr[i].b + arr[i].a
44 || ires[i].b != iarr[i].b + iarr[i].a
46 abort ();
49 return 0;
52 int main (void)
54 int i;
55 s arr[N];
56 ii iarr[N];
58 check_vect ();
60 for (i = 0; i < N; i++)
62 arr[i].a = i;
63 arr[i].b = i * 2;
64 iarr[i].a = i;
65 iarr[i].b = i * 3;
66 asm volatile ("" ::: "memory");
69 main1 (arr, iarr);
71 return 0;
74 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided2 } } } */