LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u8-i8-gap7-big-array.c
blobb703e636b49f8c7995c4c463b38b585f79acbdf2
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 char a;
10 unsigned char b;
11 unsigned char c;
12 unsigned char d;
13 unsigned char e;
14 unsigned char f;
15 unsigned char g;
16 unsigned char h;
17 } s;
19 s check_res[N];
21 __attribute__ ((noinline)) int
22 main1 (s *arr)
24 int i;
25 s *ptr = arr;
26 s res[N];
27 unsigned char u, t, s, x, z, w;
29 for (i = 0; i < N; i++)
31 u = ptr->b - ptr->a;
32 t = ptr->d - ptr->c;
33 res[i].c = u + t;
34 x = ptr->b + ptr->d;
35 res[i].a = ptr->a + x;
36 res[i].d = u + t;
37 s = ptr->h - ptr->a;
38 res[i].b = s + t;
39 res[i].f = ptr->f + ptr->h;
40 res[i].e = ptr->b + ptr->e;
41 res[i].h = ptr->d;
42 res[i].g = u + t;
43 ptr++;
46 /* check results: */
47 for (i = 0; i < N; i++)
49 if (res[i].a != check_res[i].a
50 || res[i].b != check_res[i].b
51 || res[i].c != check_res[i].c
52 || res[i].d != check_res[i].d
53 || res[i].e != check_res[i].e
54 || res[i].f != check_res[i].f
55 || res[i].g != check_res[i].g
56 || res[i].h != check_res[i].h)
57 abort ();
62 int main (void)
64 int i;
65 s arr[N];
66 unsigned char u, t, s, x, z, w;
68 check_vect ();
70 for (i = 0; i < N; i++)
72 arr[i].a = i;
73 arr[i].b = i * 2;
74 arr[i].c = 17;
75 arr[i].d = i+34;
76 arr[i].e = i * 3 + 5;
77 arr[i].f = i * 5;
78 arr[i].g = i - 3;
79 arr[i].h = 67;
81 u = arr[i].b - arr[i].a;
82 t = arr[i].d - arr[i].c;
83 check_res[i].c = u + t;
84 x = arr[i].b + arr[i].d;
85 check_res[i].a = arr[i].a + x;
86 check_res[i].d = u + t;
87 s = arr[i].h - arr[i].a;
88 check_res[i].b = s + t;
89 check_res[i].f = arr[i].f + arr[i].h;
90 check_res[i].e = arr[i].b + arr[i].e;
91 check_res[i].h = arr[i].d;
92 check_res[i].g = u + t;
94 asm volatile ("" ::: "memory");
97 main1 (arr);
99 return 0;
102 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */