LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-a-mult.c
blobda47a824cb6046dcd9808bd7bd80161dbc0531b5
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 ()
21 s arr[N];
22 s *ptr = arr;
23 ii iarr[N];
24 ii *iptr = iarr;
25 s res[N];
26 ii ires[N];
27 int i;
29 for (i = 0; i < N; i++)
31 arr[i].a = i;
32 arr[i].b = i * 2;
33 iarr[i].a = i;
34 iarr[i].b = i * 3;
35 asm volatile ("" ::: "memory");
38 for (i = 0; i < N; i++)
40 ires[i].a = iptr->b - iptr->a;
41 ires[i].b = iptr->b + iptr->a;
42 res[i].b = ptr->b - ptr->a;
43 res[i].a = ptr->b + ptr->a;
44 iptr++;
45 ptr++;
48 /* check results: */
49 for (i = 0; i < N; i++)
51 if (res[i].b != arr[i].b - arr[i].a
52 || ires[i].a != iarr[i].b - iarr[i].a
53 || res[i].a != arr[i].b + arr[i].a
54 || ires[i].b != iarr[i].b + iarr[i].a
56 abort ();
59 return 0;
62 int main (void)
64 int i;
66 check_vect ();
68 main1 ();
70 return 0;
73 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided2 } } } */