LWG 3035. std::allocator's constructors should be constexpr
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u8-i8-gap4-unknown.c
blob69b970ef33b9dd8834b10baf7085b88a0c441a46
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 160
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 __attribute__ ((noinline)) int
20 main1 (s *arr, int n)
22 int i;
23 s *ptr = arr;
24 s res[N];
25 unsigned char x;
27 for (i = 0; i < N; i++)
29 res[i].a = 0;
30 res[i].b = 0;
31 res[i].c = 0;
32 res[i].d = 0;
33 res[i].e = 0;
34 res[i].f = 0;
35 res[i].g = 0;
36 res[i].h = 0;
37 __asm__ volatile ("");
40 /* Check peeling for gaps for unknown loop bound. */
41 for (i = 0; i < n; i++)
43 res[i].c = ptr->b + ptr->c;
44 x = ptr->c + ptr->f;
45 res[i].a = x + ptr->b;
46 res[i].d = ptr->b + ptr->c;
47 res[i].b = ptr->c;
48 res[i].f = ptr->f + ptr->e;
49 res[i].e = ptr->b + ptr->e;
50 res[i].h = ptr->c;
51 res[i].g = ptr->b + ptr->c;
52 ptr++;
55 /* check results: */
56 for (i = 0; i < n; i++)
58 if (res[i].c != arr[i].b + arr[i].c
59 || res[i].a != arr[i].c + arr[i].f + arr[i].b
60 || res[i].d != arr[i].b + arr[i].c
61 || res[i].b != arr[i].c
62 || res[i].f != arr[i].f + arr[i].e
63 || res[i].e != arr[i].b + arr[i].e
64 || res[i].h != arr[i].c
65 || res[i].g != arr[i].b + arr[i].c)
66 abort ();
69 /* Check also that we don't do more iterations than needed. */
70 for (i = n; i < N; i++)
72 if (res[i].c == arr[i].b + arr[i].c
73 || res[i].a == arr[i].c + arr[i].f + arr[i].b
74 || res[i].d == arr[i].b + arr[i].c
75 || res[i].b == arr[i].c
76 || res[i].f == arr[i].f + arr[i].e
77 || res[i].e == arr[i].b + arr[i].e
78 || res[i].h == arr[i].c
79 || res[i].g == arr[i].b + arr[i].c)
80 abort ();
83 return 0;
87 int main (void)
89 int i;
90 s arr[N];
92 check_vect ();
94 for (i = 0; i < N; i++)
96 arr[i].a = 5;
97 arr[i].b = 6;
98 arr[i].c = 17;
99 arr[i].d = 3;
100 arr[i].e = 16;
101 arr[i].f = 16;
102 arr[i].g = 3;
103 arr[i].h = 56;
104 asm volatile ("" ::: "memory");
107 main1 (arr, N-2);
109 return 0;
112 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */