libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-strided-u8-i8-gap4-unknown.c
blob0a6050ae462332b8d74043fce094776892a80386
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 #pragma GCC novector
57 for (i = 0; i < n; i++)
59 if (res[i].c != arr[i].b + arr[i].c
60 || res[i].a != arr[i].c + arr[i].f + arr[i].b
61 || res[i].d != arr[i].b + arr[i].c
62 || res[i].b != arr[i].c
63 || res[i].f != arr[i].f + arr[i].e
64 || res[i].e != arr[i].b + arr[i].e
65 || res[i].h != arr[i].c
66 || res[i].g != arr[i].b + arr[i].c)
67 abort ();
70 /* Check also that we don't do more iterations than needed. */
71 #pragma GCC novector
72 for (i = n; i < N; i++)
74 if (res[i].c == arr[i].b + arr[i].c
75 || res[i].a == arr[i].c + arr[i].f + arr[i].b
76 || res[i].d == arr[i].b + arr[i].c
77 || res[i].b == arr[i].c
78 || res[i].f == arr[i].f + arr[i].e
79 || res[i].e == arr[i].b + arr[i].e
80 || res[i].h == arr[i].c
81 || res[i].g == arr[i].b + arr[i].c)
82 abort ();
85 return 0;
89 int main (void)
91 int i;
92 s arr[N];
94 check_vect ();
96 for (i = 0; i < N; i++)
98 arr[i].a = 5;
99 arr[i].b = 6;
100 arr[i].c = 17;
101 arr[i].d = 3;
102 arr[i].e = 16;
103 arr[i].f = 16;
104 arr[i].g = 3;
105 arr[i].h = 56;
106 asm volatile ("" ::: "memory");
109 main1 (arr, N-2);
111 return 0;
114 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_strided8 } } } */